taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 5ba3194bd0ce82a0155648a26b4abefbcb2d2427
parent 55786cd92516c578216465a7ee5eaba5288b950d
Author: Florian Dold <dold@taler.net>
Date:   Tue, 21 Jul 2026 20:21:46 +0200

util: pin the AML h_payto test to the real hash size

A normalized payto hash is a truncated SHA-512 of 32 bytes, the size of the
GNUNET_ShortHashCode that TALER_NormalizedPaytoHashP holds.

Diffstat:
Mpackages/taler-util/src/taler-crypto.test.ts | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/taler-util/src/taler-crypto.test.ts b/packages/taler-util/src/taler-crypto.test.ts @@ -689,7 +689,9 @@ test("decodeCrockFixed rejects wrong-length encodings", (t) => { test("signAmlDecision rejects a malformed h_payto", (t) => { const priv = new Uint8Array(32); - const hPayto = encodeCrock(new Uint8Array(64)); + // A normalized payto hash is a truncated SHA-512: 32 bytes, the size of + // GNUNET_ShortHashCode, which is what TALER_NormalizedPaytoHashP holds. + const hPayto = encodeCrock(new Uint8Array(32)); const decision: any = { keep_investigating: false, decision_time: TalerProtocolTimestamp.fromSeconds(1000), @@ -702,7 +704,7 @@ test("signAmlDecision rejects a malformed h_payto", (t) => { attributes: null, }; - // A well-formed 64-byte h_payto signs. + // A well-formed 32-byte h_payto signs. assert.ok(signAmlDecision(priv, decision) instanceof Uint8Array); // A truncated h_payto would silently produce a wrong-length signed blob, so