dilithium-crystals-js 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dilithium.js +1 -1
- package/dilithium.wasm +0 -0
- package/dist/dilithium.min.js +1 -1
- package/package.json +5 -1
- package/src/browser/index.js +7 -3
- package/src/common.js +0 -2
package/src/browser/index.js
CHANGED
@@ -3,8 +3,12 @@ import { DILITHIUM_PARAMS, generateKeys, sign, verify } from "../common";
|
|
3
3
|
|
4
4
|
// Function to fetch the WebAssembly file
|
5
5
|
async function fetchWasm() {
|
6
|
-
console.log(
|
7
|
-
|
6
|
+
console.log(
|
7
|
+
`fetching wasm from /node_modules/dilithium-crystals-js/dilithium.wasm`
|
8
|
+
);
|
9
|
+
const response = await fetch(
|
10
|
+
"/node_modules/dilithium-crystals-js/dilithium.wasm"
|
11
|
+
);
|
8
12
|
return await response.arrayBuffer();
|
9
13
|
}
|
10
14
|
|
@@ -16,7 +20,7 @@ const createDilithium = () =>
|
|
16
20
|
wasmBinary,
|
17
21
|
locateFile: (path) => {
|
18
22
|
if (path.endsWith(".wasm")) {
|
19
|
-
return "/node_modules/dilithium-js/dilithium.wasm";
|
23
|
+
return "/node_modules/dilithium-crystals-js/dilithium.wasm";
|
20
24
|
}
|
21
25
|
return path;
|
22
26
|
},
|
package/src/common.js
CHANGED
@@ -126,12 +126,10 @@ function sign(dilithium, message, privateKey, kind) {
|
|
126
126
|
}
|
127
127
|
|
128
128
|
function verify(dilithium, signature, message, publicKey, kind) {
|
129
|
-
console.log("inside verify for kind", kind);
|
130
129
|
// Determine the expected sizes based on the Dilithium kind
|
131
130
|
const params = DILITHIUM_PARAMS[kind];
|
132
131
|
const expectedSignatureSize = params.CRYPTO_BYTES + message.length;
|
133
132
|
const expectedPublicKeySize = params.CRYPTO_PUBLICKEYBYTES;
|
134
|
-
console.log("inside verify expectedPublicKeySize", expectedPublicKeySize);
|
135
133
|
|
136
134
|
// Validate input sizes
|
137
135
|
if (signature.length !== expectedSignatureSize) {
|