@cubist-labs/cubesigner-sdk 0.4.239 → 0.4.241
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 +26 -13
- package/dist/src/client/api_client.d.ts.map +1 -1
- package/dist/src/client/api_client.js +43 -29
- package/dist/src/client/base_client.d.ts +7 -0
- package/dist/src/client/base_client.d.ts.map +1 -1
- package/dist/src/client/base_client.js +14 -6
- package/dist/src/client.d.ts +24 -32
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +21 -29
- package/package.json +1 -1
- package/src/client/api_client.ts +52 -18
- package/src/client/base_client.ts +21 -8
- package/src/client.ts +23 -57
package/src/client/api_client.ts
CHANGED
|
@@ -160,13 +160,19 @@ import {
|
|
|
160
160
|
type BucketInfo,
|
|
161
161
|
} from "../index";
|
|
162
162
|
import { assertOk, op, type Op, type Operation, apiFetch } from "../fetch";
|
|
163
|
-
import {
|
|
163
|
+
import {
|
|
164
|
+
authHeader,
|
|
165
|
+
BaseClient,
|
|
166
|
+
type ClientConfig,
|
|
167
|
+
signerSessionFromSessionInfo,
|
|
168
|
+
} from "./base_client";
|
|
164
169
|
import { retryOn5XX } from "../retry";
|
|
165
170
|
import { PasskeyLoginChallenge } from "../passkey";
|
|
166
171
|
|
|
167
172
|
// these types are used in doc comments only
|
|
168
173
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
169
174
|
import type { RoleAttestationClaims, KeyAttestationClaims } from "../schema_types";
|
|
175
|
+
import { mergeHeaders } from "openapi-fetch";
|
|
170
176
|
|
|
171
177
|
/**
|
|
172
178
|
* String returned by API when a user does not have an email address (for backwards compatibility)
|
|
@@ -217,10 +223,7 @@ export class ApiClient extends BaseClient {
|
|
|
217
223
|
return new ApiClient(this.sessionMeta, this.sessionManager, this.orgId, {
|
|
218
224
|
...this.config,
|
|
219
225
|
...cfg,
|
|
220
|
-
headers:
|
|
221
|
-
...(this.config.headers ?? {}),
|
|
222
|
-
...(cfg.headers ?? {}),
|
|
223
|
-
},
|
|
226
|
+
headers: mergeHeaders(this.config.headers, cfg.headers),
|
|
224
227
|
});
|
|
225
228
|
}
|
|
226
229
|
|
|
@@ -258,12 +261,14 @@ export class ApiClient extends BaseClient {
|
|
|
258
261
|
* @param env The environment to use
|
|
259
262
|
* @param orgId The org to login to
|
|
260
263
|
* @param email The email to send the signature to
|
|
264
|
+
* @param headers Optional headers to set
|
|
261
265
|
* @returns The partial OIDC token that must be combined with the signature in the email
|
|
262
266
|
*/
|
|
263
267
|
static async initEmailOtpAuth(
|
|
264
268
|
env: EnvInterface,
|
|
265
269
|
orgId: string,
|
|
266
270
|
email: string,
|
|
271
|
+
headers?: HeadersInit,
|
|
267
272
|
): Promise<EmailOtpResponse> {
|
|
268
273
|
const o = op("/v0/org/{org_id}/oidc/email-otp", "post");
|
|
269
274
|
|
|
@@ -272,6 +277,7 @@ export class ApiClient extends BaseClient {
|
|
|
272
277
|
baseUrl: env.SignerApiRoot,
|
|
273
278
|
params: { path: { org_id: orgId } },
|
|
274
279
|
body: { email },
|
|
280
|
+
headers,
|
|
275
281
|
}),
|
|
276
282
|
).then(assertOk);
|
|
277
283
|
}
|
|
@@ -2934,14 +2940,16 @@ export class ApiClient extends BaseClient {
|
|
|
2934
2940
|
*
|
|
2935
2941
|
* @param env The environment to use
|
|
2936
2942
|
* @param email The user's email
|
|
2943
|
+
* @param headers Optional headers to set
|
|
2937
2944
|
* @returns Empty response
|
|
2938
2945
|
*/
|
|
2939
|
-
static async emailMyOrgs(env: EnvInterface, email: string) {
|
|
2946
|
+
static async emailMyOrgs(env: EnvInterface, email: string, headers?: HeadersInit) {
|
|
2940
2947
|
const o = op("/v0/email/orgs", "get");
|
|
2941
2948
|
return await retryOn5XX(() =>
|
|
2942
2949
|
o({
|
|
2943
2950
|
baseUrl: env.SignerApiRoot,
|
|
2944
2951
|
params: { query: { email } },
|
|
2952
|
+
headers,
|
|
2945
2953
|
}),
|
|
2946
2954
|
).then(assertOk);
|
|
2947
2955
|
}
|
|
@@ -2956,6 +2964,7 @@ export class ApiClient extends BaseClient {
|
|
|
2956
2964
|
* @param lifetimes Lifetimes of the new session.
|
|
2957
2965
|
* @param mfaReceipt Optional MFA receipt(s)
|
|
2958
2966
|
* @param purpose Optional session description.
|
|
2967
|
+
* @param headers Additional headers to set
|
|
2959
2968
|
* @returns The session data.
|
|
2960
2969
|
*/
|
|
2961
2970
|
static async oidcSessionCreate(
|
|
@@ -2966,18 +2975,16 @@ export class ApiClient extends BaseClient {
|
|
|
2966
2975
|
lifetimes?: RatchetConfig,
|
|
2967
2976
|
mfaReceipt?: MfaReceipts,
|
|
2968
2977
|
purpose?: string,
|
|
2978
|
+
headers?: HeadersInit,
|
|
2969
2979
|
): Promise<CubeSignerResponse<SessionData>> {
|
|
2970
2980
|
const o = op("/v0/org/{org_id}/oidc", "post");
|
|
2971
2981
|
|
|
2972
|
-
const loginFn = async (
|
|
2982
|
+
const loginFn = async (mfaHeaders?: HeadersInit) => {
|
|
2973
2983
|
const data = await retryOn5XX(() =>
|
|
2974
2984
|
o({
|
|
2975
2985
|
baseUrl: env.SignerApiRoot,
|
|
2976
2986
|
params: { path: { org_id: orgId } },
|
|
2977
|
-
headers:
|
|
2978
|
-
...headers,
|
|
2979
|
-
Authorization: token,
|
|
2980
|
-
},
|
|
2987
|
+
headers: mergeHeaders(headers, mfaHeaders, authHeader(token)),
|
|
2981
2988
|
body: {
|
|
2982
2989
|
scopes,
|
|
2983
2990
|
purpose,
|
|
@@ -3013,12 +3020,14 @@ export class ApiClient extends BaseClient {
|
|
|
3013
3020
|
* @param env The environment to use
|
|
3014
3021
|
* @param orgId The org to login to
|
|
3015
3022
|
* @param body The request body
|
|
3023
|
+
* @param headers Optional headers to set
|
|
3016
3024
|
* @returns The challenge that needs to be answered via {@link siweLoginComplete}
|
|
3017
3025
|
*/
|
|
3018
3026
|
static async siweLoginInit(
|
|
3019
3027
|
env: EnvInterface,
|
|
3020
3028
|
orgId: string,
|
|
3021
3029
|
body: schemas["SiweInitRequest"],
|
|
3030
|
+
headers?: HeadersInit,
|
|
3022
3031
|
): Promise<schemas["SiweInitResponse"]> {
|
|
3023
3032
|
const o = op("/v0/org/{org_id}/oidc/siwe", "post");
|
|
3024
3033
|
return await retryOn5XX(() =>
|
|
@@ -3026,6 +3035,7 @@ export class ApiClient extends BaseClient {
|
|
|
3026
3035
|
baseUrl: env.SignerApiRoot,
|
|
3027
3036
|
params: { path: { org_id: orgId } },
|
|
3028
3037
|
body,
|
|
3038
|
+
headers,
|
|
3029
3039
|
}),
|
|
3030
3040
|
).then(assertOk);
|
|
3031
3041
|
}
|
|
@@ -3040,12 +3050,14 @@ export class ApiClient extends BaseClient {
|
|
|
3040
3050
|
* @param env The environment to use
|
|
3041
3051
|
* @param orgId The org to login to
|
|
3042
3052
|
* @param body The request body
|
|
3053
|
+
* @param headers Optional headers to set
|
|
3043
3054
|
* @returns An OIDC token which can be used to log in via OIDC (see {@link oidcSessionCreate})
|
|
3044
3055
|
*/
|
|
3045
3056
|
static async siweLoginComplete(
|
|
3046
3057
|
env: EnvInterface,
|
|
3047
3058
|
orgId: string,
|
|
3048
3059
|
body: schemas["SiweCompleteRequest"],
|
|
3060
|
+
headers?: HeadersInit,
|
|
3049
3061
|
): Promise<schemas["SiweCompleteResponse"]> {
|
|
3050
3062
|
const o = op("/v0/org/{org_id}/oidc/siwe", "patch");
|
|
3051
3063
|
return await retryOn5XX(() =>
|
|
@@ -3053,6 +3065,7 @@ export class ApiClient extends BaseClient {
|
|
|
3053
3065
|
baseUrl: env.SignerApiRoot,
|
|
3054
3066
|
params: { path: { org_id: orgId } },
|
|
3055
3067
|
body,
|
|
3068
|
+
headers,
|
|
3056
3069
|
}),
|
|
3057
3070
|
).then(assertOk);
|
|
3058
3071
|
}
|
|
@@ -3062,17 +3075,20 @@ export class ApiClient extends BaseClient {
|
|
|
3062
3075
|
*
|
|
3063
3076
|
* @param env The environment to log into
|
|
3064
3077
|
* @param body The login request
|
|
3078
|
+
* @param headers Optional headers to set
|
|
3065
3079
|
* @returns The challenge that must be answered (see {@link passkeyLoginComplete}) to log in.
|
|
3066
3080
|
*/
|
|
3067
3081
|
static async passkeyLoginInit(
|
|
3068
3082
|
env: EnvInterface,
|
|
3069
3083
|
body: LoginRequest,
|
|
3084
|
+
headers?: HeadersInit,
|
|
3070
3085
|
): Promise<PasskeyLoginChallenge> {
|
|
3071
3086
|
const o = op("/v0/passkey", "post");
|
|
3072
3087
|
const resp = await retryOn5XX(() =>
|
|
3073
3088
|
o({
|
|
3074
3089
|
baseUrl: env.SignerApiRoot,
|
|
3075
3090
|
body,
|
|
3091
|
+
headers,
|
|
3076
3092
|
}),
|
|
3077
3093
|
).then(assertOk);
|
|
3078
3094
|
return new PasskeyLoginChallenge(env, resp, body.purpose);
|
|
@@ -3084,18 +3100,21 @@ export class ApiClient extends BaseClient {
|
|
|
3084
3100
|
* @param env The environment to log into
|
|
3085
3101
|
* @param body The request body
|
|
3086
3102
|
* @param purpose Optional descriptive session purpose
|
|
3103
|
+
* @param headers Optional headers to set
|
|
3087
3104
|
* @returns The session data
|
|
3088
3105
|
*/
|
|
3089
3106
|
static async passkeyLoginComplete(
|
|
3090
3107
|
env: EnvInterface,
|
|
3091
3108
|
body: PasskeyAssertAnswer,
|
|
3092
3109
|
purpose?: string | null,
|
|
3110
|
+
headers?: HeadersInit,
|
|
3093
3111
|
): Promise<SessionData> {
|
|
3094
3112
|
const o = op("/v0/passkey", "patch");
|
|
3095
3113
|
const resp = await retryOn5XX(() =>
|
|
3096
3114
|
o({
|
|
3097
3115
|
baseUrl: env.SignerApiRoot,
|
|
3098
3116
|
body,
|
|
3117
|
+
headers,
|
|
3099
3118
|
}),
|
|
3100
3119
|
).then(assertOk);
|
|
3101
3120
|
return {
|
|
@@ -3117,11 +3136,13 @@ export class ApiClient extends BaseClient {
|
|
|
3117
3136
|
* @param env The environment to log into
|
|
3118
3137
|
* @param orgId The id of the organization
|
|
3119
3138
|
* @param body The request body
|
|
3139
|
+
* @param headers Optional headers to set
|
|
3120
3140
|
*/
|
|
3121
3141
|
static async idpAcceptInvite(
|
|
3122
3142
|
env: EnvInterface,
|
|
3123
3143
|
orgId: string,
|
|
3124
3144
|
body: InvitationAcceptRequest,
|
|
3145
|
+
headers?: HeadersInit,
|
|
3125
3146
|
): Promise<void> {
|
|
3126
3147
|
const o = op("/v0/org/{org_id}/invitation/accept", "post");
|
|
3127
3148
|
await retryOn5XX(() =>
|
|
@@ -3129,6 +3150,7 @@ export class ApiClient extends BaseClient {
|
|
|
3129
3150
|
baseUrl: env.SignerApiRoot,
|
|
3130
3151
|
params: { path: { org_id: orgId } },
|
|
3131
3152
|
body,
|
|
3153
|
+
headers,
|
|
3132
3154
|
}),
|
|
3133
3155
|
).then(assertOk);
|
|
3134
3156
|
}
|
|
@@ -3139,6 +3161,7 @@ export class ApiClient extends BaseClient {
|
|
|
3139
3161
|
* @param env The environment to log into
|
|
3140
3162
|
* @param orgId The id of the organization
|
|
3141
3163
|
* @param body The request body
|
|
3164
|
+
* @param headers Optional headers to set
|
|
3142
3165
|
* @returns Returns an OIDC token which can be used
|
|
3143
3166
|
* to log in via OIDC (see {@link oidcSessionCreate}).
|
|
3144
3167
|
*/
|
|
@@ -3146,6 +3169,7 @@ export class ApiClient extends BaseClient {
|
|
|
3146
3169
|
env: EnvInterface,
|
|
3147
3170
|
orgId: string,
|
|
3148
3171
|
body: AuthenticationRequest,
|
|
3172
|
+
headers?: HeadersInit,
|
|
3149
3173
|
): Promise<AuthenticationResponse> {
|
|
3150
3174
|
const o = op("/v0/org/{org_id}/idp/authenticate", "post");
|
|
3151
3175
|
return retryOn5XX(() =>
|
|
@@ -3153,6 +3177,7 @@ export class ApiClient extends BaseClient {
|
|
|
3153
3177
|
baseUrl: env.SignerApiRoot,
|
|
3154
3178
|
params: { path: { org_id: orgId } },
|
|
3155
3179
|
body,
|
|
3180
|
+
headers,
|
|
3156
3181
|
}),
|
|
3157
3182
|
).then(assertOk);
|
|
3158
3183
|
}
|
|
@@ -3163,12 +3188,14 @@ export class ApiClient extends BaseClient {
|
|
|
3163
3188
|
* @param env The environment to log into
|
|
3164
3189
|
* @param orgId The id of the organization
|
|
3165
3190
|
* @param body The request body
|
|
3191
|
+
* @param headers Optional headers to set
|
|
3166
3192
|
* @returns Returns the partial token (`${header}.${claims}.`) while the signature is sent via email.
|
|
3167
3193
|
*/
|
|
3168
3194
|
static async idpPasswordResetRequest(
|
|
3169
3195
|
env: EnvInterface,
|
|
3170
3196
|
orgId: string,
|
|
3171
3197
|
body: PasswordResetRequest,
|
|
3198
|
+
headers?: HeadersInit,
|
|
3172
3199
|
): Promise<EmailOtpResponse> {
|
|
3173
3200
|
const o = op("/v0/org/{org_id}/idp/password_reset", "post");
|
|
3174
3201
|
return retryOn5XX(() =>
|
|
@@ -3176,6 +3203,7 @@ export class ApiClient extends BaseClient {
|
|
|
3176
3203
|
baseUrl: env.SignerApiRoot,
|
|
3177
3204
|
params: { path: { org_id: orgId } },
|
|
3178
3205
|
body,
|
|
3206
|
+
headers,
|
|
3179
3207
|
}),
|
|
3180
3208
|
).then(assertOk);
|
|
3181
3209
|
}
|
|
@@ -3188,6 +3216,7 @@ export class ApiClient extends BaseClient {
|
|
|
3188
3216
|
* @param partialToken The partial token returned by {@link passwordResetRequest}
|
|
3189
3217
|
* @param signature The one-time code (signature in this case) sent via email
|
|
3190
3218
|
* @param newPassword The new password
|
|
3219
|
+
* @param headers Optional headers to set
|
|
3191
3220
|
*/
|
|
3192
3221
|
static async idpPasswordResetConfirm(
|
|
3193
3222
|
env: EnvInterface,
|
|
@@ -3195,6 +3224,7 @@ export class ApiClient extends BaseClient {
|
|
|
3195
3224
|
partialToken: string,
|
|
3196
3225
|
signature: string,
|
|
3197
3226
|
newPassword: string,
|
|
3227
|
+
headers?: HeadersInit,
|
|
3198
3228
|
): Promise<void> {
|
|
3199
3229
|
const o = op("/v0/org/{org_id}/idp/password_reset", "patch");
|
|
3200
3230
|
await retryOn5XX(() =>
|
|
@@ -3205,6 +3235,7 @@ export class ApiClient extends BaseClient {
|
|
|
3205
3235
|
token: `${partialToken}${signature}`,
|
|
3206
3236
|
new_password: newPassword,
|
|
3207
3237
|
},
|
|
3238
|
+
headers,
|
|
3208
3239
|
}),
|
|
3209
3240
|
).then(assertOk);
|
|
3210
3241
|
}
|
|
@@ -3215,21 +3246,21 @@ export class ApiClient extends BaseClient {
|
|
|
3215
3246
|
* @param env The environment to log into
|
|
3216
3247
|
* @param orgId The org id in which to generate proof
|
|
3217
3248
|
* @param token The oidc token
|
|
3249
|
+
* @param headers Optional headers to set
|
|
3218
3250
|
* @returns Proof of authentication
|
|
3219
3251
|
*/
|
|
3220
3252
|
static async identityProveOidc(
|
|
3221
3253
|
env: EnvInterface,
|
|
3222
3254
|
orgId: string,
|
|
3223
3255
|
token: string,
|
|
3256
|
+
headers?: HeadersInit,
|
|
3224
3257
|
): Promise<IdentityProof> {
|
|
3225
3258
|
const o = op("/v0/org/{org_id}/identity/prove/oidc", "post");
|
|
3226
3259
|
return retryOn5XX(() =>
|
|
3227
3260
|
o({
|
|
3228
3261
|
baseUrl: env.SignerApiRoot,
|
|
3229
3262
|
params: { path: { org_id: orgId } },
|
|
3230
|
-
headers:
|
|
3231
|
-
Authorization: token,
|
|
3232
|
-
},
|
|
3263
|
+
headers: mergeHeaders(headers, authHeader(token)),
|
|
3233
3264
|
}),
|
|
3234
3265
|
).then(assertOk);
|
|
3235
3266
|
}
|
|
@@ -3239,16 +3270,19 @@ export class ApiClient extends BaseClient {
|
|
|
3239
3270
|
*
|
|
3240
3271
|
* @param env The environment to log into
|
|
3241
3272
|
* @param token The oidc token identifying the user
|
|
3273
|
+
* @param headers Optional headers to set
|
|
3242
3274
|
* @returns The organization the user belongs to
|
|
3243
3275
|
*/
|
|
3244
|
-
static async userOrgs(
|
|
3276
|
+
static async userOrgs(
|
|
3277
|
+
env: EnvInterface,
|
|
3278
|
+
token: string,
|
|
3279
|
+
headers?: HeadersInit,
|
|
3280
|
+
): Promise<UserOrgsResponse> {
|
|
3245
3281
|
const o = op("/v0/user/orgs", "get");
|
|
3246
3282
|
return retryOn5XX(() =>
|
|
3247
3283
|
o({
|
|
3248
3284
|
baseUrl: env.SignerApiRoot,
|
|
3249
|
-
headers:
|
|
3250
|
-
Authorization: token,
|
|
3251
|
-
},
|
|
3285
|
+
headers: mergeHeaders(headers, authHeader(token)),
|
|
3252
3286
|
}),
|
|
3253
3287
|
).then(assertOk);
|
|
3254
3288
|
}
|
|
@@ -9,6 +9,7 @@ import type { SessionData, SessionManager, SessionMetadata } from "./session";
|
|
|
9
9
|
import { MemorySessionManager, metadata, parseBase64SessionData } from "./session";
|
|
10
10
|
import type { NewSessionResponse, ErrorResponse } from "../schema_types";
|
|
11
11
|
import type { EnvInterface } from "../env";
|
|
12
|
+
import { mergeHeaders } from "openapi-fetch";
|
|
12
13
|
|
|
13
14
|
/** CubeSigner SDK package name */
|
|
14
15
|
export const NAME: string = pkg.name;
|
|
@@ -163,14 +164,16 @@ export class BaseClient extends EventEmitter<ClientEvents> {
|
|
|
163
164
|
// If we have an activeSession, let it dictate the baseUrl. Otherwise fall back to the one set at construction
|
|
164
165
|
baseUrl,
|
|
165
166
|
...opts,
|
|
166
|
-
headers:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
167
|
+
headers: mergeHeaders(
|
|
168
|
+
{
|
|
169
|
+
"User-Agent": browserUserAgent ?? `${NAME}@${VERSION}`,
|
|
170
|
+
"X-Cubist-Ts-Sdk": `${NAME}@${VERSION}`,
|
|
171
|
+
Origin: this.config.origin,
|
|
172
|
+
},
|
|
173
|
+
authHeader(token),
|
|
174
|
+
this.config.headers,
|
|
175
|
+
opts.headers,
|
|
176
|
+
),
|
|
174
177
|
params: {
|
|
175
178
|
...opts.params,
|
|
176
179
|
path: {
|
|
@@ -308,3 +311,13 @@ export type OmitAutoParams<O> = DeepOmit<
|
|
|
308
311
|
params: { path: { org_id: string } };
|
|
309
312
|
}
|
|
310
313
|
> & { params?: { path?: Record<string, unknown> } };
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Creates {@link HeadersInit} containing a single "Authorization" header with a given value.
|
|
317
|
+
*
|
|
318
|
+
* @param token The "Authorization" header value
|
|
319
|
+
* @returns A {@link HeadersInit} object containing a single "Authorization" header with a given value.
|
|
320
|
+
*/
|
|
321
|
+
export function authHeader(token: string): HeadersInit {
|
|
322
|
+
return { Authorization: token };
|
|
323
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import { ApiClient } from "./client/api_client";
|
|
2
|
-
import type { IdentityProof, RatchetConfig
|
|
2
|
+
import type { EmailOtpResponse, IdentityProof, RatchetConfig } from "./schema_types";
|
|
3
3
|
|
|
4
4
|
// used in doc comments
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
6
|
import { AddFidoChallenge, TotpChallenge } from "./mfa";
|
|
7
7
|
import { Org } from "./org";
|
|
8
|
-
import type {
|
|
9
|
-
CubeSignerResponse,
|
|
10
|
-
EnvInterface,
|
|
11
|
-
MfaReceipts,
|
|
12
|
-
Scope,
|
|
13
|
-
SessionData,
|
|
14
|
-
SessionInfo,
|
|
15
|
-
SessionManager,
|
|
16
|
-
} from ".";
|
|
8
|
+
import type { MfaReceipts, SessionData, SessionInfo, SessionManager } from ".";
|
|
17
9
|
import { Key } from ".";
|
|
18
10
|
|
|
19
11
|
/** Options for logging in with OIDC token */
|
|
@@ -122,71 +114,45 @@ export class CubeSignerClient {
|
|
|
122
114
|
}
|
|
123
115
|
|
|
124
116
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* @
|
|
128
|
-
*
|
|
129
|
-
* @param
|
|
130
|
-
* @
|
|
131
|
-
* @param lifetimes Lifetimes of the new session.
|
|
132
|
-
* @param mfaReceipt Optional MFA receipt(s)
|
|
133
|
-
* @param purpose Optional session description.
|
|
134
|
-
* @returns The session data.
|
|
117
|
+
* Create a new OIDC-backed session.
|
|
118
|
+
*
|
|
119
|
+
* Same as {@link ApiClient.oidcSessionCreate}, see its documentation for more details.
|
|
120
|
+
*
|
|
121
|
+
* @param args Request arguments
|
|
122
|
+
* @returns The new session data
|
|
135
123
|
*/
|
|
136
124
|
static async createOidcSession(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
scopes: Array<Scope>,
|
|
141
|
-
lifetimes?: RatchetConfig,
|
|
142
|
-
mfaReceipt?: MfaReceipts,
|
|
143
|
-
purpose?: string,
|
|
144
|
-
): Promise<CubeSignerResponse<SessionData>> {
|
|
145
|
-
return await ApiClient.oidcSessionCreate(
|
|
146
|
-
env,
|
|
147
|
-
orgId,
|
|
148
|
-
token,
|
|
149
|
-
scopes,
|
|
150
|
-
lifetimes,
|
|
151
|
-
mfaReceipt,
|
|
152
|
-
purpose,
|
|
153
|
-
);
|
|
125
|
+
...args: Parameters<typeof ApiClient.oidcSessionCreate>
|
|
126
|
+
): Promise<Awaited<ReturnType<typeof ApiClient.oidcSessionCreate>>> {
|
|
127
|
+
return await ApiClient.oidcSessionCreate(...args);
|
|
154
128
|
}
|
|
155
129
|
|
|
156
130
|
/**
|
|
157
|
-
*
|
|
131
|
+
* Prove an OIDC identity.
|
|
132
|
+
*
|
|
133
|
+
* Same as {@link ApiClient.identityProveOidc}, see its documentation for more details.
|
|
158
134
|
*
|
|
159
|
-
* @param
|
|
160
|
-
* @param orgId The org id in which to generate proof
|
|
161
|
-
* @param token The oidc token
|
|
135
|
+
* @param args Request arguments
|
|
162
136
|
* @returns Proof of authentication
|
|
163
137
|
*/
|
|
164
138
|
static async proveOidcIdentity(
|
|
165
|
-
|
|
166
|
-
orgId: string,
|
|
167
|
-
token: string,
|
|
139
|
+
...args: Parameters<typeof ApiClient.identityProveOidc>
|
|
168
140
|
): Promise<IdentityProof> {
|
|
169
|
-
return await ApiClient.identityProveOidc(
|
|
141
|
+
return await ApiClient.identityProveOidc(...args);
|
|
170
142
|
}
|
|
171
143
|
|
|
172
144
|
/**
|
|
173
|
-
*
|
|
174
|
-
* Returns an unsigned OIDC token and sends an email to the user containing the signature of that token.
|
|
175
|
-
* The OIDC token can be reconstructed by appending the signature to the partial token like so:
|
|
145
|
+
* Initialize email OTP authentication.
|
|
176
146
|
*
|
|
177
|
-
*
|
|
147
|
+
* Same as {@link ApiClient.initEmailOtpAuth}, see its documentation for more details.
|
|
178
148
|
*
|
|
179
|
-
* @param
|
|
180
|
-
* @
|
|
181
|
-
* @param email The email to send the signature to
|
|
182
|
-
* @returns The partial OIDC token that must be combined with the signature in the email
|
|
149
|
+
* @param args Request arguments
|
|
150
|
+
* @returns — The partial OIDC token that must be combined with the signature in the email
|
|
183
151
|
*/
|
|
184
152
|
static async initEmailOtpAuth(
|
|
185
|
-
|
|
186
|
-
orgId: string,
|
|
187
|
-
email: string,
|
|
153
|
+
...args: Parameters<typeof ApiClient.initEmailOtpAuth>
|
|
188
154
|
): Promise<EmailOtpResponse> {
|
|
189
|
-
return await ApiClient.initEmailOtpAuth(
|
|
155
|
+
return await ApiClient.initEmailOtpAuth(...args);
|
|
190
156
|
}
|
|
191
157
|
|
|
192
158
|
/**
|