#!/usr/bin/env node /** * Preview digest for off-chain attestation signing (fiat / XAU custodian flow). * Uses keccak256(abi.encode(lineId, R, nonce, validUntil, evidenceKind)) — align with ops before HSM. * Usage: node omnl-attestation-payload.mjs */ import { keccak256, AbiCoder } from 'ethers'; const [, , lineId, R, nonce, validUntil, evidenceKind] = process.argv; if (!evidenceKind) { console.error( 'Usage: omnl-attestation-payload.mjs ' ); process.exit(1); } const coder = AbiCoder.defaultAbiCoder(); const encoded = coder.encode( ['bytes32', 'uint256', 'uint256', 'uint256', 'string'], [lineId, BigInt(R), BigInt(nonce), BigInt(validUntil), evidenceKind] ); const digest = keccak256(encoded); process.stdout.write(JSON.stringify({ digest, encoded }, null, 2) + '\n');