Skip to content

Commit

Permalink
Point to @openpgp/crystals-kyber-js
Browse files Browse the repository at this point in the history
  • Loading branch information
larabr committed Mar 1, 2024
1 parent 88c121a commit cdb7f48
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 18 deletions.
64 changes: 50 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"bn.js": "^4.11.8",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"crystals-kyber-js": "larabr/crystals-kyber-js#e87c7319cbc56246a67fe94ff63b11bb421854ff",
"@openpgp/crystals-kyber-js": "^1.1.1-0",
"eslint": "^8.34.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/crypto/public_key/post_quantum/kem/ml_kem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import enums from '../../../../enums';
export async function generate(algo) {
switch (algo) {
case enums.publicKey.pqc_mlkem_x25519: {
const { MlKem768 } = await import('crystals-kyber-js');
const { MlKem768 } = await import('@openpgp/crystals-kyber-js');
const kyberInstance = new MlKem768();
const [encapsulationKey, decapsulationKey] = await kyberInstance.generateKeyPair();

Expand All @@ -17,7 +17,7 @@ export async function generate(algo) {
export async function encaps(algo, mlkemRecipientPublicKey) {
switch (algo) {
case enums.publicKey.pqc_mlkem_x25519: {
const { MlKem768 } = await import('crystals-kyber-js');
const { MlKem768 } = await import('@openpgp/crystals-kyber-js');
const kyberInstance = new MlKem768();
const [mlkemCipherText, mlkemKeyShare] = await kyberInstance.encap(mlkemRecipientPublicKey);

Expand All @@ -31,7 +31,7 @@ export async function encaps(algo, mlkemRecipientPublicKey) {
export async function decaps(algo, mlkemCipherText, mlkemSecretKey) {
switch (algo) {
case enums.publicKey.pqc_mlkem_x25519: {
const { MlKem768 } = await import('crystals-kyber-js');
const { MlKem768 } = await import('@openpgp/crystals-kyber-js');
const kyberInstance = new MlKem768();
const mlkemKeyShare = await kyberInstance.decap(mlkemCipherText, mlkemSecretKey);

Expand Down

0 comments on commit cdb7f48

Please sign in to comment.