@atlasauth/expo 0.6.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @atlasauth/expo changelog
2
2
 
3
+ ## 0.7.0 — 2026-11-13
4
+
5
+ - `useAccountSecurity` / `createAccountSecurityActions` add `revokeAllTrustedDevices`.
6
+ - Needs `@atlasauth/js` 0.41.0 or later.
7
+
3
8
  ## 0.6.0 — 2026-11-13
4
9
 
5
10
  - `useAccountSecurity` and `createAccountSecurityActions`; `linkWithIdToken`; captcha solved automatically on Hermes/JSC.
@@ -0,0 +1,26 @@
1
+ /** `const { changePassword } = useAccountSecurity();` bound to the provider's bearer-authenticated client. */
2
+ export declare function useAccountSecurity(): {
3
+ changePassword: (input: {
4
+ currentPassword: string;
5
+ newPassword: string;
6
+ }) => Promise<import("@atlasauth/js").PasswordChangeResult>;
7
+ setPassword: (password: string) => Promise<import("@atlasauth/js").SetPasswordResult>;
8
+ listTrustedDevices: () => Promise<import("@atlasauth/js").TrustedDevicesResult>;
9
+ revokeTrustedDevice: (id: string) => Promise<import("@atlasauth/js").RevokeTrustedDeviceResult>;
10
+ revokeAllTrustedDevices: () => Promise<import("@atlasauth/js").RevokeAllTrustedDevicesResult>;
11
+ listSessions: () => Promise<import("@atlasauth/js").AccountSessionsResult>;
12
+ revokeAccountSession: (id: string) => Promise<import("@atlasauth/js").RevokeSessionResult>;
13
+ revokeAllSessions: () => Promise<import("@atlasauth/js").RevokeOtherSessionsResult>;
14
+ listMfaFactors: () => Promise<import("@atlasauth/js").MfaFactorsResult>;
15
+ startTotp: () => Promise<import("@atlasauth/js").StartTotpResult>;
16
+ verifyTotp: (factorId: string, codes: string[]) => Promise<import("@atlasauth/js").VerifyFactorResult>;
17
+ startSms: (phone: string) => Promise<import("@atlasauth/js").StartSmsResult>;
18
+ verifySms: (factorId: string, code: string) => Promise<import("@atlasauth/js").VerifyFactorResult>;
19
+ removeMfaFactor: (factorId: string) => Promise<import("@atlasauth/js").RemoveMfaFactorResult>;
20
+ regenerateBackupCodes: () => Promise<import("@atlasauth/js").RegenerateBackupCodesResult>;
21
+ listPasskeys: () => Promise<import("@atlasauth/js").AccountPasskeysResult>;
22
+ removePasskey: (id: string) => Promise<import("@atlasauth/js").RemovePasskeyResult>;
23
+ unlinkExternalAccount: (id: string) => Promise<import("@atlasauth/js").UnlinkExternalAccountResult>;
24
+ getNotificationPreferences: () => Promise<import("@atlasauth/js").NotificationPreferencesResult>;
25
+ updateNotificationPreferences: (preferences: Record<string, boolean>) => Promise<import("@atlasauth/js").NotificationPreferencesResult>;
26
+ } | null;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAccountSecurity = useAccountSecurity;
4
+ const react_1 = require("react");
5
+ const account_security_1 = require("./account-security");
6
+ const policies_1 = require("./policies");
7
+ /** `const { changePassword } = useAccountSecurity();` bound to the provider's bearer-authenticated client. */
8
+ function useAccountSecurity() {
9
+ const client = (0, policies_1.useExpoFapiClient)();
10
+ return (0, react_1.useMemo)(() => (client ? (0, account_security_1.createAccountSecurityActions)(client) : null), [client]);
11
+ }
12
+ //# sourceMappingURL=account-security-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account-security-hook.js","sourceRoot":"","sources":["../src/account-security-hook.ts"],"names":[],"mappings":";;AAKA,gDAGC;AARD,iCAAgC;AAChC,yDAAkE;AAClE,yCAA+C;AAE/C,8GAA8G;AAC9G,SAAgB,kBAAkB;IAChC,MAAM,MAAM,GAAG,IAAA,4BAAiB,GAAE,CAAC;IACnC,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,+CAA4B,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AACzF,CAAC"}
@@ -1,5 +1,15 @@
1
- import { changePassword, listTrustedDevices, revokeTrustedDevice, setPassword, type FapiClient } from '@atlasauth/js';
2
- export { changePassword, setPassword, listTrustedDevices, revokeTrustedDevice };
1
+ /**
2
+ * Change or set the signed-in user's password, manage trusted devices, sessions,
3
+ * two-factor methods, passkeys, linked accounts and notification preferences,
4
+ * from a native app. The provider's client authenticates with the stored session
5
+ * token as a bearer, so these work without a cookie.
6
+ *
7
+ * This module imports no React or React Native, so it is also the
8
+ * `@atlasauth/expo/account-security` subpath (usable in plain Node, tests, workers).
9
+ * The `useAccountSecurity` hook lives in `./account-security-hook`.
10
+ */
11
+ import { changePassword, getNotificationPreferences, listMfaFactors, listPasskeys, listSessions, listTrustedDevices, regenerateBackupCodes, removeMfaFactor, removePasskey, revokeAllSessions, revokeAllTrustedDevices, revokeAccountSession, revokeTrustedDevice, setPassword, startSms, startTotp, unlinkExternalAccount, updateNotificationPreferences, verifySms, verifyTotp, type FapiClient } from '@atlasauth/js';
12
+ export { changePassword, setPassword, listTrustedDevices, revokeTrustedDevice, revokeAllTrustedDevices, listSessions, revokeAccountSession, revokeAllSessions, listMfaFactors, startTotp, verifyTotp, startSms, verifySms, removeMfaFactor, regenerateBackupCodes, listPasskeys, removePasskey, unlinkExternalAccount, getNotificationPreferences, updateNotificationPreferences, };
3
13
  /** The calls bound to a client; separated from React so it is testable with a fake one. */
