@passflow/core 0.49.2 → 0.49.3
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 +17 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.mjs +17 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2257,6 +2257,7 @@ export type PassflowInviteResponse = {
|
|
|
2257
2257
|
export type PassflowInvitePayload = {
|
|
2258
2258
|
invite_token: string;
|
|
2259
2259
|
scopes: string[];
|
|
2260
|
+
code_challenge?: string;
|
|
2260
2261
|
};
|
|
2261
2262
|
/**
|
|
2262
2263
|
* One member of a tenant group, as listed in `PassflowTenantResponse.users_in_groups`:
|
|
@@ -2886,7 +2887,7 @@ type OperationErrorPayload = ErrorPayload & {
|
|
|
2886
2887
|
operation: PassflowOperation;
|
|
2887
2888
|
};
|
|
2888
2889
|
/** Which call produced an `EmailVerificationRequired` event. */
|
|
2889
|
-
type PassflowEmailVerificationOperation = 'sign-up' | 'sign-in' | 'reset-password';
|
|
2890
|
+
type PassflowEmailVerificationOperation = 'sign-up' | 'sign-in' | 'reset-password' | 'join-invitation';
|
|
2890
2891
|
/**
|
|
2891
2892
|
* Event-specific payload types
|
|
2892
2893
|
*/
|
|
@@ -3546,7 +3547,7 @@ export declare class TenantAPI {
|
|
|
3546
3547
|
protected axiosClient: AxiosClient;
|
|
3547
3548
|
constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
|
|
3548
3549
|
setAppId(appId: string): void;
|
|
3549
|
-
joinInvitation(token: string, scopes: string[]): Promise<PassflowAuthorizationResponse>;
|
|
3550
|
+
joinInvitation(token: string, scopes: string[], codeChallenge?: string): Promise<PassflowAuthorizationResponse>;
|
|
3550
3551
|
createTenant(name: string): Promise<PassflowTenantResponse>;
|
|
3551
3552
|
/**
|
|
3552
3553
|
* Get tenant details
|
|
@@ -5261,6 +5262,15 @@ export declare class AuthService {
|
|
|
5261
5262
|
*/
|
|
5262
5263
|
refreshToken(upgrade?: UpgradeRefreshField, pin?: UpgradeSessionPin): Promise<PassflowAuthorizationResponse>;
|
|
5263
5264
|
sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload, options?: PassflowAuthOptions): Promise<PassflowSuccessResponse>;
|
|
5265
|
+
/**
|
|
5266
|
+
* Joins a tenant with an invitation and continues the session with the tokens the join issues.
|
|
5267
|
+
*
|
|
5268
|
+
* `join` posts the invitation; on a PKCE app it gets a code challenge, and the code the join
|
|
5269
|
+
* answers with is exchanged with the verifier. An emailed-code step is returned as it is, with
|
|
5270
|
+
* the verifier kept so `verifyEmailCode` finishes the join. Emits no event of its own beyond that
|
|
5271
|
+
* step's `EmailVerificationRequired`, and reports no error: the caller does.
|
|
5272
|
+
*/
|
|
5273
|
+
joinInvitation(join: (codeChallenge?: string) => Promise<PassflowAuthorizationResponse>, scopes: string[]): Promise<PassflowAuthorizationResponse>;
|
|
5264
5274
|
resetPassword(newPassword: string, scopes?: string[], token?: string): Promise<PassflowAuthorizationResponse>;
|
|
5265
5275
|
passkeyRegister(payload: PassflowPasskeyRegisterStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5266
5276
|
passkeyAuthenticate(payload: PassflowPasskeyAuthenticateStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
@@ -5524,9 +5534,10 @@ export declare class TenantService {
|
|
|
5524
5534
|
* Join a tenant invitation
|
|
5525
5535
|
* @param token The invitation token
|
|
5526
5536
|
* @param scopes Optional scopes to request
|
|
5537
|
+
* @param codeChallenge PKCE code challenge, sent only when given
|
|
5527
5538
|
* @returns Promise with invite response
|
|
5528
5539
|
*/
|
|
5529
|
-
joinInvitation(token: string, scopes?: string[]): Promise<PassflowAuthorizationResponse>;
|
|
5540
|
+
joinInvitation(token: string, scopes?: string[], codeChallenge?: string): Promise<PassflowAuthorizationResponse>;
|
|
5530
5541
|
/**
|
|
5531
5542
|
* Create a new tenant
|
|
5532
5543
|
* @param name The name of the tenant
|
|
@@ -8258,10 +8269,14 @@ export declare class Passflow {
|
|
|
8258
8269
|
/** The `sid` of the stored access token, else of the stored ID token; undefined when neither is readable. */
|
|
8259
8270
|
private currentSessionId;
|
|
8260
8271
|
/**
|
|
8261
|
-
* Join a tenant invitation
|
|
8272
|
+
* Join a tenant invitation and save the tokens the join issues, like a sign-in.
|
|
8273
|
+
*
|
|
8274
|
+
* On a PKCE app it sends a code challenge and exchanges the code the join answers with. An
|
|
8275
|
+
* emailed-code answer (`isEmailVerificationStep`) is returned as it is; finish it with
|
|
8276
|
+
* `verifyEmailCode`.
|
|
8262
8277
|
* @param token The invitation token
|
|
8263
8278
|
* @param scopes Optional scopes to request
|
|
8264
|
-
* @returns Promise with
|
|
8279
|
+
* @returns Promise with the new token pair, or the email verification step
|
|
8265
8280
|
*/
|
|
8266
8281
|
joinInvitation(token: string, scopes?: string[]): Promise<PassflowAuthorizationResponse>;
|
|
8267
8282
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2257,6 +2257,7 @@ export type PassflowInviteResponse = {
|
|
|
2257
2257
|
export type PassflowInvitePayload = {
|
|
2258
2258
|
invite_token: string;
|
|
2259
2259
|
scopes: string[];
|
|
2260
|
+
code_challenge?: string;
|
|
2260
2261
|
};
|
|
2261
2262
|
/**
|
|
2262
2263
|
* One member of a tenant group, as listed in `PassflowTenantResponse.users_in_groups`:
|
|
@@ -2886,7 +2887,7 @@ type OperationErrorPayload = ErrorPayload & {
|
|
|
2886
2887
|
operation: PassflowOperation;
|
|
2887
2888
|
};
|
|
2888
2889
|
/** Which call produced an `EmailVerificationRequired` event. */
|
|
2889
|
-
type PassflowEmailVerificationOperation = 'sign-up' | 'sign-in' | 'reset-password';
|
|
2890
|
+
type PassflowEmailVerificationOperation = 'sign-up' | 'sign-in' | 'reset-password' | 'join-invitation';
|
|
2890
2891
|
/**
|
|
2891
2892
|
* Event-specific payload types
|
|
2892
2893
|
*/
|
|
@@ -3546,7 +3547,7 @@ export declare class TenantAPI {
|
|
|
3546
3547
|
protected axiosClient: AxiosClient;
|
|
3547
3548
|
constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
|
|
3548
3549
|
setAppId(appId: string): void;
|
|
3549
|
-
joinInvitation(token: string, scopes: string[]): Promise<PassflowAuthorizationResponse>;
|
|
3550
|
+
joinInvitation(token: string, scopes: string[], codeChallenge?: string): Promise<PassflowAuthorizationResponse>;
|
|
3550
3551
|
createTenant(name: string): Promise<PassflowTenantResponse>;
|
|
3551
3552
|
/**
|
|
3552
3553
|
* Get tenant details
|
|
@@ -5261,6 +5262,15 @@ export declare class AuthService {
|
|
|
5261
5262
|
*/
|
|
5262
5263
|
refreshToken(upgrade?: UpgradeRefreshField, pin?: UpgradeSessionPin): Promise<PassflowAuthorizationResponse>;
|
|
5263
5264
|
sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload, options?: PassflowAuthOptions): Promise<PassflowSuccessResponse>;
|
|
5265
|
+
/**
|
|
5266
|
+
* Joins a tenant with an invitation and continues the session with the tokens the join issues.
|
|
5267
|
+
*
|
|
5268
|
+
* `join` posts the invitation; on a PKCE app it gets a code challenge, and the code the join
|
|
5269
|
+
* answers with is exchanged with the verifier. An emailed-code step is returned as it is, with
|
|
5270
|
+
* the verifier kept so `verifyEmailCode` finishes the join. Emits no event of its own beyond that
|
|
5271
|
+
* step's `EmailVerificationRequired`, and reports no error: the caller does.
|
|
5272
|
+
*/
|
|
5273
|
+
joinInvitation(join: (codeChallenge?: string) => Promise<PassflowAuthorizationResponse>, scopes: string[]): Promise<PassflowAuthorizationResponse>;
|
|
5264
5274
|
resetPassword(newPassword: string, scopes?: string[], token?: string): Promise<PassflowAuthorizationResponse>;
|
|
5265
5275
|
passkeyRegister(payload: PassflowPasskeyRegisterStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
5266
5276
|
passkeyAuthenticate(payload: PassflowPasskeyAuthenticateStartPayload, options?: PassflowAuthOptions): Promise<PassflowAuthorizationResponse>;
|
|
@@ -5524,9 +5534,10 @@ export declare class TenantService {
|
|
|
5524
5534
|
* Join a tenant invitation
|
|
5525
5535
|
* @param token The invitation token
|
|
5526
5536
|
* @param scopes Optional scopes to request
|
|
5537
|
+
* @param codeChallenge PKCE code challenge, sent only when given
|
|
5527
5538
|
* @returns Promise with invite response
|
|
5528
5539
|
*/
|
|
5529
|
-
joinInvitation(token: string, scopes?: string[]): Promise<PassflowAuthorizationResponse>;
|
|
5540
|
+
joinInvitation(token: string, scopes?: string[], codeChallenge?: string): Promise<PassflowAuthorizationResponse>;
|
|
5530
5541
|
/**
|
|
5531
5542
|
* Create a new tenant
|
|
5532
5543
|
* @param name The name of the tenant
|
|
@@ -8258,10 +8269,14 @@ export declare class Passflow {
|
|
|
8258
8269
|
/** The `sid` of the stored access token, else of the stored ID token; undefined when neither is readable. */
|
|
8259
8270
|
private currentSessionId;
|
|
8260
8271
|
/**
|
|
8261
|
-
* Join a tenant invitation
|
|
8272
|
+
* Join a tenant invitation and save the tokens the join issues, like a sign-in.
|
|
8273
|
+
*
|
|
8274
|
+
* On a PKCE app it sends a code challenge and exchanges the code the join answers with. An
|
|
8275
|
+
* emailed-code answer (`isEmailVerificationStep`) is returned as it is; finish it with
|
|
8276
|
+
* `verifyEmailCode`.
|
|
8262
8277
|
* @param token The invitation token
|
|
8263
8278
|
* @param scopes Optional scopes to request
|
|
8264
|
-
* @returns Promise with
|
|
8279
|
+
* @returns Promise with the new token pair, or the email verification step
|
|
8265
8280
|
*/
|
|
8266
8281
|
joinInvitation(token: string, scopes?: string[]): Promise<PassflowAuthorizationResponse>;
|
|
8267
8282
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var a = "__passflowAntiBot", o = (e, t) => {
|
|
|
11
11
|
if (typeof e != "object" || !e) return;
|
|
12
12
|
let t = e[a];
|
|
13
13
|
return typeof t == "object" && t ? t : void 0;
|
|
14
|
-
}, c = "0.49.
|
|
14
|
+
}, c = "0.49.3", l = "X-Passflow-Clientid", u = "Authorization", d = "X-Passflow-DeviceId", f = "X-Passflow-DeviceType", p = "X-Passflow-Anti-Bot", m = "X-Passflow-Agent-Tool", h = "X-Passflow-Device-Proof", g = "X-Passflow-Fingerprint-Event", _ = "X-Passflow-Stytch-Telemetry", v = "passflow_auth", y = c, b = [
|
|
15
15
|
"id",
|
|
16
16
|
"offline",
|
|
17
17
|
"openid"
|
|
@@ -1443,12 +1443,13 @@ var Pt = /* @__PURE__ */ function(e) {
|
|
|
1443
1443
|
setAppId(e) {
|
|
1444
1444
|
this.axiosClient.setAppId(e);
|
|
1445
1445
|
}
|
|
1446
|
-
joinInvitation(e, t) {
|
|
1447
|
-
let
|
|
1446
|
+
joinInvitation(e, t, n) {
|
|
1447
|
+
let r = {
|
|
1448
1448
|
invite_token: e,
|
|
1449
|
-
scopes: t
|
|
1449
|
+
scopes: t,
|
|
1450
|
+
...n ? { code_challenge: n } : {}
|
|
1450
1451
|
};
|
|
1451
|
-
return this.axiosClient.post(R.joinInvitation,
|
|
1452
|
+
return this.axiosClient.post(R.joinInvitation, r);
|
|
1452
1453
|
}
|
|
1453
1454
|
createTenant(e) {
|
|
1454
1455
|
let t = { name: e };
|
|
@@ -5396,6 +5397,12 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
5396
5397
|
throw W(this.subscribeStore, t), e;
|
|
5397
5398
|
}
|
|
5398
5399
|
}
|
|
5400
|
+
async joinInvitation(e, t) {
|
|
5401
|
+
let n = await this.startPkce(), r = await e(n?.challenge);
|
|
5402
|
+
if (this.handleEmailVerificationStep(r, "join-invitation", void 0, n, t)) return r;
|
|
5403
|
+
let i = await this.exchangeCode(r, n);
|
|
5404
|
+
return await this.processAuthResponse(i, t), i;
|
|
5405
|
+
}
|
|
5399
5406
|
async resetPassword(e, t, n) {
|
|
5400
5407
|
this.subscribeStore.notify(G.SignInStart, {});
|
|
5401
5408
|
let r = n ?? bo(this.platform.getCurrentUrl()), i = t ?? this.scopes;
|
|
@@ -6012,10 +6019,10 @@ var Eo = class {
|
|
|
6012
6019
|
}
|
|
6013
6020
|
throw this.logger.error(`${n}:`, t), t instanceof Error ? t : Error(String(t));
|
|
6014
6021
|
}
|
|
6015
|
-
async joinInvitation(e, t) {
|
|
6022
|
+
async joinInvitation(e, t, n) {
|
|
6016
6023
|
try {
|
|
6017
|
-
let
|
|
6018
|
-
return await this.tenantApi.joinInvitation(e, n);
|
|
6024
|
+
let r = t ?? this.scopes;
|
|
6025
|
+
return n ? await this.tenantApi.joinInvitation(e, r, n) : await this.tenantApi.joinInvitation(e, r);
|
|
6019
6026
|
} catch (e) {
|
|
6020
6027
|
this.handlePassflowError(e, "Join invitation failed");
|
|
6021
6028
|
}
|
|
@@ -8540,8 +8547,8 @@ var Eo = class {
|
|
|
8540
8547
|
}
|
|
8541
8548
|
async joinInvitation(e, t) {
|
|
8542
8549
|
try {
|
|
8543
|
-
let n =
|
|
8544
|
-
return
|
|
8550
|
+
let n = t ?? this.scopes;
|
|
8551
|
+
return await this.authService.joinInvitation((t) => this.tenant.joinInvitation(e, n, t), n);
|
|
8545
8552
|
} catch (e) {
|
|
8546
8553
|
this.handleError(e, "invitation.join", "Join invitation");
|
|
8547
8554
|
}
|