Skip to main content
Version: 11.x

Function: importFalconRsSecretKey()

importFalconRsSecretKey(secretKey): Uint8Array

Defined in: s2morrow/keys.ts:558

Converts a falcon-rs secret key (f‖g‖F‖G, 4 × 896 bytes) into a NIST secret key.

Warning: falcon-rs derives the seed of its sampler from the public salt of each signature, so the signatures it produced may leak information about the secret key. Import such a key for continuity only; for real funds, generate a new key with generateKeyPair.

Parameters​

secretKey​

string | Uint8Array<ArrayBufferLike>

the falcon-rs secret key (3584 bytes), or its hex string

Returns​

Uint8Array

the NIST secret key (1281 bytes)

Throws​

when the key has a wrong length, a coefficient out of range, a G that does not match f, g, F, or does not satisfy the NTRU equation

Example​

const result = falcon512.importFalconRsSecretKey(falconRsSecretKey);
// result = Uint8Array(1281) [89, …] (NIST header 0x59)