diff options
author | Florian Dold <florian@dold.me> | 2022-03-24 01:10:34 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-03-24 01:10:41 +0100 |
commit | 9d38cb56a6fa4c9a975df339cb0aa08f040368c1 (patch) | |
tree | cc2fac95abe164b9da325de34a256f14ece9d9c9 /packages/taler-util | |
parent | cc18751e72435544297de4f5b5a6b318fbba9cd1 (diff) | |
download | wallet-core-9d38cb56a6fa4c9a975df339cb0aa08f040368c1.tar.xz |
wallet: crypto worker fixes, better taler-crypto-worker integration
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/talerCrypto.ts | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/packages/taler-util/src/talerCrypto.ts b/packages/taler-util/src/talerCrypto.ts index 4d6e73671..0385658ca 100644 --- a/packages/taler-util/src/talerCrypto.ts +++ b/packages/taler-util/src/talerCrypto.ts @@ -692,7 +692,7 @@ export interface FreshCoin { bks: Uint8Array; } -function bufferForUint32(n: number): Uint8Array { +export function bufferForUint32(n: number): Uint8Array { const arrBuf = new ArrayBuffer(4); const buf = new Uint8Array(arrBuf); const dv = new DataView(arrBuf); @@ -700,37 +700,6 @@ function bufferForUint32(n: number): Uint8Array { return buf; } -export function setupRefreshPlanchet( - transferSecret: Uint8Array, - coinNumber: number, -): FreshCoin { - // See TALER_transfer_secret_to_planchet_secret in C impl - const planchetMasterSecret = kdfKw({ - ikm: transferSecret, - outputLength: 32, - salt: bufferForUint32(coinNumber), - info: stringToBytes("taler-coin-derivation"), - }); - - const coinPriv = kdfKw({ - ikm: planchetMasterSecret, - outputLength: 32, - salt: stringToBytes("coin"), - }); - - const bks = kdfKw({ - ikm: planchetMasterSecret, - outputLength: 32, - salt: stringToBytes("bks"), - }); - - return { - bks, - coinPriv, - coinPub: eddsaGetPublic(coinPriv), - }; -} - export function setupWithdrawPlanchet( secretSeed: Uint8Array, coinNumber: number, @@ -786,10 +755,10 @@ export function setupRefreshTransferPub( } /** - * + * * @param paytoUri - * @param salt 16-byte salt - * @returns + * @param salt 16-byte salt + * @returns */ export function hashWire(paytoUri: string, salt: string): string { const r = kdf( |