@dfns/sdk 0.8.20 → 0.8.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,8 @@ export declare class SignersClient {
5
5
  constructor(apiOptions: DfnsApiClientOptions);
6
6
  createCloneInput(request: T.CreateCloneInputRequest): Promise<T.CreateCloneInputResponse>;
7
7
  createGenesisInput(request: T.CreateGenesisInputRequest): Promise<T.CreateGenesisInputResponse>;
8
+ createOnchainSignInput(request: T.CreateOnchainSignInputRequest): Promise<T.CreateOnchainSignInputResponse>;
9
+ createProofOfControlInput(request: T.CreateProofOfControlInputRequest): Promise<T.CreateProofOfControlInputResponse>;
8
10
  listKeyStores(): Promise<T.ListKeyStoresResponse>;
9
11
  listSigners(): Promise<T.ListSignersResponse>;
10
12
  submitCloneOutput(request: T.SubmitCloneOutputRequest, file: {
@@ -15,4 +17,12 @@ export declare class SignersClient {
15
17
  bytes: Uint8Array;
16
18
  name?: string;
17
19
  }): Promise<T.SubmitGenesisOutputResponse>;
20
+ submitOnchainSignOutput(request: T.SubmitOnchainSignOutputRequest, file: {
21
+ bytes: Uint8Array;
22
+ name?: string;
23
+ }): Promise<T.SubmitOnchainSignOutputResponse>;
24
+ submitProofOfControlOutput(request: T.SubmitProofOfControlOutputRequest, file: {
25
+ bytes: Uint8Array;
26
+ name?: string;
27
+ }): Promise<T.SubmitProofOfControlOutputResponse>;
18
28
  }
@@ -33,6 +33,30 @@ class SignersClient {
33
33
  });
34
34
  return response.json();
35
35
  }
36
+ async createOnchainSignInput(request) {
37
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/onchain-sign/input', {
38
+ path: request ?? {},
39
+ query: {},
40
+ });
41
+ const response = await (0, userActionFetch_1.userActionFetch)(path, {
42
+ method: 'POST',
43
+ body: request.body,
44
+ apiOptions: this.apiOptions,
45
+ });
46
+ return response.json();
47
+ }
48
+ async createProofOfControlInput(request) {
49
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/proof-of-control/input', {
50
+ path: request ?? {},
51
+ query: {},
52
+ });
53
+ const response = await (0, userActionFetch_1.userActionFetch)(path, {
54
+ method: 'POST',
55
+ body: request.body,
56
+ apiOptions: this.apiOptions,
57
+ });
58
+ return response.json();
59
+ }
36
60
  async listKeyStores() {
37
61
  const path = (0, url_1.buildPathAndQuery)('/key-stores', {
38
62
  path: {},
@@ -81,5 +105,31 @@ class SignersClient {
81
105
  });
82
106
  return response.json();
83
107
  }
108
+ async submitOnchainSignOutput(request, file) {
109
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/onchain-sign/output', {
110
+ path: request ?? {},
111
+ query: {},
112
+ });
113
+ const response = await (0, userActionFetch_1.userActionFetch)(path, {
114
+ method: 'POST',
115
+ body: request.body,
116
+ file,
117
+ apiOptions: this.apiOptions,
118
+ });
119
+ return response.json();
120
+ }
121
+ async submitProofOfControlOutput(request, file) {
122
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/proof-of-control/output', {
123
+ path: request ?? {},
124
+ query: {},
125
+ });
126
+ const response = await (0, userActionFetch_1.userActionFetch)(path, {
127
+ method: 'POST',
128
+ body: request.body,
129
+ file,
130
+ apiOptions: this.apiOptions,
131
+ });
132
+ return response.json();
133
+ }
84
134
  }
85
135
  exports.SignersClient = SignersClient;
