@cubist-labs/cubesigner-sdk 0.2.28 → 0.3.8
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 +30 -28
- package/dist/cjs/package.json +41 -0
- package/dist/cjs/spec/env/beta.json +9 -0
- package/dist/cjs/spec/env/gamma.json +9 -0
- package/dist/cjs/spec/env/prod.json +9 -0
- package/dist/cjs/src/api.d.ts +652 -0
- package/dist/cjs/src/api.js +1345 -0
- package/dist/cjs/src/client.d.ts +642 -0
- package/dist/cjs/src/client.js +455 -0
- package/dist/cjs/src/env.d.ts +15 -0
- package/dist/cjs/src/env.js +35 -0
- package/dist/cjs/src/error.d.ts +32 -0
- package/dist/cjs/src/error.js +37 -0
- package/dist/cjs/src/events.d.ts +84 -0
- package/dist/cjs/src/events.js +195 -0
- package/dist/cjs/src/index.d.ts +203 -0
- package/dist/cjs/src/index.js +298 -0
- package/dist/cjs/src/key.d.ts +169 -0
- package/dist/cjs/src/key.js +262 -0
- package/dist/{src/fido.d.ts → cjs/src/mfa.d.ts} +38 -17
- package/dist/cjs/src/mfa.js +172 -0
- package/dist/cjs/src/org.d.ts +99 -0
- package/dist/cjs/src/org.js +95 -0
- package/dist/cjs/src/paginator.d.ts +76 -0
- package/dist/cjs/src/paginator.js +99 -0
- package/dist/cjs/src/response.d.ts +114 -0
- package/dist/cjs/src/response.js +203 -0
- package/dist/cjs/src/role.d.ts +289 -0
- package/dist/cjs/src/role.js +261 -0
- package/dist/cjs/src/schema.d.ts +6404 -0
- package/dist/cjs/src/schema.js +7 -0
- package/dist/cjs/src/schema_types.d.ts +116 -0
- package/dist/cjs/src/schema_types.js +3 -0
- package/dist/cjs/src/session/session_storage.d.ts +27 -0
- package/dist/cjs/src/session/session_storage.js +47 -0
- package/dist/cjs/src/session/signer_session_manager.d.ts +125 -0
- package/dist/cjs/src/session/signer_session_manager.js +239 -0
- package/dist/cjs/src/signer_session.d.ts +41 -0
- package/dist/cjs/src/signer_session.js +77 -0
- package/dist/cjs/src/user_export.d.ts +52 -0
- package/dist/cjs/src/user_export.js +129 -0
- package/dist/cjs/src/util.d.ts +56 -0
- package/dist/cjs/src/util.js +87 -0
- package/dist/esm/package.json +41 -0
- package/dist/esm/spec/env/beta.json +9 -0
- package/dist/esm/spec/env/gamma.json +9 -0
- package/dist/esm/spec/env/prod.json +9 -0
- package/dist/esm/src/api.d.ts +652 -0
- package/dist/esm/src/api.js +1335 -0
- package/dist/esm/src/client.d.ts +642 -0
- package/dist/esm/src/client.js +451 -0
- package/dist/esm/src/env.d.ts +15 -0
- package/dist/esm/src/env.js +9 -0
- package/dist/esm/src/error.d.ts +32 -0
- package/dist/esm/src/error.js +32 -0
- package/dist/esm/src/events.d.ts +84 -0
- package/dist/esm/src/events.js +189 -0
- package/dist/esm/src/index.d.ts +203 -0
- package/dist/esm/src/index.js +276 -0
- package/dist/esm/src/key.d.ts +169 -0
- package/dist/esm/src/key.js +256 -0
- package/dist/esm/src/mfa.d.ts +97 -0
- package/dist/esm/src/mfa.js +166 -0
- package/dist/esm/src/org.d.ts +99 -0
- package/dist/esm/src/org.js +91 -0
- package/dist/esm/src/paginator.d.ts +76 -0
- package/dist/esm/src/paginator.js +94 -0
- package/dist/esm/src/response.d.ts +114 -0
- package/dist/esm/src/response.js +198 -0
- package/dist/esm/src/role.d.ts +289 -0
- package/dist/esm/src/role.js +256 -0
- package/dist/esm/src/schema.d.ts +6404 -0
- package/dist/esm/src/schema.js +6 -0
- package/dist/esm/src/schema_types.d.ts +116 -0
- package/dist/esm/src/schema_types.js +2 -0
- package/dist/esm/src/session/session_storage.d.ts +27 -0
- package/dist/esm/src/session/session_storage.js +43 -0
- package/dist/esm/src/session/signer_session_manager.d.ts +125 -0
- package/dist/esm/src/session/signer_session_manager.js +235 -0
- package/dist/esm/src/signer_session.d.ts +41 -0
- package/dist/esm/src/signer_session.js +72 -0
- package/dist/esm/src/user_export.d.ts +52 -0
- package/dist/esm/src/user_export.js +99 -0
- package/dist/esm/src/util.d.ts +56 -0
- package/dist/esm/src/util.js +77 -0
- package/dist/package.json +13 -45
- package/dist/src/api.d.ts +29 -1
- package/dist/src/api.js +66 -1
- package/dist/src/client.d.ts +35 -14
- package/dist/src/client.js +12 -8
- package/dist/src/events.js +1 -1
- package/dist/src/index.d.ts +6 -11
- package/dist/src/index.js +9 -25
- package/dist/src/key.d.ts +18 -7
- package/dist/src/key.js +52 -19
- package/dist/src/role.d.ts +46 -3
- package/dist/src/role.js +60 -8
- package/dist/src/schema.d.ts +206 -72
- package/dist/src/schema.js +1 -1
- package/dist/src/schema_types.d.ts +3 -0
- package/dist/src/schema_types.js +1 -1
- package/dist/src/session/signer_session_manager.d.ts +38 -14
- package/dist/src/session/signer_session_manager.js +93 -33
- package/dist/src/util.d.ts +14 -0
- package/dist/src/util.js +24 -27
- package/package.json +19 -46
- package/src/api.ts +145 -19
- package/src/client.ts +106 -10
- package/src/error.ts +4 -0
- package/src/events.ts +2 -0
- package/src/index.ts +10 -24
- package/src/key.ts +67 -20
- package/src/mfa.ts +8 -4
- package/src/response.ts +50 -4
- package/src/role.ts +87 -7
- package/src/schema.ts +764 -152
- package/src/schema_types.ts +6 -0
- package/src/session/session_storage.ts +0 -32
- package/src/session/signer_session_manager.ts +126 -38
- package/src/util.ts +18 -10
- package/tsconfig.json +1 -21
- package/LICENSE-APACHE +0 -177
- package/LICENSE-MIT +0 -25
- package/NOTICE +0 -13
- package/dist/examples/ethers.d.ts +0 -1
- package/dist/examples/ethers.js +0 -142
- package/dist/src/ethers/index.d.ts +0 -95
- package/dist/src/ethers/index.js +0 -215
- package/dist/src/fido.js +0 -148
- package/dist/src/session/cognito_manager.d.ts +0 -71
- package/dist/src/session/cognito_manager.js +0 -129
- package/dist/src/session/generic.d.ts +0 -47
- package/dist/src/session/generic.js +0 -3
- package/dist/src/session/management_session_manager.d.ts +0 -59
- package/dist/src/session/management_session_manager.js +0 -111
- package/dist/src/session/oidc_session_manager.d.ts +0 -78
- package/dist/src/session/oidc_session_manager.js +0 -142
- package/dist/src/session/session_manager.d.ts +0 -99
- package/dist/src/session/session_manager.js +0 -136
- package/dist/src/sign.d.ts +0 -114
- package/dist/src/sign.js +0 -248
- package/dist/test/sessions.d.ts +0 -35
- package/dist/test/sessions.js +0 -56
- package/src/ethers/index.ts +0 -253
- package/src/session/cognito_manager.ts +0 -161
- package/src/session/session_manager.ts +0 -165
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
import createClient, { FetchOptions, FetchResponse, FilterKeys, HttpMethod, PathsWith } from "openapi-fetch";
|
|
2
|
+
import { paths, operations } from "./schema";
|
|
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, UserIdInfo, 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
|
+
import { AddFidoChallenge, MfaFidoChallenge, MfaReceipt, TotpChallenge } from "./mfa";
|
|
6
|
+
import { CubeSignerResponse } from "./response";
|
|
7
|
+
import { Key, KeyType } from "./key";
|
|
8
|
+
import { PageOpts, Paginator } from "./paginator";
|
|
9
|
+
import { KeyPolicy } from "./role";
|
|
10
|
+
import { EnvInterface } from "./env";
|
|
11
|
+
import { EventEmitter } from "./events";
|
|
12
|
+
/** @internal */
|
|
13
|
+
export type Client = ReturnType<typeof createClient<paths>>;
|
|
14
|
+
export { paths, operations };
|
|
15
|
+
/**
|
|
16
|
+
* Omit routes in {@link T} whose methods are all 'never'
|
|
17
|
+
*/
|
|
18
|
+
type OmitNeverPaths<T extends paths> = {
|
|
19
|
+
[p in keyof T as T[p] extends {
|
|
20
|
+
[m in keyof T[p]]: never;
|
|
21
|
+
} ? never : p]: T[p];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Filter out methods that don't match operation {@link Op}
|
|
25
|
+
*/
|
|
26
|
+
type FilterPaths<Op extends keyof operations> = {
|
|
27
|
+
[p in keyof paths]: {
|
|
28
|
+
[m in HttpMethod as m extends keyof paths[p] ? m : never]: m extends keyof paths[p] ? operations[Op] extends paths[p][m] ? paths[p][m] extends operations[Op] ? operations[Op] : never : never : never;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
type Paths<Op extends keyof operations> = OmitNeverPaths<FilterPaths<Op>>;
|
|
32
|
+
/**
|
|
33
|
+
* Open-fetch client restricted to the route that corresponds to operation {@link Op}
|
|
34
|
+
*/
|
|
35
|
+
export type FetchClient<Op extends keyof operations> = ReturnType<typeof createClient<Paths<Op>>>;
|
|
36
|
+
/**
|
|
37
|
+
* Type alias for the type of the response body (the "data" field of
|
|
38
|
+
* {@link FetchResponse<T>}) when that response is successful.
|
|
39
|
+
*/
|
|
40
|
+
export type FetchResponseSuccessData<T> = Required<FetchResponse<T>>["data"];
|
|
41
|
+
/**
|
|
42
|
+
* Wrapper around an open-fetch client restricted to a single operation.
|
|
43
|
+
* The restriction applies only when type checking, the actual
|
|
44
|
+
* client does not restrict anything at runtime.
|
|
45
|
+
* client does not restrict anything at runtime
|
|
46
|
+
*/
|
|
47
|
+
export declare class OpClient<Op extends keyof operations> {
|
|
48
|
+
#private;
|
|
49
|
+
/**
|
|
50
|
+
* @param {Op} op The operation this client should be restricted to
|
|
51
|
+
* @param {FetchClient<Op> | Client} client open-fetch client (either restricted to {@link Op} or not)
|
|
52
|
+
* @param {EventEmitter} eventEmitter The client-local event dispatcher.
|
|
53
|
+
*/
|
|
54
|
+
constructor(op: Op, client: FetchClient<Op> | Client, eventEmitter: EventEmitter);
|
|
55
|
+
/** The operation this client is restricted to */
|
|
56
|
+
get op(): Op;
|
|
57
|
+
/**
|
|
58
|
+
* Inspects the response and returns the response body if the request was successful.
|
|
59
|
+
* Otherwise, dispatches the error to event listeners, then throws {@link ErrResponse}.
|
|
60
|
+
*
|
|
61
|
+
* @param {FetchResponse<T>} resp The response to check
|
|
62
|
+
* @return {FetchResponseSuccessData<T>} The response data corresponding to response type {@link T}.
|
|
63
|
+
*/
|
|
64
|
+
private assertOk;
|
|
65
|
+
/**
|
|
66
|
+
* Invoke HTTP GET
|
|
67
|
+
*/
|
|
68
|
+
get(url: PathsWith<Paths<Op>, "get">, init: FetchOptions<FilterKeys<Paths<Op>[PathsWith<Paths<Op>, "get">], "get">>): Promise<("get" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "get">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "get">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "get">] & "get"] : unknown) extends infer T ? T extends ("get" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "get">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "get">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "get">] & "get"] : unknown) ? T extends {
|
|
69
|
+
responses: any;
|
|
70
|
+
} ? NonNullable<FilterKeys<import("openapi-fetch").Success<T["responses"]>, `${string}/${string}`>> : unknown : never : never>;
|
|
71
|
+
/** Invoke HTTP POST */
|
|
72
|
+
post(url: PathsWith<Paths<Op>, "post">, init: FetchOptions<FilterKeys<Paths<Op>[PathsWith<Paths<Op>, "post">], "post">>): Promise<("post" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "post">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "post">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "post">] & "post"] : unknown) extends infer T ? T extends ("post" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "post">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "post">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "post">] & "post"] : unknown) ? T extends {
|
|
73
|
+
responses: any;
|
|
74
|
+
} ? NonNullable<FilterKeys<import("openapi-fetch").Success<T["responses"]>, `${string}/${string}`>> : unknown : never : never>;
|
|
75
|
+
/** Invoke HTTP PATCH */
|
|
76
|
+
patch(url: PathsWith<Paths<Op>, "patch">, init: FetchOptions<FilterKeys<Paths<Op>[PathsWith<Paths<Op>, "patch">], "patch">>): Promise<("patch" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "patch">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "patch">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "patch">] & "patch"] : unknown) extends infer T ? T extends ("patch" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "patch">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "patch">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "patch">] & "patch"] : unknown) ? T extends {
|
|
77
|
+
responses: any;
|
|
78
|
+
} ? NonNullable<FilterKeys<import("openapi-fetch").Success<T["responses"]>, `${string}/${string}`>> : unknown : never : never>;
|
|
79
|
+
/** Invoke HTTP DELETE */
|
|
80
|
+
del(url: PathsWith<Paths<Op>, "delete">, init: FetchOptions<FilterKeys<Paths<Op>[PathsWith<Paths<Op>, "delete">], "delete">>): Promise<("delete" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "delete">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "delete">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "delete">] & "delete"] : unknown) extends infer T ? T extends ("delete" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "delete">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "delete">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "delete">] & "delete"] : unknown) ? T extends {
|
|
81
|
+
responses: any;
|
|
82
|
+
} ? NonNullable<FilterKeys<import("openapi-fetch").Success<T["responses"]>, `${string}/${string}`>> : unknown : never : never>;
|
|
83
|
+
/** Invoke HTTP PUT */
|
|
84
|
+
put(url: PathsWith<Paths<Op>, "put">, init: FetchOptions<FilterKeys<Paths<Op>[PathsWith<Paths<Op>, "put">], "put">>): Promise<("put" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "put">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "put">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "put">] & "put"] : unknown) extends infer T ? T extends ("put" extends keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "put">] ? OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "put">][keyof OmitNeverPaths<FilterPaths<Op>>[PathsWith<OmitNeverPaths<FilterPaths<Op>>, "put">] & "put"] : unknown) ? T extends {
|
|
85
|
+
responses: any;
|
|
86
|
+
} ? NonNullable<FilterKeys<import("openapi-fetch").Success<T["responses"]>, `${string}/${string}`>> : unknown : never : never>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Creates a new HTTP client, setting the "User-Agent" header to this package's {name}@{version}.
|
|
90
|
+
*
|
|
91
|
+
* @param {string} baseUrl The base URL of the client (e.g., "https://gamma.signer.cubist.dev")
|
|
92
|
+
* @param {string} authToken The value to send as "Authorization" header.
|
|
93
|
+
* @return {Client} The new HTTP client.
|
|
94
|
+
*/
|
|
95
|
+
export declare function createHttpClient(baseUrl: string, authToken: string): Client;
|
|
96
|
+
/**
|
|
97
|
+
* Client to use to send requests to CubeSigner services
|
|
98
|
+
* when authenticating using a CubeSigner session token.
|
|
99
|
+
*/
|
|
100
|
+
export declare class CubeSignerApi {
|
|
101
|
+
#private;
|
|
102
|
+
/** Underlying session manager */
|
|
103
|
+
get sessionMgr(): SignerSessionManager;
|
|
104
|
+
/** Target environment */
|
|
105
|
+
get env(): EnvInterface;
|
|
106
|
+
/**
|
|
107
|
+
* Constructor.
|
|
108
|
+
* @param {SignerSessionManager} sessionMgr The session manager to use
|
|
109
|
+
* @param {string?} orgId Optional organization ID; if omitted, uses the org ID from the session manager.
|
|
110
|
+
*/
|
|
111
|
+
constructor(sessionMgr: SignerSessionManager, orgId?: string);
|
|
112
|
+
/**
|
|
113
|
+
* Returns a new instance of this class using the same session manager but targeting a different organization.
|
|
114
|
+
*
|
|
115
|
+
* @param {string} orgId The organization ID.
|
|
116
|
+
* @return {CubeSignerApi} A new instance of this class using the same session manager but targeting different organization.
|
|
117
|
+
*/
|
|
118
|
+
withOrg(orgId?: string): CubeSignerApi;
|
|
119
|
+
/** Org id or name */
|
|
120
|
+
get orgId(): string;
|
|
121
|
+
/**
|
|
122
|
+
* HTTP client restricted to a single operation. The restriction applies only
|
|
123
|
+
* when type checking, the actual client does not restrict anything at runtime.
|
|
124
|
+
*
|
|
125
|
+
* @param {Op} op The operation to restrict the client to
|
|
126
|
+
* @return {Promise<OpClient<Op>>} The client restricted to {@link op}
|
|
127
|
+
*/
|
|
128
|
+
private client;
|
|
129
|
+
/**
|
|
130
|
+
* Obtain information about the current user.
|
|
131
|
+
*
|
|
132
|
+
* @return {Promise<UserInfo>} Retrieves information about the current user.
|
|
133
|
+
*/
|
|
134
|
+
userGet(): Promise<UserInfo>;
|
|
135
|
+
/**
|
|
136
|
+
* Creates a request to change user's TOTP. Returns a {@link TotpChallenge}
|
|
137
|
+
* that must be answered either by calling {@link TotpChallenge.answer} (or
|
|
138
|
+
* {@link CubeSignerApi.userTotpResetComplete}).
|
|
139
|
+
*
|
|
140
|
+
* @param {string} issuer Optional issuer; defaults to "Cubist"
|
|
141
|
+
* @param {MfaReceipt} mfaReceipt MFA receipt to include in HTTP headers
|
|
142
|
+
*/
|
|
143
|
+
userTotpResetInit(issuer?: string, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<TotpChallenge>>;
|
|
144
|
+
/**
|
|
145
|
+
* Answer the TOTP challenge issued by {@link userTotpResetInit}. If successful, user's
|
|
146
|
+
* TOTP configuration will be updated to that of the TOTP challenge.
|
|
147
|
+
*
|
|
148
|
+
* Instead of calling this method directly, prefer {@link TotpChallenge.answer}.
|
|
149
|
+
*
|
|
150
|
+
* @param {string} totpId - The ID of the TOTP challenge
|
|
151
|
+
* @param {string} code - The TOTP code that should verify against the TOTP configuration from the challenge.
|
|
152
|
+
*/
|
|
153
|
+
userTotpResetComplete(totpId: string, code: string): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Verifies a given TOTP code against the current user's TOTP configuration.
|
|
156
|
+
* Throws an error if the verification fails.
|
|
157
|
+
*
|
|
158
|
+
* @param {string} code Current TOTP code
|
|
159
|
+
*/
|
|
160
|
+
userTotpVerify(code: string): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Delete TOTP from the user's account.
|
|
163
|
+
* Allowed only if at least one FIDO key is registered with the user's account.
|
|
164
|
+
* MFA via FIDO is always required.
|
|
165
|
+
*
|
|
166
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt to include in HTTP headers
|
|
167
|
+
*/
|
|
168
|
+
userTotpDelete(mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<Empty>>;
|
|
169
|
+
/**
|
|
170
|
+
* Initiate adding a new FIDO device. MFA may be required. This returns a {@link AddFidoChallenge}
|
|
171
|
+
* that must be answered with {@link AddFidoChallenge.answer} or {@link userFidoRegisterComplete}
|
|
172
|
+
* (after MFA approvals).
|
|
173
|
+
*
|
|
174
|
+
* @param {string} name The name of the new device.
|
|
175
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt to include in HTTP headers
|
|
176
|
+
* @return {Promise<CubeSignerResponse<AddFidoChallenge>>} A challenge that must be answered in order to complete FIDO registration.
|
|
177
|
+
*/
|
|
178
|
+
userFidoRegisterInit(name: string, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<AddFidoChallenge>>;
|
|
179
|
+
/**
|
|
180
|
+
* Complete a previously initiated (via {@link userFidoRegisterInit}) request to add a new FIDO device.
|
|
181
|
+
*
|
|
182
|
+
* Instead of calling this method directly, prefer {@link AddFidoChallenge.answer} or
|
|
183
|
+
* {@link AddFidoChallenge.createCredentialAndAnswer}.
|
|
184
|
+
*
|
|
185
|
+
* @param {string} challengeId The ID of the challenge returned by the remote end.
|
|
186
|
+
* @param {PublicKeyCredential} credential The answer to the challenge.
|
|
187
|
+
*/
|
|
188
|
+
userFidoRegisterComplete(challengeId: string, credential: PublicKeyCredential): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* Delete a FIDO key from the user's account.
|
|
191
|
+
* Allowed only if TOTP is also defined.
|
|
192
|
+
* MFA via TOTP is always required.
|
|
193
|
+
*
|
|
194
|
+
* @param {string} fidoId The ID of the desired FIDO key
|
|
195
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt to include in HTTP headers
|
|
196
|
+
*/
|
|
197
|
+
userFidoDelete(fidoId: string, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<Empty>>;
|
|
198
|
+
/**
|
|
199
|
+
* Obtain information about the current organization.
|
|
200
|
+
* @return {OrgInfo} Information about the organization.
|
|
201
|
+
*/
|
|
202
|
+
orgGet(): Promise<OrgInfo>;
|
|
203
|
+
/**
|
|
204
|
+
* Update the org.
|
|
205
|
+
* @param {UpdateOrgRequest} request The JSON request to send to the API server.
|
|
206
|
+
* @return {UpdateOrgResponse} Updated org information.
|
|
207
|
+
*/
|
|
208
|
+
orgUpdate(request: UpdateOrgRequest): Promise<UpdateOrgResponse>;
|
|
209
|
+
/**
|
|
210
|
+
* Create a new (first-party) user in the organization and send an email invitation to that user.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} email Email of the user
|
|
213
|
+
* @param {string} name The full name of the user
|
|
214
|
+
* @param {MemberRole} role Optional role. Defaults to "alien".
|
|
215
|
+
*/
|
|
216
|
+
orgUserInvite(email: string, name: string, role?: MemberRole): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* List users.
|
|
219
|
+
* @return {User[]} Org users.
|
|
220
|
+
*/
|
|
221
|
+
orgUsersList(): Promise<UserIdInfo[]>;
|
|
222
|
+
/**
|
|
223
|
+
* Create a new OIDC user. This can be a first-party "Member" or third-party "Alien".
|
|
224
|
+
* @param {OidcIdentity} identity The identity of the OIDC user
|
|
225
|
+
* @param {string} email Email of the OIDC user
|
|
226
|
+
* @param {CreateOidcUserOptions} opts Additional options for new OIDC users
|
|
227
|
+
* @return {string} User id of the new user
|
|
228
|
+
*/
|
|
229
|
+
orgUserCreateOidc(identity: OidcIdentity, email: string, opts?: CreateOidcUserOptions): Promise<string>;
|
|
230
|
+
/**
|
|
231
|
+
* Delete an existing OIDC user.
|
|
232
|
+
* @param {OidcIdentity} identity The identity of the OIDC user
|
|
233
|
+
*/
|
|
234
|
+
orgUserDeleteOidc(identity: OidcIdentity): Promise<{
|
|
235
|
+
status: string;
|
|
236
|
+
}>;
|
|
237
|
+
/**
|
|
238
|
+
* Get a key by its id.
|
|
239
|
+
*
|
|
240
|
+
* @param {string} keyId The id of the key to get.
|
|
241
|
+
* @return {KeyInfoApi} The key information.
|
|
242
|
+
*/
|
|
243
|
+
keyGet(keyId: string): Promise<KeyInfoApi>;
|
|
244
|
+
/**
|
|
245
|
+
* List all roles a key is in.
|
|
246
|
+
*
|
|
247
|
+
* @param {string} keyId The id of the key to get.
|
|
248
|
+
* @param {PageOpts} page Pagination options. Defaults to fetching the entire result set.
|
|
249
|
+
* @return {Paginator<ListKeyRolesResponse, KeyInRoleInfo>} Paginator for iterating over the roles a key is in.
|
|
250
|
+
*/
|
|
251
|
+
keyRolesList(keyId: string, page?: PageOpts): Paginator<ListKeyRolesResponse, KeyInRoleInfo>;
|
|
252
|
+
/**
|
|
253
|
+
* Update key.
|
|
254
|
+
* @param {string} keyId The ID of the key to update.
|
|
255
|
+
* @param {UpdateKeyRequest} request The JSON request to send to the API server.
|
|
256
|
+
* @return {KeyInfoApi} The JSON response from the API server.
|
|
257
|
+
*/
|
|
258
|
+
keyUpdate(keyId: string, request: UpdateKeyRequest): Promise<KeyInfoApi>;
|
|
259
|
+
/**
|
|
260
|
+
* Deletes a key.
|
|
261
|
+
*
|
|
262
|
+
* @param {string} keyId - Key id
|
|
263
|
+
*/
|
|
264
|
+
keyDelete(keyId: string): Promise<void>;
|
|
265
|
+
/**
|
|
266
|
+
* Create new signing keys.
|
|
267
|
+
*
|
|
268
|
+
* @param {KeyType} keyType The type of key to create.
|
|
269
|
+
* @param {number} count The number of keys to create.
|
|
270
|
+
* @param {string?} ownerId The owner of the keys. Defaults to the session's user.
|
|
271
|
+
* @return {KeyInfoApi[]} The new keys.
|
|
272
|
+
*/
|
|
273
|
+
keysCreate(keyType: KeyType, count: number, ownerId?: string): Promise<KeyInfoApi[]>;
|
|
274
|
+
/**
|
|
275
|
+
* Derive a set of keys of a specified type using a supplied derivation path and an existing long-lived mnemonic.
|
|
276
|
+
*
|
|
277
|
+
* The owner of the derived key will be the owner of the mnemonic.
|
|
278
|
+
*
|
|
279
|
+
* @param {KeyType} keyType The type of key to create.
|
|
280
|
+
* @param {string[]} derivationPaths Derivation paths from which to derive new keys.
|
|
281
|
+
* @param {string} mnemonicId materialId of mnemonic key used to derive the new key.
|
|
282
|
+
*
|
|
283
|
+
* @return {KeyInfoApi[]} The newly derived keys.
|
|
284
|
+
*/
|
|
285
|
+
keysDerive(keyType: KeyType, derivationPaths: string[], mnemonicId: string): Promise<KeyInfoApi[]>;
|
|
286
|
+
/**
|
|
287
|
+
* List all keys in the org.
|
|
288
|
+
* @param {KeyType?} type Optional key type to filter list for.
|
|
289
|
+
* @param {PageOpts?} page Pagination options. Defaults to fetching the entire result set.
|
|
290
|
+
* @return {Paginator<ListKeysResponse, KeyInfoApi>} Paginator for iterating over keys.
|
|
291
|
+
*/
|
|
292
|
+
keysList(type?: KeyType, page?: PageOpts): Paginator<ListKeysResponse, KeyInfoApi>;
|
|
293
|
+
/**
|
|
294
|
+
* Create a new role.
|
|
295
|
+
*
|
|
296
|
+
* @param {string?} name The optional name of the role.
|
|
297
|
+
* @return {string} The ID of the new role.
|
|
298
|
+
*/
|
|
299
|
+
roleCreate(name?: string): Promise<string>;
|
|
300
|
+
/**
|
|
301
|
+
* Get a role by its id (or name).
|
|
302
|
+
* @param {string} roleId The id of the role to get.
|
|
303
|
+
* @return {RoleInfo} The role.
|
|
304
|
+
*/
|
|
305
|
+
roleGet(roleId: string): Promise<RoleInfo>;
|
|
306
|
+
/**
|
|
307
|
+
* Update a role.
|
|
308
|
+
*
|
|
309
|
+
* @param {string} roleId The ID of the role to update.
|
|
310
|
+
* @param {UpdateRoleRequest} request The update request.
|
|
311
|
+
* @return {Promise<RoleInfo>} The updated role information.
|
|
312
|
+
*/
|
|
313
|
+
roleUpdate(roleId: string, request: UpdateRoleRequest): Promise<RoleInfo>;
|
|
314
|
+
/**
|
|
315
|
+
* Delete a role by its ID.
|
|
316
|
+
*
|
|
317
|
+
* @param {string} roleId The ID of the role to delete.
|
|
318
|
+
*/
|
|
319
|
+
roleDelete(roleId: string): Promise<void>;
|
|
320
|
+
/**
|
|
321
|
+
* List all roles in the org.
|
|
322
|
+
*
|
|
323
|
+
* @param {PageOpts} page Pagination options. Defaults to fetching the entire result set.
|
|
324
|
+
* @return {RoleInfo} Paginator for iterating over roles.
|
|
325
|
+
*/
|
|
326
|
+
rolesList(page?: PageOpts): Paginator<ListRolesResponse, RoleInfo>;
|
|
327
|
+
/**
|
|
328
|
+
* Add existing keys to an existing role.
|
|
329
|
+
*
|
|
330
|
+
* @param {string} roleId The ID of the role
|
|
331
|
+
* @param {string[]} keyIds The IDs of the keys to add to the role.
|
|
332
|
+
* @param {KeyPolicy?} policy The optional policy to apply to each key.
|
|
333
|
+
*/
|
|
334
|
+
roleKeysAdd(roleId: string, keyIds: string[], policy?: KeyPolicy): Promise<void>;
|
|
335
|
+
/**
|
|
336
|
+
* Remove an existing key from an existing role.
|
|
337
|
+
*
|
|
338
|
+
* @param {string} roleId The ID of the role
|
|
339
|
+
* @param {string} keyId The ID of the key to remove from the role
|
|
340
|
+
*/
|
|
341
|
+
roleKeysRemove(roleId: string, keyId: string): Promise<void>;
|
|
342
|
+
/**
|
|
343
|
+
* List all keys in a role.
|
|
344
|
+
*
|
|
345
|
+
* @param {string} roleId The ID of the role whose keys to retrieve.
|
|
346
|
+
* @param {PageOpts} page Pagination options. Defaults to fetching the entire result set.
|
|
347
|
+
* @return {Paginator<ListRoleKeysResponse, KeyInRoleInfo>} Paginator for iterating over the keys in the role.
|
|
348
|
+
*/
|
|
349
|
+
roleKeysList(roleId: string, page?: PageOpts): Paginator<ListRoleKeysResponse, KeyInRoleInfo>;
|
|
350
|
+
/**
|
|
351
|
+
* Add an existing user to an existing role.
|
|
352
|
+
*
|
|
353
|
+
* @param {string} roleId The ID of the role.
|
|
354
|
+
* @param {string} userId The ID of the user to add to the role.
|
|
355
|
+
*/
|
|
356
|
+
roleUserAdd(roleId: string, userId: string): Promise<void>;
|
|
357
|
+
/**
|
|
358
|
+
* Remove an existing user from an existing role.
|
|
359
|
+
*
|
|
360
|
+
* @param {string} roleId The ID of the role.
|
|
361
|
+
* @param {string} userId The ID of the user to remove from the role.
|
|
362
|
+
*/
|
|
363
|
+
roleUserRemove(roleId: string, userId: string): Promise<void>;
|
|
364
|
+
/**
|
|
365
|
+
* List all users in a role.
|
|
366
|
+
*
|
|
367
|
+
* @param {string} roleId The ID of the role whose users to retrieve.
|
|
368
|
+
* @param {PageOpts} page Pagination options. Defaults to fetching the entire result set.
|
|
369
|
+
* @return {Paginator<ListRoleUsersResponse, UserInRoleInfo>} Paginator for iterating over the users in the role.
|
|
370
|
+
*/
|
|
371
|
+
roleUsersList(roleId: string, page?: PageOpts): Paginator<ListRoleUsersResponse, UserInRoleInfo>;
|
|
372
|
+
/**
|
|
373
|
+
* Create new user session (management and/or signing)
|
|
374
|
+
*
|
|
375
|
+
* @param {string} purpose The purpose of the session
|
|
376
|
+
* @param {string[]} scopes Session scopes.
|
|
377
|
+
* @param {SignerSessionLifetime} lifetimes Lifetime settings
|
|
378
|
+
* @return {Promise<SignerSessionData>} New signer session info.
|
|
379
|
+
*/
|
|
380
|
+
sessionCreate(purpose: string, scopes: string[], lifetimes?: SignerSessionLifetime): Promise<SignerSessionData>;
|
|
381
|
+
/**
|
|
382
|
+
* Create a new signer session for a given role.
|
|
383
|
+
*
|
|
384
|
+
* @param {string} roleId Role ID
|
|
385
|
+
* @param {string} purpose The purpose of the session
|
|
386
|
+
* @param {string[]} scopes Session scopes. Only `sign:*` scopes are allowed.
|
|
387
|
+
* @param {SignerSessionLifetime} lifetimes Lifetime settings
|
|
388
|
+
* @return {Promise<SignerSessionData>} New signer session info.
|
|
389
|
+
*/
|
|
390
|
+
sessionCreateForRole(roleId: string, purpose: string, scopes?: string[], lifetimes?: SignerSessionLifetime): Promise<SignerSessionData>;
|
|
391
|
+
/**
|
|
392
|
+
* Revoke a session.
|
|
393
|
+
*
|
|
394
|
+
* @param {string} sessionId The ID of the session to revoke.
|
|
395
|
+
*/
|
|
396
|
+
sessionRevoke(sessionId: string): Promise<void>;
|
|
397
|
+
/**
|
|
398
|
+
* Returns a paginator for iterating over all signer sessions optionally filtered by a role.
|
|
399
|
+
*
|
|
400
|
+
* @param {string?} roleId If set, limit to sessions for this role only.
|
|
401
|
+
* @param {PageOpts?} page Pagination options. Defaults to fetching the entire result set.
|
|
402
|
+
* @return {Promise<SignerSessionInfo[]>} Signer sessions for this role.
|
|
403
|
+
*/
|
|
404
|
+
sessionsList(roleId?: string, page?: PageOpts): Paginator<SessionsResponse, SessionInfo>;
|
|
405
|
+
/**
|
|
406
|
+
* Returns the list of keys that this session has access to.
|
|
407
|
+
* @return {Key[]} The list of keys.
|
|
408
|
+
*/
|
|
409
|
+
sessionKeysList(): Promise<KeyInfoApi[]>;
|
|
410
|
+
/**
|
|
411
|
+
* Obtain proof of authentication using the current CubeSigner session.
|
|
412
|
+
*
|
|
413
|
+
* @return {Promise<IdentityProof>} Proof of authentication
|
|
414
|
+
*/
|
|
415
|
+
identityProve(): Promise<IdentityProof>;
|
|
416
|
+
/**
|
|
417
|
+
* Checks if a given identity proof is valid.
|
|
418
|
+
*
|
|
419
|
+
* @param {IdentityProof} proof The proof of authentication.
|
|
420
|
+
*/
|
|
421
|
+
identityVerify(proof: IdentityProof): Promise<void>;
|
|
422
|
+
/**
|
|
423
|
+
* Retrieves existing MFA request.
|
|
424
|
+
*
|
|
425
|
+
* @param {string} mfaId MFA request ID
|
|
426
|
+
* @return {Promise<MfaRequestInfo>} MFA request information
|
|
427
|
+
*/
|
|
428
|
+
mfaGet(mfaId: string): Promise<MfaRequestInfo>;
|
|
429
|
+
/**
|
|
430
|
+
* List pending MFA requests accessible to the current user.
|
|
431
|
+
*
|
|
432
|
+
* @return {Promise<MfaRequestInfo[]>} The MFA requests.
|
|
433
|
+
*/
|
|
434
|
+
mfaList(): Promise<MfaRequestInfo[]>;
|
|
435
|
+
/**
|
|
436
|
+
* Approve or reject a pending MFA request using the current session.
|
|
437
|
+
*
|
|
438
|
+
* @param {string} mfaId The id of the MFA request
|
|
439
|
+
* @param {MfaVote} mfaVote Approve or reject the MFA request
|
|
440
|
+
* @return {Promise<MfaRequestInfo>} The result of the MFA request
|
|
441
|
+
*/
|
|
442
|
+
mfaVoteCs(mfaId: string, mfaVote: MfaVote): Promise<MfaRequestInfo>;
|
|
443
|
+
/**
|
|
444
|
+
* Approve or reject a pending MFA request using TOTP.
|
|
445
|
+
*
|
|
446
|
+
* @param {string} mfaId The ID of the MFA request
|
|
447
|
+
* @param {string} code The TOTP code
|
|
448
|
+
* @param {MfaVote} mfaVote Approve or reject the MFA request
|
|
449
|
+
* @return {Promise<MfaRequestInfo>} The current status of the MFA request
|
|
450
|
+
*/
|
|
451
|
+
mfaVoteTotp(mfaId: string, code: string, mfaVote: MfaVote): Promise<MfaRequestInfo>;
|
|
452
|
+
/**
|
|
453
|
+
* Initiate approval of an existing MFA request using FIDO. A challenge is
|
|
454
|
+
* returned which must be answered via {@link MfaFidoChallenge.answer} or {@link mfaApproveFidoComplete}.
|
|
455
|
+
*
|
|
456
|
+
* @param {string} mfaId The MFA request ID.
|
|
457
|
+
* @return {Promise<MfaFidoChallenge>} A challenge that needs to be answered to complete the approval.
|
|
458
|
+
*/
|
|
459
|
+
mfaFidoInit(mfaId: string): Promise<MfaFidoChallenge>;
|
|
460
|
+
/**
|
|
461
|
+
* Complete a previously initiated (via {@link mfaApproveFidoInit}) MFA request using FIDO.
|
|
462
|
+
*
|
|
463
|
+
* Instead of calling this method directly, prefer {@link MfaFidoChallenge.answer} or
|
|
464
|
+
* {@link MfaFidoChallenge.createCredentialAndAnswer}.
|
|
465
|
+
*
|
|
466
|
+
* @param {string} mfaId The MFA request ID
|
|
467
|
+
* @param {MfaVote} mfaVote Approve or reject the MFA request
|
|
468
|
+
* @param {string} challengeId The ID of the challenge issued by {@link mfaApproveFidoInit}
|
|
469
|
+
* @param {PublicKeyCredential} credential The answer to the challenge
|
|
470
|
+
* @return {Promise<MfaRequestInfo>} The current status of the MFA request.
|
|
471
|
+
*/
|
|
472
|
+
mfaVoteFidoComplete(mfaId: string, mfaVote: MfaVote, challengeId: string, credential: PublicKeyCredential): Promise<MfaRequestInfo>;
|
|
473
|
+
/**
|
|
474
|
+
* Sign an EVM transaction.
|
|
475
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
476
|
+
* @param {EvmSignRequest} req What to sign.
|
|
477
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt.
|
|
478
|
+
* @return {Promise<EvmSignResponse | AcceptedResponse>} Signature (or MFA approval request).
|
|
479
|
+
*/
|
|
480
|
+
signEvm(key: Key | string, req: EvmSignRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<EvmSignResponse>>;
|
|
481
|
+
/**
|
|
482
|
+
* Sign EIP-191 typed data.
|
|
483
|
+
*
|
|
484
|
+
* This requires the key to have a '"AllowEip191Signing"' {@link KeyPolicy}.
|
|
485
|
+
*
|
|
486
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
487
|
+
* @param {BlobSignRequest} req What to sign
|
|
488
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
489
|
+
* @return {Promise<EvmSignResponse | AcceptedResponse>} Signature (or MFA approval request).
|
|
490
|
+
*/
|
|
491
|
+
signEip191(key: Key | string, req: Eip191SignRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<Eip191Or712SignResponse>>;
|
|
492
|
+
/**
|
|
493
|
+
* Sign EIP-712 typed data.
|
|
494
|
+
*
|
|
495
|
+
* This requires the key to have a '"AllowEip712Signing"' {@link KeyPolicy}.
|
|
496
|
+
*
|
|
497
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
498
|
+
* @param {BlobSignRequest} req What to sign
|
|
499
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
500
|
+
* @return {Promise<EvmSignResponse | AcceptedResponse>} Signature (or MFA approval request).
|
|
501
|
+
*/
|
|
502
|
+
signEip712(key: Key | string, req: Eip712SignRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<Eip191Or712SignResponse>>;
|
|
503
|
+
/**
|
|
504
|
+
* Sign an Eth2/Beacon-chain validation message.
|
|
505
|
+
*
|
|
506
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
507
|
+
* @param {Eth2SignRequest} req What to sign.
|
|
508
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
509
|
+
* @return {Promise<Eth2SignResponse | AcceptedResponse>} Signature
|
|
510
|
+
*/
|
|
511
|
+
signEth2(key: Key | string, req: Eth2SignRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<Eth2SignResponse>>;
|
|
512
|
+
/**
|
|
513
|
+
* Sign an Eth2/Beacon-chain deposit (or staking) message.
|
|
514
|
+
*
|
|
515
|
+
* @param {Eth2StakeRequest} req The request to sign.
|
|
516
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
517
|
+
* @return {Promise<Eth2StakeResponse | AcceptedResponse>} The response.
|
|
518
|
+
*/
|
|
519
|
+
signStake(req: Eth2StakeRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<Eth2StakeResponse>>;
|
|
520
|
+
/**
|
|
521
|
+
* Sign an Eth2/Beacon-chain unstake/exit request.
|
|
522
|
+
*
|
|
523
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
524
|
+
* @param {Eth2UnstakeRequest} req The request to sign.
|
|
525
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
526
|
+
* @return {Promise<Eth2UnstakeResponse | AcceptedResponse>} The response.
|
|
527
|
+
*/
|
|
528
|
+
signUnstake(key: Key | string, req: Eth2UnstakeRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<Eth2UnstakeResponse>>;
|
|
529
|
+
/**
|
|
530
|
+
* Sign an Avalanche P- or X-chain message.
|
|
531
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
532
|
+
* @param {AvaTx} tx Avalanche message (transaction) to sign
|
|
533
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
534
|
+
* @return {Promise<AvaSignResponse | AcceptedResponse>} The response.
|
|
535
|
+
*/
|
|
536
|
+
signAva(key: Key | string, tx: AvaTx, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<AvaSignResponse>>;
|
|
537
|
+
/**
|
|
538
|
+
* Sign a raw blob.
|
|
539
|
+
*
|
|
540
|
+
* This requires the key to have a '"AllowRawBlobSigning"' {@link KeyPolicy}. This is because
|
|
541
|
+
* signing arbitrary messages is, in general, dangerous (and you should instead
|
|
542
|
+
* prefer typed end-points as used by, for example, {@link signEvm}). For Secp256k1 keys,
|
|
543
|
+
* for example, you **must** call this function with a message that is 32 bytes long and
|
|
544
|
+
* the output of a secure hash function.
|
|
545
|
+
*
|
|
546
|
+
* This function returns signatures serialized as;
|
|
547
|
+
*
|
|
548
|
+
* - ECDSA signatures are serialized as big-endian r and s plus recovery-id
|
|
549
|
+
* byte v, which can in general take any of the values 0, 1, 2, or 3.
|
|
550
|
+
*
|
|
551
|
+
* - EdDSA signatures are serialized in the standard format.
|
|
552
|
+
*
|
|
553
|
+
* - BLS signatures are not supported on the blob-sign endpoint.
|
|
554
|
+
*
|
|
555
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its ID).
|
|
556
|
+
* @param {BlobSignRequest} req What to sign
|
|
557
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
558
|
+
* @return {Promise<BlobSignResponse | AcceptedResponse>} The response.
|
|
559
|
+
*/
|
|
560
|
+
signBlob(key: Key | string, req: BlobSignRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<BlobSignResponse>>;
|
|
561
|
+
/**
|
|
562
|
+
* Sign a Bitcoin message.
|
|
563
|
+
*
|
|
564
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
565
|
+
* @param {BtcSignRequest} req What to sign
|
|
566
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
567
|
+
* @return {Promise<BtcSignResponse | AcceptedResponse>} The response.
|
|
568
|
+
*/
|
|
569
|
+
signBtc(key: Key | string, req: BtcSignRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<BtcSignResponse>>;
|
|
570
|
+
/**
|
|
571
|
+
* Sign a Solana message.
|
|
572
|
+
*
|
|
573
|
+
* @param {Key | string} key The key to sign with (either {@link Key} or its material ID).
|
|
574
|
+
* @param {SolanaSignRequest} req What to sign
|
|
575
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt
|
|
576
|
+
* @return {Promise<SolanaSignResponse | AcceptedResponse>} The response.
|
|
577
|
+
*/
|
|
578
|
+
signSolana(key: Key | string, req: SolanaSignRequest, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<SolanaSignResponse>>;
|
|
579
|
+
/**
|
|
580
|
+
* List outstanding user-export requests.
|
|
581
|
+
*
|
|
582
|
+
* @param {string?} keyId Optional key ID. If supplied, list the outstanding request (if any) only for the specified key; otherwise, list all outstanding requests for the specified user.
|
|
583
|
+
* @param {string?} userId Optional user ID. If omtted, uses the current user's ID. Only org owners can list user-export requests for users other than themselves.
|
|
584
|
+
* @param {PageOpts?} page Pagination options. Defaults to fetching the entire result set.
|
|
585
|
+
* @return {Paginator<UserExportListResponse, UserExportInitResponse>} Paginator for iterating over the result set.
|
|
586
|
+
*/
|
|
587
|
+
userExportList(keyId?: string, userId?: string, page?: PageOpts): Paginator<UserExportListResponse, UserExportInitResponse>;
|
|
588
|
+
/**
|
|
589
|
+
* Delete an outstanding user-export request.
|
|
590
|
+
*
|
|
591
|
+
* @param {string} keyId The key-id corresponding to the user-export request to delete.
|
|
592
|
+
* @param {string?} userId Optional user ID. If omitted, uses the current user's ID. Only org owners can delete user-export requests for users other than themselves.
|
|
593
|
+
*/
|
|
594
|
+
userExportDelete(keyId: string, userId?: string): Promise<void>;
|
|
595
|
+
/**
|
|
596
|
+
* Initiate a user-export request.
|
|
597
|
+
*
|
|
598
|
+
* @param {string} keyId The key-id for which to initiate an export.
|
|
599
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt.
|
|
600
|
+
* @return {Promise<UserExportInitResponse | AcceptedResponse>} The response.
|
|
601
|
+
*/
|
|
602
|
+
userExportInit(keyId: string, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<UserExportInitResponse>>;
|
|
603
|
+
/**
|
|
604
|
+
* Complete a user-export request.
|
|
605
|
+
*
|
|
606
|
+
* @param {string} keyId The key-id for which to initiate an export.
|
|
607
|
+
* @param {CryptoKey} publicKey The NIST P-256 public key to which the export will be encrypted. This should be the `publicKey` property of a value returned by `userExportKeygen`.
|
|
608
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt.
|
|
609
|
+
* @return {Promise<UserExportCompleteResponse | AcceptedResponse>} The response.
|
|
610
|
+
*/
|
|
611
|
+
userExportComplete(keyId: string, publicKey: CryptoKey, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<UserExportCompleteResponse>>;
|
|
612
|
+
/**
|
|
613
|
+
* Send a heartbeat / upcheck request.
|
|
614
|
+
*
|
|
615
|
+
* @return { Promise<void> } The response.
|
|
616
|
+
*/
|
|
617
|
+
heartbeat(): Promise<void>;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Client to use to send requests to CubeSigner services
|
|
621
|
+
* when authenticating using an OIDC token.
|
|
622
|
+
*/
|
|
623
|
+
export declare class OidcClient {
|
|
624
|
+
#private;
|
|
625
|
+
/**
|
|
626
|
+
* @param {EnvInterface} env CubeSigner deployment
|
|
627
|
+
* @param {string} orgId Target organization ID
|
|
628
|
+
* @param {string} oidcToken User's OIDC token
|
|
629
|
+
*/
|
|
630
|
+
constructor(env: EnvInterface, orgId: string, oidcToken: string);
|
|
631
|
+
/**
|
|
632
|
+
* HTTP client restricted to a single operation.
|
|
633
|
+
*
|
|
634
|
+
* @param {Op} op The operation to restrict the client to
|
|
635
|
+
* @return {OpClient<Op>} The client restricted to {@link op}
|
|
636
|
+
*/
|
|
637
|
+
private client;
|
|
638
|
+
/**
|
|
639
|
+
* Exchange an OIDC token for a CubeSigner session token.
|
|
640
|
+
* @param {List<string>} scopes The scopes for the new session
|
|
641
|
+
* @param {RatchetConfig} lifetimes Lifetimes of the new session.
|
|
642
|
+
* @param {MfaReceipt} mfaReceipt Optional MFA receipt (id + confirmation code)
|
|
643
|
+
* @return {Promise<CubeSignerResponse<SignerSessionData>>} The session data.
|
|
644
|
+
*/
|
|
645
|
+
sessionCreate(scopes: Array<string>, lifetimes?: RatchetConfig, mfaReceipt?: MfaReceipt): Promise<CubeSignerResponse<SignerSessionData>>;
|
|
646
|
+
/**
|
|
647
|
+
* Exchange an OIDC token for a proof of authentication.
|
|
648
|
+
*
|
|
649
|
+
* @return {Promise<IdentityProof>} Proof of authentication
|
|
650
|
+
*/
|
|
651
|
+
identityProve(): Promise<IdentityProof>;
|
|
652
|
+
}
|