Comparing version 0.2.0 to 0.3.0
@@ -17,3 +17,3 @@ { | ||
}, | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A public-private key library for post-quantum cryptography (early stage, use with caution)", | ||
@@ -20,0 +20,0 @@ "bugs": { |
import { ml_kem512 } from "@noble/post-quantum/ml-kem"; | ||
import { Buffer } from "buffer"; //for web | ||
const VERSION = 2; //incremental versions, each one is not compatible with earlier ones. | ||
const VERSION = 3; //incremental versions, each one is not compatible with earlier ones. | ||
@@ -100,2 +100,3 @@ interface SIGN { | ||
.trim(); | ||
const publicKeyObj = JSON.parse(Buffer.from(publicKeyEncoded, "base64").toString("utf-8")); | ||
@@ -132,4 +133,4 @@ const kyberPublicKey = new Uint8Array(publicKeyObj.kyberPublicKey); | ||
const payload = { | ||
cipherText: Array.from(aliceMeta.cipherText), | ||
encryptedData: Array.from(new Uint8Array(encryptedData)), | ||
cipherText: Buffer.from(aliceMeta.cipherText).toString("base64"), | ||
encryptedData: Buffer.from(encryptedData).toString("base64"), | ||
iv: Array.from(iv), | ||
@@ -153,4 +154,4 @@ version: VERSION, | ||
const payload = JSON.parse(Buffer.from(encryptedPayload, "base64").toString("utf-8")); | ||
const cipherText = new Uint8Array(payload.cipherText); | ||
const encryptedData = new Uint8Array(payload.encryptedData); | ||
const cipherText = new Uint8Array(Buffer.from(payload.cipherText, "base64")); | ||
const encryptedData = new Uint8Array(Buffer.from(payload.encryptedData, "base64")); | ||
const iv = new Uint8Array(payload.iv); | ||
@@ -157,0 +158,0 @@ |
21726