Skip to content

Class: PublicKey ​

Defined in: keys.ts:42

A public key (KEM or signature). Safe to share, log and persist.

Accessors ​

algorithm ​

Get Signature ​

get algorithm(): string

Defined in: keys.ts:71

Canonical algorithm string, e.g. X25519+ML-KEM-768.

Returns ​

string


migrationState ​

Get Signature ​

get migrationState(): MigrationState

Defined in: keys.ts:75

Migration state recorded with the key.

Returns ​

MigrationState

Methods ​

[dispose]() ​

[dispose](): void

Defined in: keys.ts:111

Supports using key = ....

Returns ​

void


fingerprint() ​

fingerprint(): string

Defined in: keys.ts:83

sha256(algorithm ‖ 0x00 ‖ key) as lowercase hex (identical to quantum-safe-py).

Returns ​

string


fingerprintColon() ​

fingerprintColon(): string

Defined in: keys.ts:87

Fingerprint as colon-separated byte pairs.

Returns ​

string


free() ​

free(): void

Defined in: keys.ts:107

Releases WASM memory. The object is unusable afterwards.

Returns ​

void


toBytes() ​

toBytes(): Uint8Array

Defined in: keys.ts:79

Raw key bytes in quantum-safe-py wire layout.

Returns ​

Uint8Array


toCbor() ​

toCbor(): Uint8Array

Defined in: keys.ts:91

CBOR serialization ({v, algo, ms, ktype, key}).

Returns ​

Uint8Array


toJSON() ​

toJSON(): object

Defined in: keys.ts:117

Returns ​

object

algorithm ​

algorithm: string

fingerprint ​

fingerprint: string

type ​

type: "PublicKey"


toJwk() ​

toJwk(): string

Defined in: keys.ts:99

JWK serialization as a JSON string (kty: "AKP").

Returns ​

string


toPem() ​

toPem(): string

Defined in: keys.ts:95

PEM serialization with qs-* headers.

Returns ​

string


toString() ​

toString(): string

Defined in: keys.ts:114

Returns ​

string


fromBytes() ​

static fromBytes(algorithm, raw, migrationState?): PublicKey

Defined in: keys.ts:51

Builds a key from its raw bytes (for example read from a quantum-safe-py key).

Parameters ​

algorithm ​

string

raw ​

Uint8Array

migrationState? ​

MigrationState

Returns ​

PublicKey


fromCbor() ​

static fromCbor(data): PublicKey

Defined in: keys.ts:57

Parses to_cbor() output of quantum-safe-py or this library.

Parameters ​

data ​

Uint8Array

Returns ​

PublicKey


fromJwk() ​

static fromJwk(jwk): PublicKey

Defined in: keys.ts:65

Parses a JWK (kty: "AKP") given as a JSON string or object.

Parameters ​

jwk ​

string | Record<string, unknown>

Returns ​

PublicKey


fromPem() ​

static fromPem(pem): PublicKey

Defined in: keys.ts:61

Parses a QUANTUM SAFE PUBLIC KEY PEM.

Parameters ​

pem ​

string

Returns ​

PublicKey

Apache-2.0.