import * as kyber from pqc_kyber
kyber.Params.publicKeyBytes
:
kyber.Params.secretKeyBytes
:
kyber.Params.ciphertextBytes
:
kyber.Params.sharedSecretBytes
:
var keys = kyber.keypair();
const publicKeyAlice = keys.pubkey;
const privateKeyAlice = keys.secret;
var enc = kyber.encapsulate(publicKeyAlice);
var ciphertextBob = enc.ciphertext;
var sharedSecretBob = enc.sharedSecret;
var dec = kyber.decapsulate(ciphertextBob, privateKeyAlice);
var sharedSecretAlice = dec.sharedSecret;
assert.equal(sharedSecretAlice, sharedSecretBob);