@passflow/core 0.26.0 → 0.27.0
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 +23 -9
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -10
- package/dist/index.d.ts +20 -10
- package/dist/index.mjs +376 -303
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3477,8 +3477,11 @@ type PassflowEventPayload = {
|
|
|
3477
3477
|
parsedTokens?: ParsedTokens;
|
|
3478
3478
|
/** `'other-tab'` only when an ended tab revives on a new session found in storage. Absent on this tab's own sign-in. */
|
|
3479
3479
|
origin?: EventOrigin;
|
|
3480
|
-
/**
|
|
3481
|
-
|
|
3480
|
+
/**
|
|
3481
|
+
* `'federated-landing'`: a federated redirect landed here and this instance exchanged its code.
|
|
3482
|
+
* `'tokens-in-url'`: tokens received in this page's URL were verified and saved.
|
|
3483
|
+
*/
|
|
3484
|
+
source?: 'federated-landing' | 'tokens-in-url';
|
|
3482
3485
|
};
|
|
3483
3486
|
[PassflowEvent.SignInStart]: {
|
|
3484
3487
|
email?: string;
|
|
@@ -5610,26 +5613,29 @@ export declare class Passflow {
|
|
|
5610
5613
|
*/
|
|
5611
5614
|
unsubscribe(subscriber: PassflowSubscriber, events?: PassflowEvent[]): void;
|
|
5612
5615
|
/**
|
|
5613
|
-
* Handle OAuth redirect callback and
|
|
5616
|
+
* Handle OAuth redirect callback and take tokens from the URL query or fragment.
|
|
5614
5617
|
* This method should be called on the redirect page after authentication.
|
|
5615
5618
|
*
|
|
5616
|
-
*
|
|
5619
|
+
* The tokens are removed from the URL at once, then verified in the background against the
|
|
5620
|
+
* configured server's published keys and this app id (required). `SignIn` with
|
|
5621
|
+
* `source: 'tokens-in-url'` (tokens saved), or `Error` with operation `tokens.from-url` (nothing
|
|
5622
|
+
* saved), reports the outcome, so subscribe first.
|
|
5617
5623
|
*
|
|
5618
5624
|
* @example
|
|
5619
5625
|
* ```typescript
|
|
5620
5626
|
* // On your redirect page (e.g., /auth/callback)
|
|
5621
|
-
*
|
|
5622
|
-
*
|
|
5623
|
-
*
|
|
5624
|
-
*
|
|
5625
|
-
*
|
|
5627
|
+
* passflow.subscribe(
|
|
5628
|
+
* { onAuthChange: (event, payload) => console.log(event, payload) },
|
|
5629
|
+
* [PassflowEvent.SignIn, PassflowEvent.Error],
|
|
5630
|
+
* );
|
|
5631
|
+
* passflow.handleTokensRedirect();
|
|
5626
5632
|
* ```
|
|
5627
5633
|
*
|
|
5628
5634
|
* A PKCE federated landing (`?code=`) returns `undefined` and finishes in the background: `SignIn`
|
|
5629
5635
|
* or `TwoFactorRequired` is the signal. With `deferFederatedLanding` it is left to
|
|
5630
5636
|
* `completeFederatedLanding()`.
|
|
5631
5637
|
*/
|
|
5632
|
-
handleTokensRedirect():
|
|
5638
|
+
handleTokensRedirect(): void;
|
|
5633
5639
|
/**
|
|
5634
5640
|
* Takes a PKCE federated landing (`?code=&user_state=`) on this page, for an instance built with
|
|
5635
5641
|
* `deferFederatedLanding`. The code is exchanged in the background; `SignIn` with
|
|
@@ -5655,6 +5661,10 @@ export declare class Passflow {
|
|
|
5655
5661
|
*/
|
|
5656
5662
|
private adoptTwoFactorTokenFromUrl;
|
|
5657
5663
|
private checkErrorsFromURL;
|
|
5664
|
+
/**
|
|
5665
|
+
* When a token appears in the query or the fragment, removes every token from the query and drops
|
|
5666
|
+
* a token-carrying fragment, in one history replace. Other query params stay.
|
|
5667
|
+
*/
|
|
5658
5668
|
private cleanupUrlParams;
|
|
5659
5669
|
private setTokensToCacheFromLocalStorage;
|
|
5660
5670
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -3477,8 +3477,11 @@ type PassflowEventPayload = {
|
|
|
3477
3477
|
parsedTokens?: ParsedTokens;
|
|
3478
3478
|
/** `'other-tab'` only when an ended tab revives on a new session found in storage. Absent on this tab's own sign-in. */
|
|
3479
3479
|
origin?: EventOrigin;
|
|
3480
|
-
/**
|
|
3481
|
-
|
|
3480
|
+
/**
|
|
3481
|
+
* `'federated-landing'`: a federated redirect landed here and this instance exchanged its code.
|
|
3482
|
+
* `'tokens-in-url'`: tokens received in this page's URL were verified and saved.
|
|
3483
|
+
*/
|
|
3484
|
+
source?: 'federated-landing' | 'tokens-in-url';
|
|
3482
3485
|
};
|
|
3483
3486
|
[PassflowEvent.SignInStart]: {
|
|
3484
3487
|
email?: string;
|
|
@@ -5610,26 +5613,29 @@ export declare class Passflow {
|
|
|
5610
5613
|
*/
|
|
5611
5614
|
unsubscribe(subscriber: PassflowSubscriber, events?: PassflowEvent[]): void;
|
|
5612
5615
|
/**
|
|
5613
|
-
* Handle OAuth redirect callback and
|
|
5616
|
+
* Handle OAuth redirect callback and take tokens from the URL query or fragment.
|
|
5614
5617
|
* This method should be called on the redirect page after authentication.
|
|
5615
5618
|
*
|
|
5616
|
-
*
|
|
5619
|
+
* The tokens are removed from the URL at once, then verified in the background against the
|
|
5620
|
+
* configured server's published keys and this app id (required). `SignIn` with
|
|
5621
|
+
* `source: 'tokens-in-url'` (tokens saved), or `Error` with operation `tokens.from-url` (nothing
|
|
5622
|
+
* saved), reports the outcome, so subscribe first.
|
|
5617
5623
|
*
|
|
5618
5624
|
* @example
|
|
5619
5625
|
* ```typescript
|
|
5620
5626
|
* // On your redirect page (e.g., /auth/callback)
|
|
5621
|
-
*
|
|
5622
|
-
*
|
|
5623
|
-
*
|
|
5624
|
-
*
|
|
5625
|
-
*
|
|
5627
|
+
* passflow.subscribe(
|
|
5628
|
+
* { onAuthChange: (event, payload) => console.log(event, payload) },
|
|
5629
|
+
* [PassflowEvent.SignIn, PassflowEvent.Error],
|
|
5630
|
+
* );
|
|
5631
|
+
* passflow.handleTokensRedirect();
|
|
5626
5632
|
* ```
|
|
5627
5633
|
*
|
|
5628
5634
|
* A PKCE federated landing (`?code=`) returns `undefined` and finishes in the background: `SignIn`
|
|
5629
5635
|
* or `TwoFactorRequired` is the signal. With `deferFederatedLanding` it is left to
|
|
5630
5636
|
* `completeFederatedLanding()`.
|
|
5631
5637
|
*/
|
|
5632
|
-
handleTokensRedirect():
|
|
5638
|
+
handleTokensRedirect(): void;
|
|
5633
5639
|
/**
|
|
5634
5640
|
* Takes a PKCE federated landing (`?code=&user_state=`) on this page, for an instance built with
|
|
5635
5641
|
* `deferFederatedLanding`. The code is exchanged in the background; `SignIn` with
|
|
@@ -5655,6 +5661,10 @@ export declare class Passflow {
|
|
|
5655
5661
|
*/
|
|
5656
5662
|
private adoptTwoFactorTokenFromUrl;
|
|
5657
5663
|
private checkErrorsFromURL;
|
|
5664
|
+
/**
|
|
5665
|
+
* When a token appears in the query or the fragment, removes every token from the query and drops
|
|
5666
|
+
* a token-carrying fragment, in one history replace. Other query params stay.
|
|
5667
|
+
*/
|
|
5658
5668
|
private cleanupUrlParams;
|
|
5659
5669
|
private setTokensToCacheFromLocalStorage;
|
|
5660
5670
|
/**
|