@@ -8,6 +8,10 @@ export declare class DelegatedSignersClient {
8
8
  createCloneInputComplete(request: T.CreateCloneInputRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreateCloneInputResponse>;
9
9
  createGenesisInputInit(request: T.CreateGenesisInputRequest): Promise<UserActionChallengeResponse>;
10
10
  createGenesisInputComplete(request: T.CreateGenesisInputRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreateGenesisInputResponse>;
11
+ createOnchainSignInputInit(request: T.CreateOnchainSignInputRequest): Promise<UserActionChallengeResponse>;
12
+ createOnchainSignInputComplete(request: T.CreateOnchainSignInputRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreateOnchainSignInputResponse>;
13
+ createProofOfControlInputInit(request: T.CreateProofOfControlInputRequest): Promise<UserActionChallengeResponse>;
14
+ createProofOfControlInputComplete(request: T.CreateProofOfControlInputRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreateProofOfControlInputResponse>;
11
15
  listKeyStores(): Promise<T.ListKeyStoresResponse>;
12
16
  listSigners(): Promise<T.ListSignersResponse>;
13
17
  }
@@ -62,6 +62,60 @@ class DelegatedSignersClient {
62
62
  });
63
63
  return response.json();
64
64
  }
65
+ async createOnchainSignInputInit(request) {
66
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/onchain-sign/input', {
67
+ path: request ?? {},
68
+ query: {},
69
+ });
70
+ const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
71
+ userActionHttpMethod: 'POST',
72
+ userActionHttpPath: path,
73
+ userActionPayload: JSON.stringify(request.body),
74
+ userActionServerKind: 'Api',
75
+ }, this.apiOptions);
76
+ return challenge;
77
+ }
78
+ async createOnchainSignInputComplete(request, signedChallenge) {
79
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/onchain-sign/input', {
80
+ path: request ?? {},
81
+ query: {},
82
+ });
83
+ const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
84
+ const response = await (0, fetch_1.simpleFetch)(path, {
85
+ method: 'POST',
86
+ body: request.body,
87
+ headers: { 'x-dfns-useraction': userAction },
88
+ apiOptions: this.apiOptions,
89
+ });
90
+ return response.json();
91
+ }
92
+ async createProofOfControlInputInit(request) {
93
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/proof-of-control/input', {
94
+ path: request ?? {},
95
+ query: {},
96
+ });
97
+ const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
98
+ userActionHttpMethod: 'POST',
99
+ userActionHttpPath: path,
100
+ userActionPayload: JSON.stringify(request.body),
101
+ userActionServerKind: 'Api',
102
+ }, this.apiOptions);
103
+ return challenge;
104
+ }
105
+ async createProofOfControlInputComplete(request, signedChallenge) {
106
+ const path = (0, url_1.buildPathAndQuery)('/key-stores/:storeId/proof-of-control/input', {
107
+ path: request ?? {},
108
+ query: {},
109
+ });
110
+ const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
111
+ const response = await (0, fetch_1.simpleFetch)(path, {
112
+ method: 'POST',
113
+ body: request.body,
114
+ headers: { 'x-dfns-useraction': userAction },
115
+ apiOptions: this.apiOptions,
116
+ });
117
+ return response.json();
118
+ }
65
119
  async listKeyStores() {
66
120
  const path = (0, url_1.buildPathAndQuery)('/key-stores', {
67
121
  path: {},
@@ -6,77 +6,47 @@ export type CreateCloneInputBody = {
6
6
  export type CreateCloneInputParams = {
7
7
  storeId: string;
8
8
  };
9
- export type CreateCloneInputResponse = {
10
- inputJson: {
11
- version: 1;
12
- type: "fleet-input";
13
- org_id: string;
14
- fleet_id: string;
15
- keystore_id: string;
16
- operations: {
17
- id: string;
18
- type: "clone-registration";
19
- ceremony_challenge: string;
20
- hsm_source_serial: string;
21
- hsm_target_serial: string;
22
- }[];
23
- };
24
- };
9
+ export type CreateCloneInputResponse = string;
25
10
  export type CreateCloneInputRequest = CreateCloneInputParams & {
26
11
  body: CreateCloneInputBody;
27
12
  };
28
13
  export type CreateGenesisInputBody = {
29
14
  kind: "Genesis";
30
15
  numProvisioners: number;
31
- numSecp256k1?: number;
32
- numEd25519?: number;
16
+ numSecp256k1: number;
17
+ numEd25519: number;
33
18
  hsmGenesisSerial: string;
19
+ hsmGenesisFirmwareVersion?: ("2.2" | "2.4") | undefined;
34
20
  };
35
21
  export type CreateGenesisInputParams = {
36
22
  storeId: string;
37
23
  };
38
- export type CreateGenesisInputResponse = {
39
- inputJson: {
40
- version: 1;
41
- type: "fleet-input";
42
- org_id: string;
43
- fleet_id: string;
44
- keystore_id: string;
45
- operations: {
46
- id: string;
47
- type: "genesis-registration";
48
- options: {
49
- create_test_keys: boolean;
50
- seal_factory_key: boolean;
51
- key_harvest: {
52
- "ed25519-start": number;
53
- ed25519: number;
54
- "secp256k1-start": number;
55
- secp256k1: number;
56
- };
57
- };
58
- hsm_genesis_serial: string;
59
- num_provisioners: number;
60
- ceremony_challenge: string;
61
- provisioner_labels: string[];
62
- transport_key: {
63
- crypto_system: string;
64
- public_key_hex: string;
65
- };
66
- policy_key: {
67
- crypto_system: string;
68
- public_key_hex: string;
69
- };
70
- }[];
71
- };
72
- };
24
+ export type CreateGenesisInputResponse = string;
73
25
  export type CreateGenesisInputRequest = CreateGenesisInputParams & {
74
26
  body: CreateGenesisInputBody;
75
27
  };
28
+ export type CreateOnchainSignInputBody = {};
29
+ export type CreateOnchainSignInputParams = {
30
+ storeId: string;
31
+ };
32
+ export type CreateOnchainSignInputResponse = string;
33
+ export type CreateOnchainSignInputRequest = CreateOnchainSignInputParams & {
34
+ body: CreateOnchainSignInputBody;
35
+ };
36
+ export type CreateProofOfControlInputBody = {
37
+ walletIds: string[];
38
+ };
39
+ export type CreateProofOfControlInputParams = {
40
+ storeId: string;
41
+ };
42
+ export type CreateProofOfControlInputResponse = string;
43
+ export type CreateProofOfControlInputRequest = CreateProofOfControlInputParams & {
44
+ body: CreateProofOfControlInputBody;
45
+ };
76
46
  export type ListKeyStoresResponse = {
77
47
  items: {
78
48
  id: string;
79
- kind: "Hsm" | "Mpc" | "Nemo";
49
+ kind: "Hsm" | "Mpc" | "OfflineSigner";
80
50
  name?: string | undefined;
81
51
  primary: boolean;
82
52
  }[];
@@ -95,46 +65,51 @@ export type __WireSubmitCloneOutputBody = {
95
65
  outputJson: {
96
66
  type: "fleet-output";
97
67
  version: 1;
68
+ status: "success";
98
69
  org_id: string;
99
70
  fleet_id: string;
100
71
  fleet_label: string;
101
72
  keystore_id: string;
102
- outputs: ({
103
- id: string;
104
- type: "genesis-registration";
105
- ceremony_mode: string;
106
- hsm_serial: string;
107
- hsm_identity_key: string;
108
- mac_serial: string;
109
- mac_se_wrap_key_pub_key: string;
110
- provisioners: {
111
- [x: string]: string;
112
- };
113
- hsm_sealed?: unknown | null;
114
- key_harvest: {
115
- "ed25519-start": number;
116
- ed25519: number;
117
- error: string | null;
118
- "secp256k1-start": number;
119
- secp256k1: number;
73
+ outputs: {
74
+ [x: string]: {
75
+ success: {
76
+ type: "genesis-registration";
77
+ ceremony_mode: string;
78
+ hsm_serial: string;
79
+ hsm_identity_key: string;
80
+ mac_serial: string;
81
+ mac_se_wrap_key_pub_key: string;
82
+ provisioners: {
83
+ [x: string]: string;
84
+ };
85
+ hsm_sealed?: unknown | null;
86
+ key_harvest: {
87
+ "ed25519-start": number;
88
+ ed25519: number;
89
+ error: string | null;
90
+ "secp256k1-start": number;
91
+ secp256k1: number;
92
+ };
93
+ } | {
94
+ type: "clone-registration";
95
+ ceremony_mode: string;
96
+ hsm_target_serial: string;
97
+ hsm_identity_key: string;
98
+ mac_target_serial: string;
99
+ mac_se_wrap_key_pub_key: string;
100
+ hsm_sealed?: unknown | null;
101
+ };
120
102
  };
121
- } | {
122
- id: string;
123
- type: "clone-registration";
124
- ceremony_mode: string;
125
- hsm_target_serial: string;
126
- hsm_identity_key: string;
127
- mac_target_serial: string;
128
- mac_se_wrap_key_pub_key: string;
129
- hsm_sealed?: unknown | null;
130
- })[];
103
+ };
131
104
  };
132
105
  };
133
106
  export type SubmitCloneOutputBody = Omit<__WireSubmitCloneOutputBody, 'fileChecksum'>;
134
107
  export type SubmitCloneOutputParams = {
135
108
  storeId: string;
136
109
  };
137
- export type SubmitCloneOutputResponse = {};
110
+ export type SubmitCloneOutputResponse = {
111
+ message: string;
112
+ };
138
113
  export type SubmitCloneOutputRequest = SubmitCloneOutputParams & {
139
114
  body: SubmitCloneOutputBody;
140
115
  };
@@ -143,46 +118,165 @@ export type __WireSubmitGenesisOutputBody = {
143
118
  outputJson: {
144
119
  type: "fleet-output";
145
120
  version: 1;
121
+ status: "success";
146
122
  org_id: string;
147
123
  fleet_id: string;
148
124
  fleet_label: string;
149
125
  keystore_id: string;
150
- outputs: ({
151
- id: string;
152
- type: "genesis-registration";
153
- ceremony_mode: string;
154
- hsm_serial: string;
155
- hsm_identity_key: string;
156
- mac_serial: string;
157
- mac_se_wrap_key_pub_key: string;
158
- provisioners: {
159
- [x: string]: string;
160
- };
161
- hsm_sealed?: unknown | null;
162
- key_harvest: {
163
- "ed25519-start": number;
164
- ed25519: number;
165
- error: string | null;
166
- "secp256k1-start": number;
167
- secp256k1: number;
126
+ outputs: {
127
+ [x: string]: {
128
+ success: {
129
+ type: "genesis-registration";
130
+ ceremony_mode: string;
131
+ hsm_serial: string;
132
+ hsm_identity_key: string;
133
+ mac_serial: string;
134
+ mac_se_wrap_key_pub_key: string;
135
+ provisioners: {
136
+ [x: string]: string;
137
+ };
138
+ hsm_sealed?: unknown | null;
139
+ key_harvest: {
140
+ "ed25519-start": number;
141
+ ed25519: number;
142
+ error: string | null;
143
+ "secp256k1-start": number;
144
+ secp256k1: number;
145
+ };
146
+ } | {
147
+ type: "clone-registration";
148
+ ceremony_mode: string;
149
+ hsm_target_serial: string;
150
+ hsm_identity_key: string;
151
+ mac_target_serial: string;
152
+ mac_se_wrap_key_pub_key: string;
153
+ hsm_sealed?: unknown | null;
154
+ };
168
155
  };
169
- } | {
170
- id: string;
171
- type: "clone-registration";
172
- ceremony_mode: string;
173
- hsm_target_serial: string;
174
- hsm_identity_key: string;
175
- mac_target_serial: string;
176
- mac_se_wrap_key_pub_key: string;
177
- hsm_sealed?: unknown | null;
178
- })[];
156
+ };
179
157
  };
180
158
  };
181
159
  export type SubmitGenesisOutputBody = Omit<__WireSubmitGenesisOutputBody, 'fileChecksum'>;
182
160
  export type SubmitGenesisOutputParams = {
183
161
  storeId: string;
184
162
  };
185
- export type SubmitGenesisOutputResponse = {};
163
+ export type SubmitGenesisOutputResponse = {
164
+ message: string;
165
+ };
186
166
  export type SubmitGenesisOutputRequest = SubmitGenesisOutputParams & {
187
167
  body: SubmitGenesisOutputBody;
188
168
  };
169
+ export type __WireSubmitOnchainSignOutputBody = {
170
+ fileChecksum: string;
171
+ outputJson: {
172
+ type: "keystore-output";
173
+ version: 1;
174
+ org_id: string;
175
+ fleet_id: string;
176
+ keystore_id: string;
177
+ group_id: string;
178
+ status: "success" | "partial" | "fail";
179
+ outputs: {
180
+ [x: string]: {
181
+ type: "proof-of-control-v1";
182
+ result: {
183
+ success: {
184
+ signer_public_key: string;
185
+ prefix: string;
186
+ message: string;
187
+ exact_bytes_signed: string;
188
+ signature: string;
189
+ };
190
+ } | {
191
+ fail: {
192
+ message: string;
193
+ code: string;
194
+ };
195
+ };
196
+ } | {
197
+ type: "onchain-sign-v1";
198
+ result: {
199
+ success: {
200
+ [x: string]: {
201
+ signer_public_key: string;
202
+ exact_bytes_signed: string;
203
+ signature: string;
204
+ };
205
+ };
206
+ } | {
207
+ fail: {
208
+ message: string;
209
+ code: string;
210
+ };
211
+ };
212
+ };
213
+ };
214
+ };
215
+ };
216
+ export type SubmitOnchainSignOutputBody = Omit<__WireSubmitOnchainSignOutputBody, 'fileChecksum'>;
217
+ export type SubmitOnchainSignOutputParams = {
218
+ storeId: string;
219
+ };
220
+ export type SubmitOnchainSignOutputResponse = {
221
+ status: "success" | "partial";
222
+ };
223
+ export type SubmitOnchainSignOutputRequest = SubmitOnchainSignOutputParams & {
224
+ body: SubmitOnchainSignOutputBody;
225
+ };
226
+ export type __WireSubmitProofOfControlOutputBody = {
227
+ fileChecksum: string;
228
+ outputJson: {
229
+ type: "keystore-output";
230
+ version: 1;
231
+ org_id: string;
232
+ fleet_id: string;
233
+ keystore_id: string;
234
+ group_id: string;
235
+ status: "success" | "partial" | "fail";
236
+ outputs: {
237
+ [x: string]: {
238
+ type: "proof-of-control-v1";
239
+ result: {
240
+ success: {
241
+ signer_public_key: string;
242
+ prefix: string;
243
+ message: string;
244
+ exact_bytes_signed: string;
245
+ signature: string;
246
+ };
247
+ } | {
248
+ fail: {
249
+ message: string;
250
+ code: string;
251
+ };
252
+ };
253
+ } | {
254
+ type: "onchain-sign-v1";
255
+ result: {
256
+ success: {
257
+ [x: string]: {
258
+ signer_public_key: string;
259
+ exact_bytes_signed: string;
260
+ signature: string;
261
+ };
262
+ };
263
+ } | {
264
+ fail: {
265
+ message: string;
266
+ code: string;
267
+ };
268
+ };
269
+ };
270
+ };
271
+ };
272
+ };
273
+ export type SubmitProofOfControlOutputBody = Omit<__WireSubmitProofOfControlOutputBody, 'fileChecksum'>;
274
+ export type SubmitProofOfControlOutputParams = {
275
+ storeId: string;
276
+ };
277
+ export type SubmitProofOfControlOutputResponse = {
278
+ status: "success" | "partial";
279
+ };
280
+ export type SubmitProofOfControlOutputRequest = SubmitProofOfControlOutputParams & {
281
+ body: SubmitProofOfControlOutputBody;
282
+ };