4
14
  export declare function createAccountSecurityActions(client: FapiClient): {
5
15
  changePassword: (input: {
@@ -9,14 +19,21 @@ export declare function createAccountSecurityActions(client: FapiClient): {
9
19
  setPassword: (password: string) => Promise<import("@atlasauth/js").SetPasswordResult>;
10
20
  listTrustedDevices: () => Promise<import("@atlasauth/js").TrustedDevicesResult>;
11
21
  revokeTrustedDevice: (id: string) => Promise<import("@atlasauth/js").RevokeTrustedDeviceResult>;
22
+ revokeAllTrustedDevices: () => Promise<import("@atlasauth/js").RevokeAllTrustedDevicesResult>;
23
+ listSessions: () => Promise<import("@atlasauth/js").AccountSessionsResult>;
24
+ revokeAccountSession: (id: string) => Promise<import("@atlasauth/js").RevokeSessionResult>;
25
+ revokeAllSessions: () => Promise<import("@atlasauth/js").RevokeOtherSessionsResult>;
26
+ listMfaFactors: () => Promise<import("@atlasauth/js").MfaFactorsResult>;
27
+ startTotp: () => Promise<import("@atlasauth/js").StartTotpResult>;
28
+ verifyTotp: (factorId: string, codes: string[]) => Promise<import("@atlasauth/js").VerifyFactorResult>;
29
+ startSms: (phone: string) => Promise<import("@atlasauth/js").StartSmsResult>;
30
+ verifySms: (factorId: string, code: string) => Promise<import("@atlasauth/js").VerifyFactorResult>;
31
+ removeMfaFactor: (factorId: string) => Promise<import("@atlasauth/js").RemoveMfaFactorResult>;
32
+ regenerateBackupCodes: () => Promise<import("@atlasauth/js").RegenerateBackupCodesResult>;
33
+ listPasskeys: () => Promise<import("@atlasauth/js").AccountPasskeysResult>;
34
+ removePasskey: (id: string) => Promise<import("@atlasauth/js").RemovePasskeyResult>;
35
+ unlinkExternalAccount: (id: string) => Promise<import("@atlasauth/js").UnlinkExternalAccountResult>;
36
+ getNotificationPreferences: () => Promise<import("@atlasauth/js").NotificationPreferencesResult>;
37
+ updateNotificationPreferences: (preferences: Record<string, boolean>) => Promise<import("@atlasauth/js").NotificationPreferencesResult>;
12
38
  };
13
- /** `const { changePassword } = useAccountSecurity();` bound to the provider's bearer-authenticated client. */
14
- export declare function useAccountSecurity(): {
15
- changePassword: (input: {
16
- currentPassword: string;
17
- newPassword: string;
18
- }) => Promise<import("@atlasauth/js").PasswordChangeResult>;
19
- setPassword: (password: string) => Promise<import("@atlasauth/js").SetPasswordResult>;
20
- listTrustedDevices: () => Promise<import("@atlasauth/js").TrustedDevicesResult>;
21
- revokeTrustedDevice: (id: string) => Promise<import("@atlasauth/js").RevokeTrustedDeviceResult>;
22
- } | null;
39
+ export type AccountSecurityActions = ReturnType<typeof createAccountSecurityActions>;
@@ -1,20 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.revokeTrustedDevice = exports.listTrustedDevices = exports.setPassword = exports.changePassword = void 0;
3
+ exports.updateNotificationPreferences = exports.getNotificationPreferences = exports.unlinkExternalAccount = exports.removePasskey = exports.listPasskeys = exports.regenerateBackupCodes = exports.removeMfaFactor = exports.verifySms = exports.startSms = exports.verifyTotp = exports.startTotp = exports.listMfaFactors = exports.revokeAllSessions = exports.revokeAccountSession = exports.listSessions = exports.revokeAllTrustedDevices = exports.revokeTrustedDevice = exports.listTrustedDevices = exports.setPassword = exports.changePassword = void 0;
4
4
  exports.createAccountSecurityActions = createAccountSecurityActions;
5
- exports.useAccountSecurity = useAccountSecurity;
6
5
  /**
7
- * Change or set the signed-in user's password, and manage trusted devices, from
8
- * a native app. The provider's client authenticates with the stored session
6
+ * Change or set the signed-in user's password, manage trusted devices, sessions,
7
+ * two-factor methods, passkeys, linked accounts and notification preferences,
8
+ * from a native app. The provider's client authenticates with the stored session
9
9
  * token as a bearer, so these work without a cookie.
10
+ *
11
+ * This module imports no React or React Native, so it is also the
12
+ * `@atlasauth/expo/account-security` subpath (usable in plain Node, tests, workers).
13
+ * The `useAccountSecurity` hook lives in `./account-security-hook`.
10
14
  */
11
- const react_1 = require("react");
12
15
  const js_1 = require("@atlasauth/js");
13
16
  Object.defineProperty(exports, "changePassword", { enumerable: true, get: function () { return js_1.changePassword; } });
17
+ Object.defineProperty(exports, "getNotificationPreferences", { enumerable: true, get: function () { return js_1.getNotificationPreferences; } });
18
+ Object.defineProperty(exports, "listMfaFactors", { enumerable: true, get: function () { return js_1.listMfaFactors; } });
19
+ Object.defineProperty(exports, "listPasskeys", { enumerable: true, get: function () { return js_1.listPasskeys; } });
20
+ Object.defineProperty(exports, "listSessions", { enumerable: true, get: function () { return js_1.listSessions; } });
14
21
  Object.defineProperty(exports, "listTrustedDevices", { enumerable: true, get: function () { return js_1.listTrustedDevices; } });
22
+ Object.defineProperty(exports, "regenerateBackupCodes", { enumerable: true, get: function () { return js_1.regenerateBackupCodes; } });
23
+ Object.defineProperty(exports, "removeMfaFactor", { enumerable: true, get: function () { return js_1.removeMfaFactor; } });
24
+ Object.defineProperty(exports, "removePasskey", { enumerable: true, get: function () { return js_1.removePasskey; } });
25
+ Object.defineProperty(exports, "revokeAllSessions", { enumerable: true, get: function () { return js_1.revokeAllSessions; } });
26
+ Object.defineProperty(exports, "revokeAllTrustedDevices", { enumerable: true, get: function () { return js_1.revokeAllTrustedDevices; } });
27
+ Object.defineProperty(exports, "revokeAccountSession", { enumerable: true, get: function () { return js_1.revokeAccountSession; } });
15
28
  Object.defineProperty(exports, "revokeTrustedDevice", { enumerable: true, get: function () { return js_1.revokeTrustedDevice; } });
16
29
  Object.defineProperty(exports, "setPassword", { enumerable: true, get: function () { return js_1.setPassword; } });
17
- const policies_1 = require("./policies");
30
+ Object.defineProperty(exports, "startSms", { enumerable: true, get: function () { return js_1.startSms; } });
31
+ Object.defineProperty(exports, "startTotp", { enumerable: true, get: function () { return js_1.startTotp; } });
32
+ Object.defineProperty(exports, "unlinkExternalAccount", { enumerable: true, get: function () { return js_1.unlinkExternalAccount; } });
33
+ Object.defineProperty(exports, "updateNotificationPreferences", { enumerable: true, get: function () { return js_1.updateNotificationPreferences; } });
34
+ Object.defineProperty(exports, "verifySms", { enumerable: true, get: function () { return js_1.verifySms; } });
35
+ Object.defineProperty(exports, "verifyTotp", { enumerable: true, get: function () { return js_1.verifyTotp; } });
18
36
  /** The calls bound to a client; separated from React so it is testable with a fake one. */
19
37
  function createAccountSecurityActions(client) {
20
38
  return {
@@ -22,11 +40,22 @@ function createAccountSecurityActions(client) {
22
40
  setPassword: (password) => (0, js_1.setPassword)(client, password),
23
41
  listTrustedDevices: () => (0, js_1.listTrustedDevices)(client),
24
42
  revokeTrustedDevice: (id) => (0, js_1.revokeTrustedDevice)(client, id),
43
+ revokeAllTrustedDevices: () => (0, js_1.revokeAllTrustedDevices)(client),
44
+ listSessions: () => (0, js_1.listSessions)(client),
45
+ revokeAccountSession: (id) => (0, js_1.revokeAccountSession)(client, id),
46
+ revokeAllSessions: () => (0, js_1.revokeAllSessions)(client),
47
+ listMfaFactors: () => (0, js_1.listMfaFactors)(client),
48
+ startTotp: () => (0, js_1.startTotp)(client),
49
+ verifyTotp: (factorId, codes) => (0, js_1.verifyTotp)(client, factorId, codes),
50
+ startSms: (phone) => (0, js_1.startSms)(client, phone),
51
+ verifySms: (factorId, code) => (0, js_1.verifySms)(client, factorId, code),
52
+ removeMfaFactor: (factorId) => (0, js_1.removeMfaFactor)(client, factorId),
53
+ regenerateBackupCodes: () => (0, js_1.regenerateBackupCodes)(client),
54
+ listPasskeys: () => (0, js_1.listPasskeys)(client),
55
+ removePasskey: (id) => (0, js_1.removePasskey)(client, id),
56
+ unlinkExternalAccount: (id) => (0, js_1.unlinkExternalAccount)(client, id),
57
+ getNotificationPreferences: () => (0, js_1.getNotificationPreferences)(client),
58
+ updateNotificationPreferences: (preferences) => (0, js_1.updateNotificationPreferences)(client, preferences),
25
59
  };
26
60
  }
27
- /** `const { changePassword } = useAccountSecurity();` bound to the provider's bearer-authenticated client. */
28
- function useAccountSecurity() {
29
- const client = (0, policies_1.useExpoFapiClient)();
30
- return (0, react_1.useMemo)(() => (client ? createAccountSecurityActions(client) : null), [client]);
31
- }
32
61
  //# sourceMappingURL=account-security.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account-security.js","sourceRoot":"","sources":["../src/account-security.ts"],"names":[],"mappings":";;;AAYA,oEAOC;AAGD,gDAGC;AAzBD;;;;GAIG;AACH,iCAAgC;AAChC,sCAAsH;AAG7G,+FAHA,mBAAc,OAGA;AAAe,mGAHb,uBAAkB,OAGa;AAAE,oGAHb,wBAAmB,OAGa;AAApD,4FAHyC,gBAAW,OAGzC;AAFpC,yCAA+C;AAI/C,2FAA2F;AAC3F,SAAgB,4BAA4B,CAAC,MAAkB;IAC7D,OAAO;QACL,cAAc,EAAE,CAAC,KAAuD,EAAE,EAAE,CAAC,IAAA,mBAAc,EAAC,MAAM,EAA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ChF,eAAe,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,IAAA,oBAAe,EAAC,MAAM,EAAE,QAAQ,CAAC;QACxE,qBAAqB,EAAE,GAAG,EAAE,CAAC,IAAA,0BAAqB,EAAC,MAAM,CAAC;QAC1D,YAAY,EAAE,GAAG,EAAE,CAAC,IAAA,iBAAY,EAAC,MAAM,CAAC;QACxC,aAAa,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,kBAAa,EAAC,MAAM,EAAE,EAAE,CAAC;QACxD,qBAAqB,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,0BAAqB,EAAC,MAAM,EAAE,EAAE,CAAC;QACxE,0BAA0B,EAAE,GAAG,EAAE,CAAC,IAAA,+BAA0B,EAAC,MAAM,CAAC;QACpE,6BAA6B,EAAE,CAAC,WAAoC,EAAE,EAAE,CAAC,IAAA,kCAA6B,EAAC,MAAM,EAAE,WAAW,CAAC;KAC5H,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -9,3 +9,5 @@ export * from './bridge';
9
9
  export * from './app-approval';
10
10
  export * from './account-security';
11
11
  export { getCaptchaToken, solveAtlasChallengeNative, atlasHeadlessCaptchaSolver, installAtlasCaptchaSolver, type SolveCaptchaOptions, type GetCaptchaTokenOptions, } from '@atlasauth/react-native';
12
+ export * from './account-security-hook';
13
+ export * from './step-up';
package/dist/index.js CHANGED
@@ -59,4 +59,6 @@ Object.defineProperty(exports, "getCaptchaToken", { enumerable: true, get: funct
59
59
  Object.defineProperty(exports, "solveAtlasChallengeNative", { enumerable: true, get: function () { return react_native_1.solveAtlasChallengeNative; } });
60
60
  Object.defineProperty(exports, "atlasHeadlessCaptchaSolver", { enumerable: true, get: function () { return react_native_1.atlasHeadlessCaptchaSolver; } });
61
61
  Object.defineProperty(exports, "installAtlasCaptchaSolver", { enumerable: true, get: function () { return react_native_1.installAtlasCaptchaSolver; } });
62
+ __exportStar(require("./account-security-hook"), exports);
63
+ __exportStar(require("./step-up"), exports);
62
64
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,kEAAkE;AAClE,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAEhC,8EAA8E;AAC9E,mDAAiC;AAEjC;;;;;;;;;;GAUG;AACH,0CAW0B;AAVxB,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA;AACR,kGAAA,SAAS,OAAA;AACT,gGAAA,OAAO,OAAA;AACP,qGAAA,YAAY,OAAA;AACZ,oGAAA,WAAW,OAAA;AAGb,oGAAoG;AACpG,6CAA2B;AAE3B,mGAAmG;AACnG,2CAAyB;AACzB,2CAAyB;AACzB,iDAA+B;AAC/B,qDAAmC;AAEnC,mFAAmF;AACnF,+EAA+E;AAC/E,4DAA4D;AAC5D,wDAOiC;AAN/B,+GAAA,eAAe,OAAA;AACf,yHAAA,yBAAyB,OAAA;AACzB,0HAAA,0BAA0B,OAAA;AAC1B,yHAAA,yBAAyB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2EAA2E;AAC3E,kEAAkE;AAClE,gDAA8B;AAC9B,gDAA8B;AAC9B,kDAAgC;AAEhC,8EAA8E;AAC9E,mDAAiC;AAEjC;;;;;;;;;;GAUG;AACH,0CAW0B;AAVxB,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,iGAAA,QAAQ,OAAA;AACR,kGAAA,SAAS,OAAA;AACT,gGAAA,OAAO,OAAA;AACP,qGAAA,YAAY,OAAA;AACZ,oGAAA,WAAW,OAAA;AAGb,oGAAoG;AACpG,6CAA2B;AAE3B,mGAAmG;AACnG,2CAAyB;AACzB,2CAAyB;AACzB,iDAA+B;AAC/B,qDAAmC;AAEnC,mFAAmF;AACnF,+EAA+E;AAC/E,4DAA4D;AAC5D,wDAOiC;AAN/B,+GAAA,eAAe,OAAA;AACf,yHAAA,yBAAyB,OAAA;AACzB,0HAAA,0BAA0B,OAAA;AAC1B,yHAAA,yBAAyB,OAAA;AAI3B,0DAAwC;AACxC,4CAA0B"}
@@ -0,0 +1,14 @@
1
+ import { type FapiClient, type StepUpFlowOptions } from '@atlasauth/js';
2
+ export type { StepUpChoice, StepUpFactor, StepUpRequest } from '@atlasauth/js';
3
+ export { StepUpCancelledError, stepUpRequirement } from '@atlasauth/js';
4
+ export type UseStepUpOptions = Omit<StepUpFlowOptions, 'client'>;
5
+ /** The step-up calls bound to a client; separated from React so it is testable with a fake one. */
6
+ export declare function createExpoStepUp(client: FapiClient, options: UseStepUpOptions): {
7
+ withStepUp<T>(call: () => Promise<import("@atlasauth/js").FapiResponse<T>>): Promise<import("@atlasauth/js").FapiResponse<T>>;
8
+ reauthenticate(action?: string): Promise<import("@atlasauth/js").StepUpResult>;
9
+ };
10
+ /** `withStepUp(call)` and `reauthenticate()` on the provider's bearer-authenticated client. */
11
+ export declare function useStepUp(options: UseStepUpOptions): {
12
+ withStepUp<T>(call: () => Promise<import("@atlasauth/js").FapiResponse<T>>): Promise<import("@atlasauth/js").FapiResponse<T>>;
13
+ reauthenticate(action?: string): Promise<import("@atlasauth/js").StepUpResult>;
14
+ };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stepUpRequirement = exports.StepUpCancelledError = void 0;
4
+ exports.createExpoStepUp = createExpoStepUp;
5
+ exports.useStepUp = useStepUp;
6
+ /**
7
+ * Re-authenticate from a native app, on the bearer session, with no sign-out.
8
+ *
9
+ * ```ts
10
+ * const { withStepUp } = useStepUp({
11
+ * choose: ({ factors, error }) => askWithYourOwnSheet(factors, error), // → { strategy: 'totp', code } | { strategy: 'passkey' } | null
12
+ * passkeyAssertion: nativePasskeyAssertion(Passkey), // from @atlasauth/expo-passkeys
13
+ * });
14
+ * const res = await withStepUp(() => enrollTotp(client));
15
+ * ```
16
+ *
17
+ * `choose` is only offered the factors the account holds and the refusal accepts.
18
+ * The re-minted session token the server returns is stored by the provider's token
19
+ * cache like any other rotated token.
20
+ */
21
+ const react_1 = require("react");
22
+ const js_1 = require("@atlasauth/js");
23
+ const policies_1 = require("./policies");
24
+ var js_2 = require("@atlasauth/js");
25
+ Object.defineProperty(exports, "StepUpCancelledError", { enumerable: true, get: function () { return js_2.StepUpCancelledError; } });
26
+ Object.defineProperty(exports, "stepUpRequirement", { enumerable: true, get: function () { return js_2.stepUpRequirement; } });
27
+ /** The step-up calls bound to a client; separated from React so it is testable with a fake one. */
28
+ function createExpoStepUp(client, options) {
29
+ return (0, js_1.createStepUp)({ client, ...options });
30
+ }
31
+ /** `withStepUp(call)` and `reauthenticate()` on the provider's bearer-authenticated client. */
32
+ function useStepUp(options) {
33
+ const client = (0, policies_1.useExpoFapiClient)();
34
+ // The latest callbacks without re-creating the actions on every render.
35
+ const latest = (0, react_1.useRef)(options);
36
+ latest.current = options;
37
+ return (0, react_1.useMemo)(() => createExpoStepUp(client, {
38
+ choose: (request) => latest.current.choose(request),
39
+ passkeyAssertion: (challenge) => {
40
+ const provider = latest.current.passkeyAssertion;
41
+ if (!provider)
42
+ throw new Error('Pass passkeyAssertion to useStepUp to use a passkey.');
43
+ return provider(challenge);
44
+ },
45
+ ...(options.maxAttempts ? { maxAttempts: options.maxAttempts } : {}),
46
+ }),
47
+ // eslint-disable-next-line react-hooks/exhaustive-deps
48
+ [client]);
49
+ }
50
+ //# sourceMappingURL=step-up.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-up.js","sourceRoot":"","sources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
2
  "name": "@atlasauth/expo",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ },
11
+ "./account-security": {
12
+ "types": "./dist/account-security.d.ts",
13
+ "default": "./dist/account-security.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "typesVersions": {
18
+ "*": {
19
+ "account-security": [
20
+ "./dist/account-security.d.ts"
21
+ ]
22
+ }
23
+ },
24
+ "sideEffects": [
25
+ "./dist/index.js"
26
+ ],
6
27
  "dependencies": {
7
- "@atlasauth/react-native": "^0.8.0",
8
- "@atlasauth/react": "^0.35.0"
28
+ "@atlasauth/react": "^0.35.0",
29
+ "@atlasauth/react-native": "^0.8.0"
9
30
  },
10
31
  "peerDependencies": {
11
- "@atlasauth/js": ">=0.40.0 <1.0.0",
32
+ "@atlasauth/js": ">=0.42.0 <1.0.0",
12
33
  "react": ">=18",
13
34
  "react-native": ">=0.73",
14
35
  "expo-secure-store": ">=12",
@@ -37,7 +58,7 @@
37
58
  "react": "^18.3.1",
38
59
  "typescript": "^5.6.3",
39
60
  "vitest": "^3.2.7",
40
- "@atlasauth/js": "0.40.0"
61
+ "@atlasauth/js": "0.42.0"
41
62
  },
42
63
  "publishConfig": {
43
64
  "access": "public"