@passflow/core 0.37.0 → 0.38.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 +26 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -7
- package/dist/index.d.ts +30 -7
- package/dist/index.mjs +15 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3385,7 +3385,7 @@ export declare class TwoFactorApiClient {
|
|
|
3385
3385
|
* Answers the stored method. The server refuses `recovery_codes` and a method the user
|
|
3386
3386
|
* cannot present at this app with 400 `error.2fa.preferred_method.unavailable`.
|
|
3387
3387
|
*/
|
|
3388
|
-
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod
|
|
3388
|
+
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod>;
|
|
3389
3389
|
/**
|
|
3390
3390
|
* Clear the user's preferred 2FA method
|
|
3391
3391
|
* DELETE /v2/user/2fa/preferred-method
|
|
@@ -5230,7 +5230,7 @@ export declare class TwoFactorService {
|
|
|
5230
5230
|
* Rejects with the server's 400 `error.2fa.preferred_method.unavailable` for `recovery_codes`
|
|
5231
5231
|
* and for a method the user cannot present at this app.
|
|
5232
5232
|
*/
|
|
5233
|
-
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod
|
|
5233
|
+
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod>;
|
|
5234
5234
|
/**
|
|
5235
5235
|
* Remove the user's preferred second factor. Resolves also when none was stored.
|
|
5236
5236
|
*/
|
|
@@ -5883,13 +5883,16 @@ export declare const UpgradeErrorIds: {
|
|
|
5883
5883
|
readonly twoFactorNotEnabled: 'error.2fa.not_enabled';
|
|
5884
5884
|
readonly notImplemented: 'error.not.implemented';
|
|
5885
5885
|
readonly tokenInvalid: 'error.api.request.token.invalid';
|
|
5886
|
+
readonly grantPredatesCredentialReset: 'error.grant.predates_credential_reset';
|
|
5887
|
+
readonly tokenAccessEnded: 'error.token.access_ended';
|
|
5888
|
+
readonly userNotFound: 'error.user.not_found';
|
|
5886
5889
|
};
|
|
5887
5890
|
/**
|
|
5888
|
-
*
|
|
5889
|
-
*
|
|
5891
|
+
* The errors `refreshErrorStatus` (`src/web/api/refresh_token.go`) maps to a 401 on the commit
|
|
5892
|
+
* path that are the upgrade protocol talking. The same function answers 401 for three more ids,
|
|
5893
|
+
* which end the session: see `SESSION_INVALIDATING_COMMIT_ERROR_IDS`.
|
|
5890
5894
|
*
|
|
5891
|
-
* All five are "recoverable" in the session sense:
|
|
5892
|
-
* upgrade protocol talking, so none of them means the session died. Note that
|
|
5895
|
+
* All five are "recoverable" in the session sense: none of them means the session died. Note that
|
|
5893
5896
|
* `challenge_too_many_attempts` is in here yet is NOT retryable — it ends the
|
|
5894
5897
|
* elevation while leaving the session intact. The two axes are independent and
|
|
5895
5898
|
* are deliberately not collapsed.
|
|
@@ -5913,6 +5916,13 @@ export declare const RECOVERABLE_COMMIT_ERROR_IDS: readonly string[];
|
|
|
5913
5916
|
* feature's governing rule. A client-side miss costs a stale session that the
|
|
5914
5917
|
* next ordinary 401 clears; a false positive costs the user their session in
|
|
5915
5918
|
* the middle of proving who they are.
|
|
5919
|
+
*
|
|
5920
|
+
* Besides the invalid token, the server answers 401 on the commit path for three ids that end the
|
|
5921
|
+
* session: a session from before a credential reset, a token from before the user's access was
|
|
5922
|
+
* ended, and a user who is gone. After each of them the user signs in again.
|
|
5923
|
+
*
|
|
5924
|
+
* Invalidating sets the stored session state. Cookie mode reads it (`isAuthenticated()` turns
|
|
5925
|
+
* false); JSON mode does not, and there the tokens stay until the next refresh fails.
|
|
5916
5926
|
*/
|
|
5917
5927
|
export declare const SESSION_INVALIDATING_COMMIT_ERROR_IDS: readonly string[];
|
|
5918
5928
|
/** True when a kind leaves the elevation alive. Single source for `retryable`. */
|
|
@@ -7442,6 +7452,19 @@ export declare class Passflow {
|
|
|
7442
7452
|
* ```
|
|
7443
7453
|
*/
|
|
7444
7454
|
getDeliveryMode(): TokenDeliveryMode;
|
|
7455
|
+
/**
|
|
7456
|
+
* The id that identifies this browser or device to Passflow.
|
|
7457
|
+
* It is the same value the SDK sends with every request. It is read from storage;
|
|
7458
|
+
* on first use it is minted and stored, so later calls and page loads return the same id.
|
|
7459
|
+
*
|
|
7460
|
+
* @returns The device id
|
|
7461
|
+
*
|
|
7462
|
+
* @example
|
|
7463
|
+
* ```typescript
|
|
7464
|
+
* const deviceId = passflow.getDeviceId();
|
|
7465
|
+
* ```
|
|
7466
|
+
*/
|
|
7467
|
+
getDeviceId(): string;
|
|
7445
7468
|
/**
|
|
7446
7469
|
* Restore and validate session for cookie mode on page load.
|
|
7447
7470
|
* Only applicable when using cookie-based token delivery.
|
|
@@ -7673,7 +7696,7 @@ export declare class Passflow {
|
|
|
7673
7696
|
* await passflow.setPreferredTwoFactorMethod('totp');
|
|
7674
7697
|
* ```
|
|
7675
7698
|
*/
|
|
7676
|
-
setPreferredTwoFactorMethod(method: TwoFactorMethod): Promise<TwoFactorMethod
|
|
7699
|
+
setPreferredTwoFactorMethod(method: TwoFactorMethod): Promise<TwoFactorMethod>;
|
|
7677
7700
|
/**
|
|
7678
7701
|
* Remove the signed-in user's preferred second factor. Resolves also when none was stored.
|
|
7679
7702
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -3385,7 +3385,7 @@ export declare class TwoFactorApiClient {
|
|
|
3385
3385
|
* Answers the stored method. The server refuses `recovery_codes` and a method the user
|
|
3386
3386
|
* cannot present at this app with 400 `error.2fa.preferred_method.unavailable`.
|
|
3387
3387
|
*/
|
|
3388
|
-
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod
|
|
3388
|
+
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod>;
|
|
3389
3389
|
/**
|
|
3390
3390
|
* Clear the user's preferred 2FA method
|
|
3391
3391
|
* DELETE /v2/user/2fa/preferred-method
|
|
@@ -5230,7 +5230,7 @@ export declare class TwoFactorService {
|
|
|
5230
5230
|
* Rejects with the server's 400 `error.2fa.preferred_method.unavailable` for `recovery_codes`
|
|
5231
5231
|
* and for a method the user cannot present at this app.
|
|
5232
5232
|
*/
|
|
5233
|
-
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod
|
|
5233
|
+
setPreferredMethod(method: TwoFactorMethod): Promise<TwoFactorMethod>;
|
|
5234
5234
|
/**
|
|
5235
5235
|
* Remove the user's preferred second factor. Resolves also when none was stored.
|
|
5236
5236
|
*/
|
|
@@ -5883,13 +5883,16 @@ export declare const UpgradeErrorIds: {
|
|
|
5883
5883
|
readonly twoFactorNotEnabled: 'error.2fa.not_enabled';
|
|
5884
5884
|
readonly notImplemented: 'error.not.implemented';
|
|
5885
5885
|
readonly tokenInvalid: 'error.api.request.token.invalid';
|
|
5886
|
+
readonly grantPredatesCredentialReset: 'error.grant.predates_credential_reset';
|
|
5887
|
+
readonly tokenAccessEnded: 'error.token.access_ended';
|
|
5888
|
+
readonly userNotFound: 'error.user.not_found';
|
|
5886
5889
|
};
|
|
5887
5890
|
/**
|
|
5888
|
-
*
|
|
5889
|
-
*
|
|
5891
|
+
* The errors `refreshErrorStatus` (`src/web/api/refresh_token.go`) maps to a 401 on the commit
|
|
5892
|
+
* path that are the upgrade protocol talking. The same function answers 401 for three more ids,
|
|
5893
|
+
* which end the session: see `SESSION_INVALIDATING_COMMIT_ERROR_IDS`.
|
|
5890
5894
|
*
|
|
5891
|
-
* All five are "recoverable" in the session sense:
|
|
5892
|
-
* upgrade protocol talking, so none of them means the session died. Note that
|
|
5895
|
+
* All five are "recoverable" in the session sense: none of them means the session died. Note that
|
|
5893
5896
|
* `challenge_too_many_attempts` is in here yet is NOT retryable — it ends the
|
|
5894
5897
|
* elevation while leaving the session intact. The two axes are independent and
|
|
5895
5898
|
* are deliberately not collapsed.
|
|
@@ -5913,6 +5916,13 @@ export declare const RECOVERABLE_COMMIT_ERROR_IDS: readonly string[];
|
|
|
5913
5916
|
* feature's governing rule. A client-side miss costs a stale session that the
|
|
5914
5917
|
* next ordinary 401 clears; a false positive costs the user their session in
|
|
5915
5918
|
* the middle of proving who they are.
|
|
5919
|
+
*
|
|
5920
|
+
* Besides the invalid token, the server answers 401 on the commit path for three ids that end the
|
|
5921
|
+
* session: a session from before a credential reset, a token from before the user's access was
|
|
5922
|
+
* ended, and a user who is gone. After each of them the user signs in again.
|
|
5923
|
+
*
|
|
5924
|
+
* Invalidating sets the stored session state. Cookie mode reads it (`isAuthenticated()` turns
|
|
5925
|
+
* false); JSON mode does not, and there the tokens stay until the next refresh fails.
|
|
5916
5926
|
*/
|
|
5917
5927
|
export declare const SESSION_INVALIDATING_COMMIT_ERROR_IDS: readonly string[];
|
|
5918
5928
|
/** True when a kind leaves the elevation alive. Single source for `retryable`. */
|
|
@@ -7442,6 +7452,19 @@ export declare class Passflow {
|
|
|
7442
7452
|
* ```
|
|
7443
7453
|
*/
|
|
7444
7454
|
getDeliveryMode(): TokenDeliveryMode;
|
|
7455
|
+
/**
|
|
7456
|
+
* The id that identifies this browser or device to Passflow.
|
|
7457
|
+
* It is the same value the SDK sends with every request. It is read from storage;
|
|
7458
|
+
* on first use it is minted and stored, so later calls and page loads return the same id.
|
|
7459
|
+
*
|
|
7460
|
+
* @returns The device id
|
|
7461
|
+
*
|
|
7462
|
+
* @example
|
|
7463
|
+
* ```typescript
|
|
7464
|
+
* const deviceId = passflow.getDeviceId();
|
|
7465
|
+
* ```
|
|
7466
|
+
*/
|
|
7467
|
+
getDeviceId(): string;
|
|
7445
7468
|
/**
|
|
7446
7469
|
* Restore and validate session for cookie mode on page load.
|
|
7447
7470
|
* Only applicable when using cookie-based token delivery.
|
|
@@ -7673,7 +7696,7 @@ export declare class Passflow {
|
|
|
7673
7696
|
* await passflow.setPreferredTwoFactorMethod('totp');
|
|
7674
7697
|
* ```
|
|
7675
7698
|
*/
|
|
7676
|
-
setPreferredTwoFactorMethod(method: TwoFactorMethod): Promise<TwoFactorMethod
|
|
7699
|
+
setPreferredTwoFactorMethod(method: TwoFactorMethod): Promise<TwoFactorMethod>;
|
|
7677
7700
|
/**
|
|
7678
7701
|
* Remove the signed-in user's preferred second factor. Resolves also when none was stored.
|
|
7679
7702
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var i = "__passflowAntiBot", a = (e, t) => {
|
|
|
11
11
|
if (typeof e != "object" || !e) return;
|
|
12
12
|
let t = e[i];
|
|
13
13
|
return typeof t == "object" && t ? t : void 0;
|
|
14
|
-
}, s = "0.
|
|
14
|
+
}, s = "0.38.0", c = "X-Passflow-Clientid", l = "Authorization", u = "X-Passflow-DeviceId", d = "X-Passflow-DeviceType", f = "X-Passflow-Anti-Bot", p = "X-Passflow-Agent-Tool", m = "passflow_auth", h = s, g = [
|
|
15
15
|
"id",
|
|
16
16
|
"offline",
|
|
17
17
|
"openid"
|
|
@@ -1500,7 +1500,7 @@ var ut = /* @__PURE__ */ function(e) {
|
|
|
1500
1500
|
return (await this.axiosClient.get(z.TwoFactorPreferredMethod))?.preferred_method ?? null;
|
|
1501
1501
|
}
|
|
1502
1502
|
async setPreferredMethod(e) {
|
|
1503
|
-
return (await this.axiosClient.put(z.TwoFactorPreferredMethod, { method: e }))?.preferred_method ??
|
|
1503
|
+
return (await this.axiosClient.put(z.TwoFactorPreferredMethod, { method: e }))?.preferred_method ?? e;
|
|
1504
1504
|
}
|
|
1505
1505
|
async clearPreferredMethod() {
|
|
1506
1506
|
await this.axiosClient.delete(z.TwoFactorPreferredMethod);
|
|
@@ -3950,14 +3950,22 @@ var Q = {
|
|
|
3950
3950
|
methodNotSupported: "error.2fa.method_not_supported",
|
|
3951
3951
|
twoFactorNotEnabled: "error.2fa.not_enabled",
|
|
3952
3952
|
notImplemented: "error.not.implemented",
|
|
3953
|
-
tokenInvalid: "error.api.request.token.invalid"
|
|
3953
|
+
tokenInvalid: "error.api.request.token.invalid",
|
|
3954
|
+
grantPredatesCredentialReset: "error.grant.predates_credential_reset",
|
|
3955
|
+
tokenAccessEnded: "error.token.access_ended",
|
|
3956
|
+
userNotFound: "error.user.not_found"
|
|
3954
3957
|
}, Ci = Object.freeze([
|
|
3955
3958
|
Q.twoFactorCodeInvalid,
|
|
3956
3959
|
Q.twoFactorNotEnabled,
|
|
3957
3960
|
Q.challengeInvalid,
|
|
3958
3961
|
Q.challengeSessionMismatch,
|
|
3959
3962
|
Q.challengeTooManyAttempts
|
|
3960
|
-
]), wi = Object.freeze([
|
|
3963
|
+
]), wi = Object.freeze([
|
|
3964
|
+
Q.tokenInvalid,
|
|
3965
|
+
Q.grantPredatesCredentialReset,
|
|
3966
|
+
Q.tokenAccessEnded,
|
|
3967
|
+
Q.userNotFound
|
|
3968
|
+
]), Ti = Object.freeze([
|
|
3961
3969
|
"wrong_code",
|
|
3962
3970
|
"challenge_spent",
|
|
3963
3971
|
"not_registered",
|
|
@@ -7772,6 +7780,9 @@ var sa = 10, ca = "The sign-in answered with a PKCE code, but its verifier is go
|
|
|
7772
7780
|
getDeliveryMode() {
|
|
7773
7781
|
return this.authService.tokenDeliveryManager.getMode();
|
|
7774
7782
|
}
|
|
7783
|
+
getDeviceId() {
|
|
7784
|
+
return this.deviceService.getDeviceId();
|
|
7785
|
+
}
|
|
7775
7786
|
async restoreSession() {
|
|
7776
7787
|
return await this.authService.restoreSession();
|
|
7777
7788
|
}
|