diff options
author | Florian Dold <florian@dold.me> | 2020-12-14 16:44:42 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2020-12-14 16:44:42 +0100 |
commit | 12234083ecfe83de79eb2caf29808a0f17188e84 (patch) | |
tree | 2e369412845b51173ed0329bb08ee4dcaf48a3c6 /packages/taler-wallet-core/src/types | |
parent | 80a0fab1261fc06f79db4c32fd7a1a6d0cb0db0f (diff) | |
download | wallet-core-12234083ecfe83de79eb2caf29808a0f17188e84.tar.xz |
derive refresh info from secret seed
Diffstat (limited to 'packages/taler-wallet-core/src/types')
-rw-r--r-- | packages/taler-wallet-core/src/types/cryptoTypes.ts | 111 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/types/dbTypes.ts | 76 |
2 files changed, 127 insertions, 60 deletions
diff --git a/packages/taler-wallet-core/src/types/cryptoTypes.ts b/packages/taler-wallet-core/src/types/cryptoTypes.ts new file mode 100644 index 000000000..a7f51ab52 --- /dev/null +++ b/packages/taler-wallet-core/src/types/cryptoTypes.ts @@ -0,0 +1,111 @@ +/* + This file is part of GNU Taler + (C) 2020 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +/** + * Types used by the wallet crypto worker. + * + * These types are defined in a separate file make tree shaking easier, since + * some components use these types (via RPC) but do not depend on the wallet + * code directly. + * + * @author Florian Dold <dold@taler.net> + */ + +/** + * Imports. + */ +import { AmountJson } from "../util/amounts"; + +export interface RefreshNewDenomInfo { + count: number; + value: AmountJson; + feeWithdraw: AmountJson; + denomPub: string; +} + +/** + * Request to derive a refresh session from the refresh session + * secret seed. + */ +export interface DeriveRefreshSessionRequest { + sessionSecretSeed: string; + kappa: number; + meltCoinPub: string; + meltCoinPriv: string; + meltCoinDenomPubHash: string; + newCoinDenoms: RefreshNewDenomInfo[]; + feeRefresh: AmountJson; +} + +/** + * + */ +export interface DerivedRefreshSession { + /** + * Public key that's being melted in this session. + */ + meltCoinPub: string; + + /** + * Signature to confirm the melting. + */ + confirmSig: string; + + /** + * Planchets for each cut-and-choose instance. + */ + planchetsForGammas: { + /** + * Public key for the coin. + */ + publicKey: string; + + /** + * Private key for the coin. + */ + privateKey: string; + + /** + * Blinded public key. + */ + coinEv: string; + + /** + * Blinding key used. + */ + blindingKey: string; + }[][]; + + /** + * The transfer keys, kappa of them. + */ + transferPubs: string[]; + + /** + * Private keys for the transfer public keys. + */ + transferPrivs: string[]; + + /** + * Hash of the session. + */ + hash: string; + + /** + * Exact value that is being melted. + */ + meltValueWithFee: AmountJson; +} diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts b/packages/taler-wallet-core/src/types/dbTypes.ts index a4f14ff0c..18a1102b4 100644 --- a/packages/taler-wallet-core/src/types/dbTypes.ts +++ b/packages/taler-wallet-core/src/types/dbTypes.ts @@ -557,7 +557,7 @@ export interface ExchangeRecord { /** * Terms of service text or undefined if not downloaded yet. - * + * * This is just used as a cache of the last downloaded ToS. */ termsOfServiceText: string | undefined; @@ -664,14 +664,17 @@ export interface RefreshPlanchet { * Public key for the coin. */ publicKey: string; + /** * Private key for the coin. */ privateKey: string; + /** * Blinded public key. */ coinEv: string; + /** * Blinding key used. */ @@ -991,18 +994,14 @@ export interface RefreshGroupRecord { * Ongoing refresh */ export interface RefreshSessionRecord { - lastError: TalerErrorDetails | undefined; - /** - * Public key that's being melted in this session. - */ - meltCoinPub: string; - - /** - * How much of the coin's value is melted away - * with this refresh session? + * 512-bit secret that can be used to derive + * the other cryptographic material for the refresh session. + * + * FIXME: We currently store the derived material, but + * should always derive it. */ - amountRefreshInput: AmountJson; + sessionSecretSeed: string; /** * Sum of the value of denominations we want @@ -1011,59 +1010,17 @@ export interface RefreshSessionRecord { amountRefreshOutput: AmountJson; /** - * Signature to confirm the melting. + * Hashed denominations of the newly requested coins. */ - confirmSig: string; - - /** - * Hased denominations of the newly requested coins. - */ - newDenomHashes: string[]; - - /** - * Denominations of the newly requested coins. - */ - newDenoms: string[]; - - /** - * Planchets for each cut-and-choose instance. - */ - planchetsForGammas: RefreshPlanchet[][]; - - /** - * The transfer keys, kappa of them. - */ - transferPubs: string[]; - - /** - * Private keys for the transfer public keys. - */ - transferPrivs: string[]; + newDenoms: { + denomPubHash: string; + count: number; + }[]; /** * The no-reveal-index after we've done the melting. */ norevealIndex?: number; - - /** - * Hash of the session. - */ - hash: string; - - /** - * Timestamp when the refresh session finished. - */ - finishedTimestamp: Timestamp | undefined; - - /** - * When has this refresh session been created? - */ - timestampCreated: Timestamp; - - /** - * Base URL for the exchange we're doing the refresh with. - */ - exchangeBaseUrl: string; } /** @@ -1602,7 +1559,7 @@ class PurchasesStore extends Store<"purchases", PurchaseRecord> { string, PurchaseRecord >(this, "fulfillmentUrlIndex", "contractData.fulfillmentUrl"); - + orderIdIndex = new Index<"purchases", "orderIdIndex", string, PurchaseRecord>( this, "orderIdIndex", @@ -1712,7 +1669,6 @@ class BankWithdrawUrisStore extends Store< } } - /** */ class BackupProvidersStore extends Store< |