A private key: a 64-octet seed, or a decapsulation key of FIPS 203 (1632 octets).
Optionalopts: MlKemCreateOptions
Options: see MlKemCreateOptions.
A promise that resolves to an MlKemDecapsulatorInterface instance.
import {
createMlKem512Decapsulator,
createMlKem512Encapsulator,
generateMlKem512KeyPair,
} from "@webpqc/mlkem";
const [pk, sk] = await generateMlKem512KeyPair();
const [ct, _ss] = await (await createMlKem512Encapsulator(pk)).encap();
const decapsulator = await createMlKem512Decapsulator(sk);
const ss = await decapsulator.decap(ct);
decapsulator.destroy();
Creates an ML-KEM-512 (NIST security category 1) decapsulator which holds a private key.
Call
destroy()of the decapsulator to erase the private key which it holds, when it is no longer needed.