diff options
author | Florian Dold <florian@dold.me> | 2020-12-15 17:12:22 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2020-12-15 17:12:22 +0100 |
commit | c09c5bbe625566fc61c811160d2ccdab263327fa (patch) | |
tree | 4ce80e615bad8cf325b1b31aac957c6ce1ee0f05 /packages/taler-wallet-core/src/crypto/talerCrypto.ts | |
parent | f332d61fb68fbc394f31337ddeb7d1fc114772d0 (diff) | |
download | wallet-core-c09c5bbe625566fc61c811160d2ccdab263327fa.tar.xz |
derive tipping planchets from seed, implement backup further
Diffstat (limited to 'packages/taler-wallet-core/src/crypto/talerCrypto.ts')
-rw-r--r-- | packages/taler-wallet-core/src/crypto/talerCrypto.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/crypto/talerCrypto.ts b/packages/taler-wallet-core/src/crypto/talerCrypto.ts index 4faa523a0..095957982 100644 --- a/packages/taler-wallet-core/src/crypto/talerCrypto.ts +++ b/packages/taler-wallet-core/src/crypto/talerCrypto.ts @@ -390,6 +390,25 @@ export function setupRefreshPlanchet( }; } +export function setupTipPlanchet( + secretSeed: Uint8Array, + coinNumber: number, +): FreshCoin { + const info = stringToBytes("taler-tip-coin-derivation"); + const saltArrBuf = new ArrayBuffer(4); + const salt = new Uint8Array(saltArrBuf); + const saltDataView = new DataView(saltArrBuf); + saltDataView.setUint32(0, coinNumber); + const out = kdf(64, secretSeed, salt, info); + const coinPriv = out.slice(0, 32); + const bks = out.slice(32, 64); + return { + bks, + coinPriv, + coinPub: eddsaGetPublic(coinPriv), + }; +} + export function setupRefreshTransferPub( secretSeed: Uint8Array, transferPubIndex: number, |