@cubist-labs/cubesigner-sdk 0.3.13 → 0.3.19
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/README.md +1 -1
- package/dist/cjs/package.json +2 -2
- package/dist/cjs/src/api.d.ts +50 -5
- package/dist/cjs/src/api.js +71 -20
- package/dist/cjs/src/client.d.ts +4 -0
- package/dist/cjs/src/error.d.ts +2 -0
- package/dist/cjs/src/error.js +1 -1
- package/dist/cjs/src/evm/index.d.ts +74 -0
- package/dist/cjs/src/evm/index.js +165 -0
- package/dist/cjs/src/index.d.ts +2 -0
- package/dist/cjs/src/index.js +3 -1
- package/dist/cjs/src/org.d.ts +8 -1
- package/dist/cjs/src/org.js +11 -1
- package/dist/cjs/src/schema.d.ts +117 -7
- package/dist/cjs/src/schema.js +1 -1
- package/dist/cjs/src/schema_types.d.ts +3 -1
- package/dist/cjs/src/schema_types.js +1 -1
- package/dist/esm/package.json +2 -2
- package/dist/esm/src/api.d.ts +50 -5
- package/dist/esm/src/api.js +72 -21
- package/dist/esm/src/client.d.ts +4 -0
- package/dist/esm/src/error.d.ts +2 -0
- package/dist/esm/src/error.js +1 -1
- package/dist/esm/src/evm/index.d.ts +74 -0
- package/dist/esm/src/evm/index.js +161 -0
- package/dist/esm/src/index.d.ts +2 -0
- package/dist/esm/src/index.js +3 -1
- package/dist/esm/src/org.d.ts +8 -1
- package/dist/esm/src/org.js +12 -2
- package/dist/esm/src/schema.d.ts +117 -7
- package/dist/esm/src/schema.js +1 -1
- package/dist/esm/src/schema_types.d.ts +3 -1
- package/dist/esm/src/schema_types.js +1 -1
- package/package.json +2 -2
- package/src/api.ts +96 -19
- package/src/error.ts +2 -0
- package/src/evm/index.ts +192 -0
- package/src/index.ts +2 -0
- package/src/org.ts +17 -1
- package/src/schema.ts +134 -7
- package/src/schema_types.ts +3 -1
- package/tsconfig.json +3 -3
package/README.md
CHANGED
|
@@ -205,7 +205,7 @@ import { ethers } from "ethers";
|
|
|
205
205
|
|
|
206
206
|
// Create new Signer
|
|
207
207
|
const ethersSigner = new Signer(secpKey.materialId, session);
|
|
208
|
-
assert((await ethersSigner.getAddress()) === secpKey.materialId);
|
|
208
|
+
assert((await ethersSigner.getAddress()) === ethers.getAddress(secpKey.materialId));
|
|
209
209
|
// sign transaction as usual:
|
|
210
210
|
console.log(
|
|
211
211
|
"ethers.js signature:",
|
package/dist/cjs/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cubist-labs/cubesigner-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "CubeSigner TypeScript SDK",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "Cubist, Inc.",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"openapi-fetch": "0.6.1"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@hpke/core": "^1.2.
|
|
33
|
+
"@hpke/core": "^1.2.7"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=18.0.0"
|
package/dist/cjs/src/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import createClient, { FetchOptions, FetchResponse, FilterKeys, HttpMethod, PathsWith } from "openapi-fetch";
|
|
2
2
|
import { paths, operations } from "./schema";
|
|
3
3
|
import { SignerSessionData, SignerSessionLifetime, SignerSessionManager } from "./session/signer_session_manager";
|
|
4
|
-
import { CreateOidcUserOptions, IdentityProof, KeyInRoleInfo, KeyInfoApi, ListKeysResponse, ListKeyRolesResponse, ListRoleKeysResponse, ListRoleUsersResponse, ListRolesResponse, OidcIdentity, SessionsResponse, PublicKeyCredential, RoleInfo, UpdateKeyRequest, UpdateOrgRequest, UpdateOrgResponse, UpdateRoleRequest,
|
|
4
|
+
import { CreateOidcUserOptions, IdentityProof, KeyInRoleInfo, KeyInfoApi, ListKeysResponse, ListKeyRolesResponse, ListRoleKeysResponse, ListRoleUsersResponse, ListRolesResponse, OidcIdentity, SessionsResponse, PublicKeyCredential, RoleInfo, UpdateKeyRequest, UpdateOrgRequest, UpdateOrgResponse, UpdateRoleRequest, UserInOrgInfo, UserInRoleInfo, UserInfo, SessionInfo, OrgInfo, RatchetConfig, Eip191SignRequest, Eip712SignRequest, Eip191Or712SignResponse, EvmSignRequest, EvmSignResponse, Eth2SignRequest, Eth2SignResponse, Eth2StakeRequest, Eth2StakeResponse, Eth2UnstakeRequest, Eth2UnstakeResponse, BlobSignRequest, BlobSignResponse, BtcSignResponse, BtcSignRequest, SolanaSignRequest, SolanaSignResponse, AvaSignResponse, AvaTx, MfaRequestInfo, MfaVote, MemberRole, UserExportCompleteResponse, UserExportInitResponse, UserExportListResponse, Empty } from "./schema_types";
|
|
5
5
|
import { AddFidoChallenge, MfaFidoChallenge, MfaReceipt, TotpChallenge } from "./mfa";
|
|
6
6
|
import { CubeSignerResponse } from "./response";
|
|
7
7
|
import { Key, KeyType } from "./key";
|
|
@@ -38,6 +38,22 @@ export type FetchClient<Op extends keyof operations> = ReturnType<typeof createC
|
|
|
38
38
|
* {@link FetchResponse<T>}) when that response is successful.
|
|
39
39
|
*/
|
|
40
40
|
export type FetchResponseSuccessData<T> = Required<FetchResponse<T>>["data"];
|
|
41
|
+
/**
|
|
42
|
+
* Internal type for a function that returns a promise of a fetch response.
|
|
43
|
+
*/
|
|
44
|
+
type ReqFn<T> = () => Promise<FetchResponse<T>>;
|
|
45
|
+
/**
|
|
46
|
+
* Retry settings.
|
|
47
|
+
*
|
|
48
|
+
* By default, {@link OpClient} retries on 5xx codes with delays of
|
|
49
|
+
* 100ms, 200ms, and 400ms between retries.
|
|
50
|
+
*/
|
|
51
|
+
export interface RetrySettings {
|
|
52
|
+
/** HTTP status codes on which to retry */
|
|
53
|
+
codes: number[];
|
|
54
|
+
/** Delays in milliseconds between retries */
|
|
55
|
+
delaysMs: number[];
|
|
56
|
+
}
|
|
41
57
|
/**
|
|
42
58
|
* Wrapper around an open-fetch client restricted to a single operation.
|
|
43
59
|
* The restriction applies only when type checking, the actual
|
|
@@ -50,8 +66,10 @@ export declare class OpClient<Op extends keyof operations> {
|
|
|
50
66
|
* @param {Op} op The operation this client should be restricted to
|
|
51
67
|
* @param {FetchClient<Op> | Client} client open-fetch client (either restricted to {@link Op} or not)
|
|
52
68
|
* @param {EventEmitter} eventEmitter The client-local event dispatcher.
|
|
69
|
+
* @param {number[]} retrySettings Retry settings. By default, retries 3 times, sleeping 100ms
|
|
70
|
+
* after the first failed attempt, 200ms after the second, and finally 400ms after the third,
|
|
53
71
|
*/
|
|
54
|
-
constructor(op: Op, client: FetchClient<Op> | Client, eventEmitter: EventEmitter);
|
|
72
|
+
constructor(op: Op, client: FetchClient<Op> | Client, eventEmitter: EventEmitter, retrySettings?: RetrySettings);
|
|
55
73
|
/** The operation this client is restricted to */
|
|
56
74
|
get op(): Op;
|
|
57
75
|
/**
|
|
@@ -62,6 +80,29 @@ export declare class OpClient<Op extends keyof operations> {
|
|
|
62
80
|
* @return {FetchResponseSuccessData<T>} The response data corresponding to response type {@link T}.
|
|
63
81
|
*/
|
|
64
82
|
private assertOk;
|
|
83
|
+
/**
|
|
84
|
+
* @param {number[]} delaysMs Delays in milliseconds between retries.
|
|
85
|
+
* @return {OpClient<Op>} Returns the same client as this except with different retry delays.
|
|
86
|
+
*/
|
|
87
|
+
withRetries(delaysMs: number[]): OpClient<Op>;
|
|
88
|
+
/**
|
|
89
|
+
* @param {RetrySettings} retrySettings New retry settings
|
|
90
|
+
* @return {OpClient<Op>} Returns the same client as this except with different retry settings.
|
|
91
|
+
*/
|
|
92
|
+
withRetrySettings(retrySettings: RetrySettings): OpClient<Op>;
|
|
93
|
+
/**
|
|
94
|
+
* Internal.
|
|
95
|
+
*
|
|
96
|
+
* Executes a given request, potentially retrying on 5xx errors. The
|
|
97
|
+
* retry configuration can be set via the constructor.
|
|
98
|
+
* On all other errors, throws {@link ErrResponse} (as well as after exhausting all retries).
|
|
99
|
+
* On success, returns the response body.
|
|
100
|
+
*
|
|
101
|
+
* @param {ReqFn<T>} req The request to execute and then retry on 5xx errors
|
|
102
|
+
* @return {Promise<FetchResponseSuccessData<T>>}
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
execute<T>(req: ReqFn<T>): Promise<FetchResponseSuccessData<T>>;
|
|
65
106
|
/**
|
|
66
107
|
* Invoke HTTP GET
|
|
67
108
|
*/
|
|
@@ -107,8 +148,10 @@ export declare class CubeSignerApi {
|
|
|
107
148
|
* Constructor.
|
|
108
149
|
* @param {SignerSessionManager} sessionMgr The session manager to use
|
|
109
150
|
* @param {string?} orgId Optional organization ID; if omitted, uses the org ID from the session manager.
|
|
151
|
+
* @param {RetrySettings} retrySettings Retry settings. By default, retries 3 times, sleeping 100ms
|
|
152
|
+
* after the first failed attempt, 200ms after the second, and finally 400ms after the third,
|
|
110
153
|
*/
|
|
111
|
-
constructor(sessionMgr: SignerSessionManager, orgId?: string);
|
|
154
|
+
constructor(sessionMgr: SignerSessionManager, orgId?: string, retrySettings?: RetrySettings);
|
|
112
155
|
/**
|
|
113
156
|
* Returns a new instance of this class using the same session manager but targeting a different organization.
|
|
114
157
|
*
|
|
@@ -218,7 +261,7 @@ export declare class CubeSignerApi {
|
|
|
218
261
|
* List users.
|
|
219
262
|
* @return {User[]} Org users.
|
|
220
263
|
*/
|
|
221
|
-
orgUsersList(): Promise<
|
|
264
|
+
orgUsersList(): Promise<UserInOrgInfo[]>;
|
|
222
265
|
/**
|
|
223
266
|
* Create a new OIDC user. This can be a first-party "Member" or third-party "Alien".
|
|
224
267
|
* @param {OidcIdentity} identity The identity of the OIDC user
|
|
@@ -626,8 +669,10 @@ export declare class OidcClient {
|
|
|
626
669
|
* @param {EnvInterface} env CubeSigner deployment
|
|
627
670
|
* @param {string} orgId Target organization ID
|
|
628
671
|
* @param {string} oidcToken User's OIDC token
|
|
672
|
+
* @param {RetrySettings} retrySettings Retry settings. By default, retries 3 times, sleeping 100ms
|
|
673
|
+
* after the first failed attempt, 200ms after the second, and finally 400ms after the third.
|
|
629
674
|
*/
|
|
630
|
-
constructor(env: EnvInterface, orgId: string, oidcToken: string);
|
|
675
|
+
constructor(env: EnvInterface, orgId: string, oidcToken: string, retrySettings?: RetrySettings);
|
|
631
676
|
/**
|
|
632
677
|
* HTTP client restricted to a single operation.
|
|
633
678
|
*
|