summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/types/cryptoTypes.ts
blob: 98bdf92ec1deab7cce07d6101b07d497786d396e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 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;
}

export interface DeriveTipRequest {
  secretSeed: string;
  denomPub: string;
  planchetIndex: number;
}

/**
 * Tipping planchet stored in the database.
 */
export interface DerivedTipPlanchet {
  blindingKey: string;
  coinEv: string;
  coinPriv: string;
  coinPub: string;
}