Skip to main content
Version: 11.x

Function: generateKeyPair()

generateKeyPair(seed?): Falcon512KeyPair

Defined in: s2morrow/keys.ts:483

New key pair (NIST formats). The optional seed must be 48 bytes from a CSPRNG.

Parameters​

seed?​

Uint8Array<ArrayBufferLike>

48 random bytes; by default, drawn by the engine

Returns​

Falcon512KeyPair

the secret key (1281 bytes) and the public key (897 bytes)

Throws​

when the seed is not 48 bytes

Example​

const result = falcon512.generateKeyPair();
// result = { secretKey: Uint8Array(1281) [89, …], publicKey: Uint8Array(897) [9, …] }
// A new random key at each call; 89 (0x59) and 9 (0x09) are the headers of the two formats.