bitcoinpqc
Version:
NodeJS TypeScript bindings for Bitcoin PQC library
52 lines (51 loc) • 1.87 kB
TypeScript
import { Algorithm, ErrorCode, KeyPair, PqcError, PublicKey, SecretKey, Signature } from "./types";
export { Algorithm, ErrorCode, KeyPair, PqcError, PublicKey, SecretKey, Signature, };
/**
* Get the public key size for an algorithm
*
* @param algorithm - The algorithm identifier
* @returns The public key size in bytes
*/
export declare function publicKeySize(algorithm: Algorithm): number;
/**
* Get the secret key size for an algorithm
*
* @param algorithm - The algorithm identifier
* @returns The secret key size in bytes
*/
export declare function secretKeySize(algorithm: Algorithm): number;
/**
* Get the signature size for an algorithm
*
* @param algorithm - The algorithm identifier
* @returns The signature size in bytes
*/
export declare function signatureSize(algorithm: Algorithm): number;
/**
* Generate a key pair for the specified algorithm
*
* @param algorithm - The PQC algorithm to use
* @param randomData - Random bytes for key generation (must be at least 128 bytes)
* @returns A new key pair
* @throws {PqcError} If key generation fails
*/
export declare function generateKeyPair(algorithm: Algorithm, randomData: Uint8Array): KeyPair;
/**
* Sign a message using the specified secret key
*
* @param secretKey - The secret key to sign with
* @param message - The message to sign
* @returns A signature
* @throws {PqcError} If signing fails
*/
export declare function sign(secretKey: SecretKey, message: Uint8Array): Signature;
/**
* Verify a signature using the specified public key
*
* @param publicKey - The public key to verify with
* @param message - The message that was signed
* @param signature - The signature to verify
* @returns {void}
* @throws {PqcError} If verification fails
*/
export declare function verify(publicKey: PublicKey, message: Uint8Array, signature: Signature | Uint8Array): void;