summaryrefslogtreecommitdiff
path: root/daemon/kmd/lib/kmdapi/requests.go
blob: 445e88df18f96b83cc9f1ce03c53de7c952a1d60 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
// Copyright (C) 2019-2024 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// go-algorand 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand.  If not, see <https://www.gnu.org/licenses/>.

package kmdapi

import (
	"github.com/algorand/go-algorand/crypto"
)

// APIV1Request is the interface that all API V1 requests must satisfy
//
// swagger:ignore
type APIV1Request interface{} // we need to tell swagger to ignore due to bug (go-swagger/issues/1436)

// VersionsRequest is the request for `GET /versions`
//
// swagger:model VersionsRequest
type VersionsRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`
}

// APIV1GETWalletsRequest is the request for `GET /v1/wallets`
//
// swagger:model ListWalletsRequest
type APIV1GETWalletsRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`
}

// APIV1POSTWalletRequest is the request for `POST /v1/wallet`
//
// swagger:model CreateWalletRequest
type APIV1POSTWalletRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletName          string                   `json:"wallet_name"`
	WalletDriverName    string                   `json:"wallet_driver_name"`
	WalletPassword      string                   `json:"wallet_password"`
	MasterDerivationKey APIV1MasterDerivationKey `json:"master_derivation_key"`
}

// APIV1POSTWalletInitRequest is the request for `POST /v1/wallet/init`
//
// swagger:model InitWalletHandleTokenRequest
type APIV1POSTWalletInitRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletID       string `json:"wallet_id"`
	WalletPassword string `json:"wallet_password"`
}

// APIV1POSTWalletReleaseRequest is the request for `POST /v1/wallet/release`
//
// swagger:model ReleaseWalletHandleTokenRequest
type APIV1POSTWalletReleaseRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
}

// APIV1POSTWalletRenewRequest is the request for `POST /v1/wallet/renew`
//
// swagger:model RenewWalletHandleTokenRequest
type APIV1POSTWalletRenewRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
}

// APIV1POSTWalletRenameRequest is the request for `POST /v1/wallet/rename`
//
// swagger:model RenameWalletRequest
type APIV1POSTWalletRenameRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletID       string `json:"wallet_id"`
	WalletPassword string `json:"wallet_password"`
	NewWalletName  string `json:"wallet_name"`
}

// APIV1POSTWalletInfoRequest is the request for `POST /v1/wallet/info`
//
// swagger:model WalletInfoRequest
type APIV1POSTWalletInfoRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
}

// APIV1POSTMasterKeyExportRequest is the request for `POST /v1/master-key/export`
//
// swagger:model ExportMasterKeyRequest
type APIV1POSTMasterKeyExportRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	WalletPassword    string `json:"wallet_password"`
}

// APIV1POSTKeyImportRequest is the request for `POST /v1/key/import`
//
// swagger:model ImportKeyRequest
type APIV1POSTKeyImportRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string            `json:"wallet_handle_token"`
	PrivateKey        crypto.PrivateKey `json:"private_key"`
}

// APIV1POSTKeyExportRequest is the request for `POST /v1/key/export`
//
// swagger:model ExportKeyRequest
type APIV1POSTKeyExportRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	Address           string `json:"address"`
	WalletPassword    string `json:"wallet_password"`
}

// APIV1POSTKeyRequest is the request for `POST /v1/key`
//
// swagger:model GenerateKeyRequest
type APIV1POSTKeyRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	DisplayMnemonic   bool   `json:"display_mnemonic"`
}

// APIV1DELETEKeyRequest is the request for `DELETE /v1/key`
//
// swagger:model DeleteKeyRequest
type APIV1DELETEKeyRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	Address           string `json:"address"`
	WalletPassword    string `json:"wallet_password"`
}

// APIV1POSTKeyListRequest is the request for `POST /v1/key/list`
//
// swagger:model ListKeysRequest
type APIV1POSTKeyListRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
}

// APIV1POSTTransactionSignRequest is the request for `POST /v1/transaction/sign`
//
// swagger:model SignTransactionRequest
type APIV1POSTTransactionSignRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	// Base64 encoding of msgpack encoding of a `Transaction` object
	// Note: SDK and goal usually generate `SignedTxn` objects
	//   in that case, the field `txn` / `Transaction` of the
	//   generated `SignedTxn` object needs to be used
	//
	// swagger:strfmt byte
	Transaction    []byte           `json:"transaction"`
	PublicKey      crypto.PublicKey `json:"public_key"`
	WalletPassword string           `json:"wallet_password"`
}

// APIV1POSTProgramSignRequest is the request for `POST /v1/program/sign`
//
// swagger:model SignProgramRequest
type APIV1POSTProgramSignRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	Address           string `json:"address"`
	// swagger:strfmt byte
	Program        []byte `json:"data"`
	WalletPassword string `json:"wallet_password"`
}

// APIV1POSTMultisigListRequest is the request for `POST /v1/multisig/list`
//
// swagger:model ListMultisigRequest
type APIV1POSTMultisigListRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
}

// APIV1POSTMultisigImportRequest is the request for `POST /v1/multisig/import`
//
// swagger:model ImportMultisigRequest
type APIV1POSTMultisigImportRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string             `json:"wallet_handle_token"`
	Version           uint8              `json:"multisig_version"`
	Threshold         uint8              `json:"threshold"`
	PKs               []crypto.PublicKey `json:"pks"`
}

// APIV1POSTMultisigExportRequest is the request for `POST /v1/multisig/export`
//
// swagger:model ExportMultisigRequest
type APIV1POSTMultisigExportRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	Address           string `json:"address"`
}

// APIV1DELETEMultisigRequest is the request for `DELETE /v1/multisig`
//
// swagger:model DeleteMultisigRequest
type APIV1DELETEMultisigRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	Address           string `json:"address"`
	WalletPassword    string `json:"wallet_password"`
}

// APIV1POSTMultisigTransactionSignRequest is the request for `POST /v1/multisig/sign`
//
// swagger:model SignMultisigRequest
type APIV1POSTMultisigTransactionSignRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	// swagger:strfmt byte
	Transaction    []byte             `json:"transaction"`
	PublicKey      crypto.PublicKey   `json:"public_key"`
	PartialMsig    crypto.MultisigSig `json:"partial_multisig"`
	WalletPassword string             `json:"wallet_password"`
	AuthAddr       crypto.Digest      `json:"signer"`
}

// APIV1POSTMultisigProgramSignRequest is the request for `POST /v1/multisig/signprogram`
//
// swagger:model SignProgramMultisigRequest
type APIV1POSTMultisigProgramSignRequest struct {
	_struct struct{} `codec:",omitempty,omitemptyarray"`

	WalletHandleToken string `json:"wallet_handle_token"`
	Address           string `json:"address"`
	// swagger:strfmt byte
	Program        []byte             `json:"data"`
	PublicKey      crypto.PublicKey   `json:"public_key"`
	PartialMsig    crypto.MultisigSig `json:"partial_multisig"`
	WalletPassword string             `json:"wallet_password"`
}