@unrdf/receipts 26.4.3 → 26.4.7
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/package.json +5 -5
- package/src/dilithium3.mjs +3 -1
- package/src/hybrid-signature.mjs +2 -0
- package/src/merkle-batcher.mjs +3 -12
- package/src/pq-merkle.mjs +4 -11
- package/src/pq-signer.mjs +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unrdf/receipts",
|
|
3
|
-
"version": "26.4.
|
|
3
|
+
"version": "26.4.7",
|
|
4
4
|
"description": "KGC Receipts - Batch receipt generation with Merkle tree verification and post-quantum cryptography for knowledge graph operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@noble/curves": "^2.0.1",
|
|
23
23
|
"@noble/hashes": "^2.0.1",
|
|
24
|
-
"@unrdf/core": "26.4.
|
|
25
|
-
"@unrdf/kgc-4d": "26.4.
|
|
26
|
-
"@unrdf/kgc-multiverse": "26.4.
|
|
27
|
-
"@unrdf/oxigraph": "26.4.
|
|
24
|
+
"@unrdf/core": "26.4.4",
|
|
25
|
+
"@unrdf/kgc-4d": "26.4.4",
|
|
26
|
+
"@unrdf/kgc-multiverse": "26.4.4",
|
|
27
|
+
"@unrdf/oxigraph": "26.4.4",
|
|
28
28
|
"dilithium-crystals": "^1.0.6",
|
|
29
29
|
"hash-wasm": "^4.12.0",
|
|
30
30
|
"zod": "^3.25.76"
|
package/src/dilithium3.mjs
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* @module @unrdf/receipts/dilithium3
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/* global TextEncoder */
|
|
9
|
+
|
|
8
10
|
import { sha3_256 } from '@noble/hashes/sha3.js';
|
|
9
11
|
import { z } from 'zod';
|
|
10
12
|
|
|
@@ -198,7 +200,7 @@ export async function verifyDilithium3(message, signatureObj) {
|
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
return hasNonZero;
|
|
201
|
-
} catch
|
|
203
|
+
} catch {
|
|
202
204
|
return false;
|
|
203
205
|
}
|
|
204
206
|
}
|
package/src/hybrid-signature.mjs
CHANGED
package/src/merkle-batcher.mjs
CHANGED
|
@@ -9,15 +9,9 @@ import { blake3 } from 'hash-wasm';
|
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Merkle Node Schema
|
|
12
|
+
* Merkle Node Schema (Internal - not currently exported)
|
|
13
|
+
* Reserved for future node-level validation if needed
|
|
13
14
|
*/
|
|
14
|
-
const MerkleNodeSchema = z.object({
|
|
15
|
-
hash: z.string().regex(/^[a-f0-9]{64}$/), // BLAKE3 hash (64 hex chars)
|
|
16
|
-
left: z.any().optional(), // Left child (recursive)
|
|
17
|
-
right: z.any().optional(), // Right child (recursive)
|
|
18
|
-
data: z.any().optional(), // Leaf data (if leaf node)
|
|
19
|
-
index: z.number().int().nonnegative(), // Node index
|
|
20
|
-
});
|
|
21
15
|
|
|
22
16
|
/**
|
|
23
17
|
* Merkle Proof Schema
|
|
@@ -153,9 +147,6 @@ export function generateMerkleProof(tree, leafIndex) {
|
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
const proof = [];
|
|
156
|
-
let currentNode = tree;
|
|
157
|
-
let currentIndex = leafIndex;
|
|
158
|
-
|
|
159
150
|
// Find leaf
|
|
160
151
|
let leaf = null;
|
|
161
152
|
function findLeaf(node) {
|
|
@@ -240,7 +231,7 @@ export async function verifyMerkleProof(proof, leafHash) {
|
|
|
240
231
|
// Validate proof schema
|
|
241
232
|
try {
|
|
242
233
|
MerkleProofSchema.parse(proof);
|
|
243
|
-
} catch
|
|
234
|
+
} catch {
|
|
244
235
|
return false;
|
|
245
236
|
}
|
|
246
237
|
|
package/src/pq-merkle.mjs
CHANGED
|
@@ -5,26 +5,19 @@
|
|
|
5
5
|
* @module @unrdf/receipts/pq-merkle
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/* global TextEncoder */
|
|
9
|
+
|
|
9
10
|
import { sha3_256, sha3_512 } from '@noble/hashes/sha3.js';
|
|
10
11
|
import { z } from 'zod';
|
|
11
12
|
import {
|
|
12
13
|
signDilithium3,
|
|
13
14
|
verifyDilithium3,
|
|
14
|
-
generateDilithium3KeyPair,
|
|
15
15
|
} from './dilithium3.mjs';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* XMSS Node Schema
|
|
18
|
+
* XMSS Node Schema (Internal - not currently exported)
|
|
19
|
+
* Reserved for future node-level validation if needed
|
|
19
20
|
*/
|
|
20
|
-
const XMSSNodeSchema = z.object({
|
|
21
|
-
hash: z.string(),
|
|
22
|
-
left: z.any().optional(),
|
|
23
|
-
right: z.any().optional(),
|
|
24
|
-
data: z.any().optional(),
|
|
25
|
-
index: z.number().int().nonnegative(),
|
|
26
|
-
signature: z.any().optional(), // Optional PQ signature
|
|
27
|
-
});
|
|
28
21
|
|
|
29
22
|
/**
|
|
30
23
|
* XMSS Proof Schema
|