UNPKG

mina-attestations

Version:
23 lines (22 loc) 1.11 kB
export { power, generateRsaKeys65537, randomPrime, millerRabinTest, bytesToBigint, bigintToBytes, bytesToBigintBE, bigintToBytesBE, }; /** * Generates 2048-bit RSA keys for a public exponent of e = 65537. * @param bitSize - The bit size of the prime numbers used for generating the RSA parameters. * @returns An object containing the RSA parameters: * `n` (modulus), `e` (public exponent), `d` (private exponent). */ declare function generateRsaKeys65537(): { n: bigint; e: bigint; d: bigint; }; /** * returns a random prime of a given bit length (which is a multiple of 8) */ declare function randomPrime(bitLength: number): bigint; declare function millerRabinTest(n: bigint): 'composite' | 'probably prime'; declare function bytesToBigint(bytes: Uint8Array | number[]): bigint; declare function bigintToBytes(x: bigint, byteLength: number): Uint8Array<ArrayBuffer>; declare function bytesToBigintBE(bytes: Uint8Array | number[]): bigint; declare function bigintToBytesBE(x: bigint, byteLength: number): Uint8Array<ArrayBuffer>; declare function power(a: bigint, n: bigint, p: bigint): bigint;