@dfns/sdk 0.8.20 → 0.8.23

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,56 @@ 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
+ group_id: string;
74
+ online_domain: string;
75
+ governance?: {
76
+ [x: string]: unknown;
77
+ } | undefined;
78
+ outputs: {
79
+ [x: string]: {
80
+ success: {
81
+ type: "genesis-registration";
82
+ ceremony_mode?: string | undefined;
83
+ hsm_serial: string;
84
+ hsm_identity_key: string;
85
+ mac_serial: string;
86
+ mac_se_wrap_key_pub_key: string;
87
+ provisioners: {
88
+ [x: string]: string;
89
+ };
90
+ hsm_sealed?: unknown | null;
91
+ key_harvest: {
92
+ "ed25519-start": number;
93
+ ed25519: number;
94
+ error: string | null;
95
+ "secp256k1-start": number;
96
+ secp256k1: number;
97
+ };
98
+ } | {
99
+ type: "clone-registration";
100
+ ceremony_mode?: string | undefined;
101
+ hsm_target_serial: string;
102
+ hsm_identity_key: string;
103
+ mac_target_serial: string;
104
+ mac_se_wrap_key_pub_key: string;
105
+ hsm_sealed?: unknown | null;
106
+ };
120
107
  };
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
- })[];
108
+ };
131
109
  };
132
110
  };
133
111
  export type SubmitCloneOutputBody = Omit<__WireSubmitCloneOutputBody, 'fileChecksum'>;
134
112
  export type SubmitCloneOutputParams = {
135
113
  storeId: string;
136
114
  };
137
- export type SubmitCloneOutputResponse = {};
115
+ export type SubmitCloneOutputResponse = {
116
+ message: string;
117
+ };
138
118
  export type SubmitCloneOutputRequest = SubmitCloneOutputParams & {
139
119
  body: SubmitCloneOutputBody;
140
120
  };
@@ -143,46 +123,170 @@ export type __WireSubmitGenesisOutputBody = {
143
123
  outputJson: {
144
124
  type: "fleet-output";
145
125
  version: 1;
126
+ status: "success";
146
127
  org_id: string;
147
128
  fleet_id: string;
148
129
  fleet_label: string;
149
130
  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;
131
+ group_id: string;
132
+ online_domain: string;
133
+ governance?: {
134
+ [x: string]: unknown;
135
+ } | undefined;
136
+ outputs: {
137
+ [x: string]: {
138
+ success: {
139
+ type: "genesis-registration";
140
+ ceremony_mode?: string | undefined;
141
+ hsm_serial: string;
142
+ hsm_identity_key: string;
143
+ mac_serial: string;
144
+ mac_se_wrap_key_pub_key: string;
145
+ provisioners: {
146
+ [x: string]: string;
147
+ };
148
+ hsm_sealed?: unknown | null;
149
+ key_harvest: {
150
+ "ed25519-start": number;
151
+ ed25519: number;
152
+ error: string | null;
153
+ "secp256k1-start": number;
154
+ secp256k1: number;
155
+ };
156
+ } | {
157
+ type: "clone-registration";
158
+ ceremony_mode?: string | undefined;
159
+ hsm_target_serial: string;
160
+ hsm_identity_key: string;
161
+ mac_target_serial: string;
162
+ mac_se_wrap_key_pub_key: string;
163
+ hsm_sealed?: unknown | null;
164
+ };
168
165
  };
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
- })[];
166
+ };
179
167
  };
180
168
  };
181
169
  export type SubmitGenesisOutputBody = Omit<__WireSubmitGenesisOutputBody, 'fileChecksum'>;
182
170
  export type SubmitGenesisOutputParams = {
183
171
  storeId: string;
184
172
  };
185
- export type SubmitGenesisOutputResponse = {};
173
+ export type SubmitGenesisOutputResponse = {
174
+ message: string;
175
+ };
186
176
  export type SubmitGenesisOutputRequest = SubmitGenesisOutputParams & {
187
177
  body: SubmitGenesisOutputBody;
188
178
  };
179
+ export type __WireSubmitOnchainSignOutputBody = {
180
+ fileChecksum: string;
181
+ outputJson: {
182
+ type: "keystore-output";
183
+ version: 1;
184
+ org_id: string;
185
+ fleet_id: string;
186
+ keystore_id: string;
187
+ group_id: string;
188
+ status: "success" | "partial" | "fail";
189
+ outputs: {
190
+ [x: string]: {
191
+ type: "proof-of-control-v1";
192
+ result: {
193
+ success: {
194
+ signer_public_key: string;
195
+ prefix: string;
196
+ message: string;
197
+ exact_bytes_signed: string;
198
+ signature: string;
199
+ };
200
+ } | {
201
+ fail: {
202
+ message: string;
203
+ code: string;
204
+ };
205
+ };
206
+ } | {
207
+ type: "onchain-sign-v1";
208
+ result: {
209
+ success: {
210
+ [x: string]: {
211
+ signer_public_key: string;
212
+ exact_bytes_signed: string;
213
+ signature: string;
214
+ };
215
+ };
216
+ } | {
217
+ fail: {
218
+ message: string;
219
+ code: string;
220
+ };
221
+ };
222
+ };
223
+ };
224
+ };
225
+ };
226
+ export type SubmitOnchainSignOutputBody = Omit<__WireSubmitOnchainSignOutputBody, 'fileChecksum'>;
227
+ export type SubmitOnchainSignOutputParams = {
228
+ storeId: string;
229
+ };
230
+ export type SubmitOnchainSignOutputResponse = {
231
+ status: "success" | "partial";
232
+ };
233
+ export type SubmitOnchainSignOutputRequest = SubmitOnchainSignOutputParams & {
234
+ body: SubmitOnchainSignOutputBody;
235
+ };
236
+ export type __WireSubmitProofOfControlOutputBody = {
237
+ fileChecksum: string;
238
+ outputJson: {
239
+ type: "keystore-output";
240
+ version: 1;
241
+ org_id: string;
242
+ fleet_id: string;
243
+ keystore_id: string;
244
+ group_id: string;
245
+ status: "success" | "partial" | "fail";
246
+ outputs: {
247
+ [x: string]: {
248
+ type: "proof-of-control-v1";
249
+ result: {
250
+ success: {
251
+ signer_public_key: string;
252
+ prefix: string;
253
+ message: string;
254
+ exact_bytes_signed: string;
255
+ signature: string;
256
+ };
257
+ } | {
258
+ fail: {
259
+ message: string;
260
+ code: string;
261
+ };
262
+ };
263
+ } | {
264
+ type: "onchain-sign-v1";
265
+ result: {
266
+ success: {
267
+ [x: string]: {
268
+ signer_public_key: string;
269
+ exact_bytes_signed: string;
270
+ signature: string;
271
+ };
272
+ };
273
+ } | {
274
+ fail: {
275
+ message: string;
276
+ code: string;
277
+ };
278
+ };
279
+ };
280
+ };
281
+ };
282
+ };
283
+ export type SubmitProofOfControlOutputBody = Omit<__WireSubmitProofOfControlOutputBody, 'fileChecksum'>;
284
+ export type SubmitProofOfControlOutputParams = {
285
+ storeId: string;
286
+ };
287
+ export type SubmitProofOfControlOutputResponse = {
288
+ status: "success" | "partial";
289
+ };
290
+ export type SubmitProofOfControlOutputRequest = SubmitProofOfControlOutputParams & {
291
+ body: SubmitProofOfControlOutputBody;
292
+ };