chore: update implementation status in DBIS_RAIL_ADDONS_CODE_COMPLETION_TASK_LIST.md
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- Added a detailed implementation status table outlining the completion status of various phases. - Marked the submodule reference for smom-dbis-138 as dirty to reflect changes. Made-with: Cursor
This commit is contained in:
32
scripts/dbis/canonicalization-test-vectors.js
Normal file
32
scripts/dbis/canonicalization-test-vectors.js
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* DBIS Rail — Canonicalization test vectors (Hash Canonicalization v1.5).
|
||||
* Computes lebHash, lpaId, isoHash from canonical JSON (UTF-8, sorted keys).
|
||||
* Run: node scripts/dbis/canonicalization-test-vectors.js
|
||||
* Requires: Node 18+ (no deps) or use ethers/viem for keccak256 if available.
|
||||
*/
|
||||
|
||||
const crypto = require("crypto");
|
||||
|
||||
function keccak256Hex(data) {
|
||||
const buf = Buffer.isBuffer(data) ? data : Buffer.from(data, "utf8");
|
||||
const h = crypto.createHash("sha3-256").update(buf).digest("hex");
|
||||
return "0x" + h;
|
||||
}
|
||||
|
||||
const LEB_CANONICAL = '{"batchNumber":1,"journalId":"J-2025-001","ledgerSystemId":"CORE","postingTimestamp":1740931200,"reserveAccountId":"RES-USD-001"}';
|
||||
const LPA_CANONICAL = '{"lebHash":"0x0000000000000000000000000000000000000000000000000000000000000001","state":"POSTED_FINAL","stateTimestamp":1740931200}';
|
||||
const ISO_CANONICAL = '{"amount":"1000.000000","currency":"USD","endToEndId":"E2E-2025-001","messageType":"pacs.008","timestamp":1740931200,"uetr":"550e8400-e29b-41d4-a716-446655440000"}';
|
||||
|
||||
const lebHash = keccak256Hex(LEB_CANONICAL);
|
||||
const lpaId = keccak256Hex(LPA_CANONICAL);
|
||||
const isoHash = keccak256Hex(ISO_CANONICAL);
|
||||
|
||||
console.log("LEB (canonical):", LEB_CANONICAL);
|
||||
console.log("lebHash:", lebHash);
|
||||
console.log("");
|
||||
console.log("LPA (canonical):", LPA_CANONICAL);
|
||||
console.log("lpaId:", lpaId);
|
||||
console.log("");
|
||||
console.log("ISO bundle (canonical):", ISO_CANONICAL);
|
||||
console.log("isoHash:", isoHash);
|
||||
Reference in New Issue
Block a user