diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-08-15 13:48:37 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-08-15 13:48:37 +0200 |
commit | 70fca92e781696a057089bc8bc48adebdf6e017e (patch) | |
tree | 705614c28e8e2f46798a82db206b3fc8f06e3d34 /packages/taler-util/src/taler-crypto.ts | |
parent | 819949d7f2cfcce8d334cbfdb701255daac64951 (diff) |
[age-withdraw] WiP: first types and adjustments
Diffstat (limited to 'packages/taler-util/src/taler-crypto.ts')
-rw-r--r-- | packages/taler-util/src/taler-crypto.ts | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/packages/taler-util/src/taler-crypto.ts b/packages/taler-util/src/taler-crypto.ts index d52edc1e5..396ac89e1 100644 --- a/packages/taler-util/src/taler-crypto.ts +++ b/packages/taler-util/src/taler-crypto.ts @@ -1254,30 +1254,9 @@ export namespace AgeRestriction { age: number, ): Promise<AgeCommitmentProof> { invariant((ageMask & 1) === 1); - const numPubs = countAgeGroups(ageMask) - 1; - const numPrivs = getAgeGroupIndex(ageMask, age); - - const pubs: Edx25519PublicKey[] = []; - const privs: Edx25519PrivateKey[] = []; - - for (let i = 0; i < numPubs; i++) { - const priv = await Edx25519.keyCreate(); - const pub = await Edx25519.getPublic(priv); - pubs.push(pub); - if (i < numPrivs) { - privs.push(priv); - } - } + const seed = getRandomBytes(32); - return { - commitment: { - mask: ageMask, - publicKeys: pubs.map((x) => encodeCrock(x)), - }, - proof: { - privateKeys: privs.map((x) => encodeCrock(x)), - }, - }; + return restrictionCommitSeeded(ageMask, age, seed); } const PublishedAgeRestrictionBaseKey: Edx25519PublicKey = decodeCrock( |