@cubist-labs/cubesigner-sdk 0.4.279 → 0.4.280
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.
- package/dist/package.json +1 -1
- package/dist/src/client/api_client.d.ts +12 -11
- package/dist/src/client/api_client.d.ts.map +1 -1
- package/dist/src/client/api_client.js +7 -10
- package/dist/src/client.d.ts +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/mfa.d.ts +16 -3
- package/dist/src/mfa.d.ts.map +1 -1
- package/dist/src/mfa.js +8 -4
- package/dist/src/org.d.ts.map +1 -1
- package/dist/src/role.d.ts +2 -2
- package/dist/src/role.d.ts.map +1 -1
- package/dist/src/schema.d.ts +67 -4
- package/dist/src/schema.d.ts.map +1 -1
- package/dist/src/schema.js +1 -1
- package/package.json +1 -1
- package/src/client/api_client.ts +11 -11
- package/src/mfa.ts +7 -3
- package/src/schema.ts +67 -4
package/package.json
CHANGED
package/src/client/api_client.ts
CHANGED
|
@@ -440,23 +440,19 @@ export class ApiClient extends BaseClient {
|
|
|
440
440
|
* that must be answered either by calling {@link TotpChallenge.answer} (or
|
|
441
441
|
* {@link ApiClient.userTotpResetComplete}).
|
|
442
442
|
*
|
|
443
|
-
* @param
|
|
443
|
+
* @param request Optional request parameters (or just an issuer string); defaults to using "Cubist" as the issuer.
|
|
444
444
|
* @param mfaReceipt MFA receipt(s) to include in HTTP headers
|
|
445
445
|
* @returns A TOTP challenge that must be answered
|
|
446
446
|
*/
|
|
447
447
|
async userTotpResetInit(
|
|
448
|
-
|
|
448
|
+
request?: string | schemas["TotpResetRequest"],
|
|
449
449
|
mfaReceipt?: MfaReceipts,
|
|
450
450
|
): Promise<CubeSignerResponse<TotpChallenge>> {
|
|
451
451
|
const o = op("/v0/org/{org_id}/user/me/totp", "post");
|
|
452
452
|
const resetTotpFn = async (headers?: HeadersInit) => {
|
|
453
453
|
const data = await this.exec(o, {
|
|
454
454
|
headers,
|
|
455
|
-
body: issuer
|
|
456
|
-
? {
|
|
457
|
-
issuer,
|
|
458
|
-
}
|
|
459
|
-
: null,
|
|
455
|
+
body: typeof request === "string" ? { issuer: request } : request,
|
|
460
456
|
});
|
|
461
457
|
return mapResponse(data, (totpInfo) => new TotpChallenge(this, totpInfo));
|
|
462
458
|
};
|
|
@@ -471,10 +467,14 @@ export class ApiClient extends BaseClient {
|
|
|
471
467
|
*
|
|
472
468
|
* @param totpId The ID of the TOTP challenge
|
|
473
469
|
* @param code The TOTP code that should verify against the TOTP configuration from the challenge.
|
|
470
|
+
* @returns TOTP registration response
|
|
474
471
|
*/
|
|
475
|
-
async userTotpResetComplete(
|
|
472
|
+
async userTotpResetComplete(
|
|
473
|
+
totpId: string,
|
|
474
|
+
code: string,
|
|
475
|
+
): Promise<schemas["TotpRegisterResponse"]> {
|
|
476
476
|
const o = op("/v0/org/{org_id}/user/me/totp", "patch");
|
|
477
|
-
await this.exec(o, {
|
|
477
|
+
return await this.exec(o, {
|
|
478
478
|
body: { totp_id: totpId, code },
|
|
479
479
|
});
|
|
480
480
|
}
|
|
@@ -543,12 +543,12 @@ export class ApiClient extends BaseClient {
|
|
|
543
543
|
*
|
|
544
544
|
* @param challengeId The ID of the challenge returned by the remote end.
|
|
545
545
|
* @param credential The answer to the challenge.
|
|
546
|
-
* @returns
|
|
546
|
+
* @returns A FIDO registration response
|
|
547
547
|
*/
|
|
548
548
|
async userFidoRegisterComplete(
|
|
549
549
|
challengeId: string,
|
|
550
550
|
credential: PublicKeyCredential,
|
|
551
|
-
): Promise<
|
|
551
|
+
): Promise<schemas["FidoRegisterResponse"]> {
|
|
552
552
|
const o = op("/v0/org/{org_id}/user/me/fido", "patch");
|
|
553
553
|
|
|
554
554
|
return this.exec(o, {
|
package/src/mfa.ts
CHANGED
|
@@ -260,13 +260,14 @@ export class TotpChallenge {
|
|
|
260
260
|
* Answer the challenge with the code that corresponds to `this.totpUrl`.
|
|
261
261
|
*
|
|
262
262
|
* @param code 6-digit code that corresponds to `this.totpUrl`.
|
|
263
|
+
* @returns TOTP registration response
|
|
263
264
|
*/
|
|
264
265
|
async answer(code: string) {
|
|
265
266
|
if (!/^\d{1,6}$/.test(code)) {
|
|
266
267
|
throw new Error(`Invalid TOTP code: ${code}; it must be a 6-digit string`);
|
|
267
268
|
}
|
|
268
269
|
|
|
269
|
-
await this.#api.userTotpResetComplete(this.id, code);
|
|
270
|
+
return await this.#api.userTotpResetComplete(this.id, code);
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
|
|
@@ -294,10 +295,12 @@ export class AddFidoChallenge {
|
|
|
294
295
|
/**
|
|
295
296
|
* Answers this challenge by using the `CredentialsContainer` API to create a credential
|
|
296
297
|
* based on the the public key credential creation options from this challenge.
|
|
298
|
+
*
|
|
299
|
+
* @returns FIDO registration response
|
|
297
300
|
*/
|
|
298
301
|
async createCredentialAndAnswer() {
|
|
299
302
|
const cred = await navigator.credentials.create({ publicKey: this.options });
|
|
300
|
-
await this.answer(cred);
|
|
303
|
+
return await this.answer(cred);
|
|
301
304
|
}
|
|
302
305
|
|
|
303
306
|
/**
|
|
@@ -310,10 +313,11 @@ export class AddFidoChallenge {
|
|
|
310
313
|
*
|
|
311
314
|
* @param cred Credential created by calling the `CredentialContainer`'s `create` method
|
|
312
315
|
* based on the public key creation options from this challenge.
|
|
316
|
+
* @returns FIDO registration response
|
|
313
317
|
*/
|
|
314
318
|
async answer(cred: any) {
|
|
315
319
|
const answer = credentialToJSON(cred);
|
|
316
|
-
await this.#api.userFidoRegisterComplete(this.challengeId, answer);
|
|
320
|
+
return await this.#api.userFidoRegisterComplete(this.challengeId, answer);
|
|
317
321
|
}
|
|
318
322
|
}
|
|
319
323
|
|
package/src/schema.ts
CHANGED
|
@@ -6183,7 +6183,7 @@ export interface components {
|
|
|
6183
6183
|
/** @default null */
|
|
6184
6184
|
Empty: unknown;
|
|
6185
6185
|
EmptyImpl: {
|
|
6186
|
-
status:
|
|
6186
|
+
status: components["schemas"]["StatusOk"];
|
|
6187
6187
|
};
|
|
6188
6188
|
/**
|
|
6189
6189
|
* @description Request to create a set of EOTS nonces for a specified chain-id, starting
|
|
@@ -6945,6 +6945,19 @@ export interface components {
|
|
|
6945
6945
|
};
|
|
6946
6946
|
/** @description Declares intent to register a new FIDO key */
|
|
6947
6947
|
FidoCreateRequest: {
|
|
6948
|
+
/**
|
|
6949
|
+
* @description If set, the attestation answering this registration challenge additionally counts as an
|
|
6950
|
+
* approving vote on pending MFA request `mfa_id`.
|
|
6951
|
+
*
|
|
6952
|
+
* This exists so that a user who must register their first second factor in order to complete
|
|
6953
|
+
* an operation (most commonly logging in) does not have to perform two authenticator
|
|
6954
|
+
* ceremonies back to back: one to enroll the credential and another to immediately prove
|
|
6955
|
+
* possession of it. The attestation is a full WebAuthn ceremony over a server-issued
|
|
6956
|
+
* challenge, so it is no weaker than the separate assertion it replaces.
|
|
6957
|
+
*
|
|
6958
|
+
* Requires the 'manage:mfa:vote:fido' scope in addition to 'manage:mfa:register:fido'.
|
|
6959
|
+
*/
|
|
6960
|
+
approve_mfa?: string | null;
|
|
6948
6961
|
/** @description Whether this key can be used for passwordless login */
|
|
6949
6962
|
discoverable?: boolean;
|
|
6950
6963
|
/**
|
|
@@ -6961,6 +6974,11 @@ export interface components {
|
|
|
6961
6974
|
*/
|
|
6962
6975
|
request_device_identifier?: boolean;
|
|
6963
6976
|
};
|
|
6977
|
+
/** @description Result of registering a FIDO key */
|
|
6978
|
+
FidoRegisterResponse: {
|
|
6979
|
+
mfa?: components["schemas"]["MfaRequestInfo"];
|
|
6980
|
+
status: components["schemas"]["StatusOk"];
|
|
6981
|
+
};
|
|
6964
6982
|
/** @enum {string} */
|
|
6965
6983
|
ForbiddenErrorCode:
|
|
6966
6984
|
| "AlienKeyCreate"
|
|
@@ -10717,6 +10735,16 @@ export interface components {
|
|
|
10717
10735
|
};
|
|
10718
10736
|
};
|
|
10719
10737
|
};
|
|
10738
|
+
/**
|
|
10739
|
+
* @description The `status` field carried by [`Empty`] responses. Always serializes as `"ok"`.
|
|
10740
|
+
*
|
|
10741
|
+
* Endpoints that used to return [`Empty`] and now return something richer must keep emitting
|
|
10742
|
+
* this field, because generated clients bind [`Empty`] to a struct with a *required* `status`
|
|
10743
|
+
* and would otherwise fail to deserialize a successful response. Use this type rather than a
|
|
10744
|
+
* bare `String` so the one acceptable value is not something anyone has to remember.
|
|
10745
|
+
* @enum {string}
|
|
10746
|
+
*/
|
|
10747
|
+
StatusOk: "ok";
|
|
10720
10748
|
/**
|
|
10721
10749
|
* @description A single asset balance entry returned by [`SubAccountAssetsResponse`].
|
|
10722
10750
|
*
|
|
@@ -11137,8 +11165,25 @@ export interface components {
|
|
|
11137
11165
|
*/
|
|
11138
11166
|
totp_url: string;
|
|
11139
11167
|
};
|
|
11168
|
+
/** @description Result of registering (resetting) TOTP */
|
|
11169
|
+
TotpRegisterResponse: {
|
|
11170
|
+
mfa?: components["schemas"]["MfaRequestInfo"];
|
|
11171
|
+
status: components["schemas"]["StatusOk"];
|
|
11172
|
+
};
|
|
11140
11173
|
/** @description Request to reset TOTP. */
|
|
11141
11174
|
TotpResetRequest: {
|
|
11175
|
+
/**
|
|
11176
|
+
* @description If set, the code answering this challenge additionally counts as an approving vote on
|
|
11177
|
+
* pending MFA request `mfa_id`.
|
|
11178
|
+
*
|
|
11179
|
+
* This exists so that a user who must register their first second factor in order to complete
|
|
11180
|
+
* an operation (most commonly logging in) does not have to enter two TOTP codes back to back:
|
|
11181
|
+
* one to confirm enrollment and another to immediately approve the pending request. Answering
|
|
11182
|
+
* the challenge already proves possession of the new secret.
|
|
11183
|
+
*
|
|
11184
|
+
* Requires the 'manage:mfa:vote:totp' scope in addition to 'manage:mfa:register:totp'.
|
|
11185
|
+
*/
|
|
11186
|
+
approve_mfa?: string | null;
|
|
11142
11187
|
/** @description The name of the issuer; defaults to "Cubist". */
|
|
11143
11188
|
issuer?: string | null;
|
|
11144
11189
|
};
|
|
@@ -12774,7 +12819,7 @@ export interface components {
|
|
|
12774
12819
|
EmptyImpl: {
|
|
12775
12820
|
content: {
|
|
12776
12821
|
"application/json": {
|
|
12777
|
-
status:
|
|
12822
|
+
status: components["schemas"]["StatusOk"];
|
|
12778
12823
|
};
|
|
12779
12824
|
};
|
|
12780
12825
|
};
|
|
@@ -12840,6 +12885,15 @@ export interface components {
|
|
|
12840
12885
|
};
|
|
12841
12886
|
};
|
|
12842
12887
|
};
|
|
12888
|
+
/** @description Result of registering a FIDO key */
|
|
12889
|
+
FidoRegisterResponse: {
|
|
12890
|
+
content: {
|
|
12891
|
+
"application/json": {
|
|
12892
|
+
mfa?: components["schemas"]["MfaRequestInfo"];
|
|
12893
|
+
status: components["schemas"]["StatusOk"];
|
|
12894
|
+
};
|
|
12895
|
+
};
|
|
12896
|
+
};
|
|
12843
12897
|
/** @description The email sender configuration (without sensitive auth details) */
|
|
12844
12898
|
GetEmailConfigResponse: {
|
|
12845
12899
|
content: {
|
|
@@ -14030,6 +14084,15 @@ export interface components {
|
|
|
14030
14084
|
};
|
|
14031
14085
|
};
|
|
14032
14086
|
};
|
|
14087
|
+
/** @description Result of registering (resetting) TOTP */
|
|
14088
|
+
TotpRegisterResponse: {
|
|
14089
|
+
content: {
|
|
14090
|
+
"application/json": {
|
|
14091
|
+
mfa?: components["schemas"]["MfaRequestInfo"];
|
|
14092
|
+
status: components["schemas"]["StatusOk"];
|
|
14093
|
+
};
|
|
14094
|
+
};
|
|
14095
|
+
};
|
|
14033
14096
|
/** @description A response to sign an eth2 unstake request. */
|
|
14034
14097
|
UnstakeResponse: {
|
|
14035
14098
|
content: {
|
|
@@ -19500,7 +19563,7 @@ export interface operations {
|
|
|
19500
19563
|
};
|
|
19501
19564
|
};
|
|
19502
19565
|
responses: {
|
|
19503
|
-
200: components["responses"]["
|
|
19566
|
+
200: components["responses"]["FidoRegisterResponse"];
|
|
19504
19567
|
default: {
|
|
19505
19568
|
content: {
|
|
19506
19569
|
"application/json": components["schemas"]["ErrorResponse"];
|
|
@@ -19647,7 +19710,7 @@ export interface operations {
|
|
|
19647
19710
|
};
|
|
19648
19711
|
};
|
|
19649
19712
|
responses: {
|
|
19650
|
-
200: components["responses"]["
|
|
19713
|
+
200: components["responses"]["TotpRegisterResponse"];
|
|
19651
19714
|
default: {
|
|
19652
19715
|
content: {
|
|
19653
19716
|
"application/json": components["schemas"]["ErrorResponse"];
|