Skip to content

Variable: Lms ​

const Lms: object

Defined in: lms.ts:45

LMS / HSS signature verification and public-key inspection.

Type Declaration ​

inspectPublicKey() ​

readonly inspectPublicKey(publicKey): HssPublicKeyInfo

Reads the parameter set of an HSS public key without verifying anything.

Parameters ​

publicKey ​

Uint8Array

HSS public key (see Lms.verify).

Returns ​

HssPublicKeyInfo

The level count, type codes, tree height, Winternitz parameter and a readable parameter-set name.

Throws ​

if the public key is structurally invalid, including a level count outside 1 to 8.

Throws ​

for parameter sets outside the supported list.

Throws ​

if publicKey is not bytes.

isValid() ​

readonly isValid(publicKey, message, signature): boolean

Like Lms.verify but returns false for a well-formed, invalid signature. Structural problems still throw.

Parameters ​

publicKey ​

Uint8Array

HSS public key (see Lms.verify).

message ​

Uint8Array

The signed message.

signature ​

Uint8Array

HSS signature (see Lms.verify).

Returns ​

boolean

true if the signature verifies, false if it is well formed but does not.

Throws ​

if the public key is structurally invalid.

Throws ​

if the signature is truncated, has trailing bytes, or its level count disagrees with the key.

Throws ​

for parameter sets outside the supported list.

Throws ​

if an argument is not bytes.

verify() ​

readonly verify(publicKey, message, signature): void

Verifies an HSS signature over message.

Parameters ​

publicKey ​

Uint8Array

HSS public key: u32(levels) || LMS public key (60 bytes), as in RFC 8554 §6.3.

message ​

Uint8Array

The signed message.

signature ​

Uint8Array

HSS signature: u32(levels - 1) || (LMS signature || LMS public key)* || LMS signature.

Returns ​

void

Throws ​

if the signature is well formed but does not verify.

Throws ​

if the public key is structurally invalid, including a level count outside 1 to 8.

Throws ​

if the signature is truncated, has trailing bytes, or its level count disagrees with the key.

Throws ​

for parameter sets outside the supported list.

Throws ​

if an argument is not bytes.

Example ​

ts
Lms.verify(publicKey, message, signature); // throws VerificationError when the signature is wrong
const { parameterSet } = Lms.inspectPublicKey(publicKey); // e.g. "LMS_SHA256_M32_H10/LMOTS_SHA256_N32_W8"

Apache-2.0.