A private key: a 64-octet seed, or a decapsulation key of FIPS 203 (2400 octets).
Optionalopts: MlKemCreateOptions
Options: see MlKemCreateOptions.
A promise that resolves to an MlKemDecapsulatorInterface instance.
import {
createMlKem768Decapsulator,
createMlKem768Encapsulator,
generateMlKem768KeyPair,
} from "@webpqc/mlkem";
const [pk, sk] = await generateMlKem768KeyPair();
const [ct, _ss] = await (await createMlKem768Encapsulator(pk)).encap();
const decapsulator = await createMlKem768Decapsulator(sk);
const ss = await decapsulator.decap(ct);
decapsulator.destroy();
Creates an ML-KEM-768 (NIST security category 3) 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.