diff options
author | Florian Dold <florian@dold.me> | 2021-06-16 11:44:05 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-16 11:44:05 +0200 |
commit | 1124c709acbe1fdff7608b2d2c458e0afc3b7b7c (patch) | |
tree | efb5424cb0b792d87bf7548b3eca1313d373b9d0 /packages/taler-wallet-core/src/util/contractTerms.test.ts | |
parent | 52b8785d95694e373d8efdb2aa1680e51172bd81 (diff) | |
download | wallet-core-1124c709acbe1fdff7608b2d2c458e0afc3b7b7c.tar.xz |
use same salt derivation as C code for forgettable fields
Diffstat (limited to 'packages/taler-wallet-core/src/util/contractTerms.test.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/contractTerms.test.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/util/contractTerms.test.ts b/packages/taler-wallet-core/src/util/contractTerms.test.ts index b7783f077..74cae4ca7 100644 --- a/packages/taler-wallet-core/src/util/contractTerms.test.ts +++ b/packages/taler-wallet-core/src/util/contractTerms.test.ts @@ -95,3 +95,28 @@ test("contract terms canon hashing (nested)", (t) => { t.true(ContractTermsUtil.validateForgettable(c3)); t.true(ContractTermsUtil.validateForgettable(c4)); }); + +test("contract terms reference vector", (t) => { + const j = { + k1: 1, + $forgettable: { + k1: "SALT", + }, + k2: { + n1: true, + $forgettable: { + n1: "salt", + }, + }, + k3: { + n1: "string", + }, + }; + + const h = ContractTermsUtil.hashContractTerms(j); + + t.deepEqual( + h, + "VDE8JPX0AEEE3EX1K8E11RYEWSZQKGGZCV6BWTE4ST1C8711P7H850Z7F2Q2HSSYETX87ERC2JNHWB7GTDWTDWMM716VKPSRBXD7SRR", + ); +}); |