@chipmobilesdk/rn-auth 0.4.0 → 0.6.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.
Files changed (180) hide show
  1. package/CHANGELOG.md +139 -0
  2. package/README.md +74 -14
  3. package/lib/commonjs/access/accessTier.js +111 -0
  4. package/lib/commonjs/access/accessTier.js.map +1 -0
  5. package/lib/commonjs/app-auth.js +13 -0
  6. package/lib/commonjs/app-auth.js.map +1 -0
  7. package/lib/commonjs/config/types.js +50 -0
  8. package/lib/commonjs/config/types.js.map +1 -0
  9. package/lib/commonjs/config/validateConfig.js +114 -0
  10. package/lib/commonjs/config/validateConfig.js.map +1 -0
  11. package/lib/commonjs/core/authMachine.js +406 -0
  12. package/lib/commonjs/core/authMachine.js.map +1 -0
  13. package/lib/commonjs/core/profile.js +59 -0
  14. package/lib/commonjs/core/profile.js.map +1 -0
  15. package/lib/commonjs/core/session.js +125 -0
  16. package/lib/commonjs/core/session.js.map +1 -0
  17. package/lib/commonjs/diagnostics/errors.js +83 -0
  18. package/lib/commonjs/diagnostics/errors.js.map +1 -0
  19. package/lib/commonjs/diagnostics/messageKeys.js +51 -0
  20. package/lib/commonjs/diagnostics/messageKeys.js.map +1 -0
  21. package/lib/commonjs/index.js +175 -0
  22. package/lib/commonjs/index.js.map +1 -0
  23. package/lib/commonjs/keychain.js +13 -0
  24. package/lib/commonjs/keychain.js.map +1 -0
  25. package/lib/commonjs/oidc/authClient.js +157 -0
  26. package/lib/commonjs/oidc/authClient.js.map +1 -0
  27. package/lib/commonjs/oidc/classifyError.js +65 -0
  28. package/lib/commonjs/oidc/classifyError.js.map +1 -0
  29. package/lib/commonjs/oidc/socialRouting.js +58 -0
  30. package/lib/commonjs/oidc/socialRouting.js.map +1 -0
  31. package/lib/commonjs/package.json +1 -0
  32. package/lib/commonjs/react/AuthProvider.js +37 -0
  33. package/lib/commonjs/react/AuthProvider.js.map +1 -0
  34. package/lib/commonjs/react/hooks.js +122 -0
  35. package/lib/commonjs/react/hooks.js.map +1 -0
  36. package/lib/commonjs/testing/conformance.js +148 -0
  37. package/lib/commonjs/testing/conformance.js.map +1 -0
  38. package/lib/commonjs/testing/index.js +53 -0
  39. package/lib/commonjs/testing/index.js.map +1 -0
  40. package/lib/commonjs/tokens/accessToken.js +165 -0
  41. package/lib/commonjs/tokens/accessToken.js.map +1 -0
  42. package/lib/commonjs/tokens/secureStore.js +60 -0
  43. package/lib/commonjs/tokens/secureStore.js.map +1 -0
  44. package/lib/module/access/accessTier.js +106 -0
  45. package/lib/module/access/accessTier.js.map +1 -0
  46. package/lib/module/app-auth.js +9 -0
  47. package/lib/module/app-auth.js.map +1 -0
  48. package/lib/module/config/types.js +46 -0
  49. package/lib/module/config/types.js.map +1 -0
  50. package/lib/module/config/validateConfig.js +110 -0
  51. package/lib/module/config/validateConfig.js.map +1 -0
  52. package/lib/module/core/authMachine.js +402 -0
  53. package/lib/module/core/authMachine.js.map +1 -0
  54. package/lib/module/core/profile.js +54 -0
  55. package/lib/module/core/profile.js.map +1 -0
  56. package/lib/module/core/session.js +118 -0
  57. package/lib/module/core/session.js.map +1 -0
  58. package/lib/module/diagnostics/errors.js +74 -0
  59. package/lib/module/diagnostics/errors.js.map +1 -0
  60. package/lib/module/diagnostics/messageKeys.js +46 -0
  61. package/lib/module/diagnostics/messageKeys.js.map +1 -0
  62. package/lib/module/index.js +33 -0
  63. package/lib/module/index.js.map +1 -0
  64. package/lib/module/keychain.js +9 -0
  65. package/lib/module/keychain.js.map +1 -0
  66. package/lib/module/oidc/authClient.js +152 -0
  67. package/lib/module/oidc/authClient.js.map +1 -0
  68. package/lib/module/oidc/classifyError.js +60 -0
  69. package/lib/module/oidc/classifyError.js.map +1 -0
  70. package/lib/module/oidc/socialRouting.js +52 -0
  71. package/lib/module/oidc/socialRouting.js.map +1 -0
  72. package/lib/module/package.json +1 -0
  73. package/lib/module/react/AuthProvider.js +31 -0
  74. package/lib/module/react/AuthProvider.js.map +1 -0
  75. package/lib/module/react/hooks.js +111 -0
  76. package/lib/module/react/hooks.js.map +1 -0
  77. package/lib/module/testing/conformance.js +140 -0
  78. package/lib/module/testing/conformance.js.map +1 -0
  79. package/lib/module/testing/index.js +25 -0
  80. package/lib/module/testing/index.js.map +1 -0
  81. package/lib/module/tokens/accessToken.js +161 -0
  82. package/lib/module/tokens/accessToken.js.map +1 -0
  83. package/lib/module/tokens/secureStore.js +56 -0
  84. package/lib/module/tokens/secureStore.js.map +1 -0
  85. package/lib/typescript/commonjs/access/accessTier.d.ts +14 -0
  86. package/lib/typescript/commonjs/access/accessTier.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/app-auth.d.ts +7 -0
  88. package/lib/typescript/commonjs/app-auth.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/config/types.d.ts +171 -0
  90. package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/config/validateConfig.d.ts +8 -0
  92. package/lib/typescript/commonjs/config/validateConfig.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/core/authMachine.d.ts +14 -0
  94. package/lib/typescript/commonjs/core/authMachine.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/core/profile.d.ts +15 -0
  96. package/lib/typescript/commonjs/core/profile.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/core/session.d.ts +60 -0
  98. package/lib/typescript/commonjs/core/session.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/diagnostics/errors.d.ts +37 -0
  100. package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts +57 -0
  102. package/lib/typescript/commonjs/diagnostics/messageKeys.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/index.d.ts +27 -0
  104. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/keychain.d.ts +7 -0
  106. package/lib/typescript/commonjs/keychain.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/oidc/authClient.d.ts +75 -0
  108. package/lib/typescript/commonjs/oidc/authClient.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/oidc/classifyError.d.ts +28 -0
  110. package/lib/typescript/commonjs/oidc/classifyError.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/oidc/socialRouting.d.ts +22 -0
  112. package/lib/typescript/commonjs/oidc/socialRouting.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/package.json +1 -0
  114. package/lib/typescript/commonjs/react/AuthProvider.d.ts +17 -0
  115. package/lib/typescript/commonjs/react/AuthProvider.d.ts.map +1 -0
  116. package/lib/typescript/commonjs/react/hooks.d.ts +42 -0
  117. package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/testing/conformance.d.ts +32 -0
  119. package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
  120. package/lib/typescript/commonjs/testing/index.d.ts +11 -0
  121. package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
  122. package/lib/typescript/commonjs/tokens/accessToken.d.ts +45 -0
  123. package/lib/typescript/commonjs/tokens/accessToken.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/tokens/secureStore.d.ts +26 -0
  125. package/lib/typescript/commonjs/tokens/secureStore.d.ts.map +1 -0
  126. package/lib/typescript/module/access/accessTier.d.ts +14 -0
  127. package/lib/typescript/module/access/accessTier.d.ts.map +1 -0
  128. package/lib/typescript/module/app-auth.d.ts +7 -0
  129. package/lib/typescript/module/app-auth.d.ts.map +1 -0
  130. package/lib/typescript/module/config/types.d.ts +171 -0
  131. package/lib/typescript/module/config/types.d.ts.map +1 -0
  132. package/lib/typescript/module/config/validateConfig.d.ts +8 -0
  133. package/lib/typescript/module/config/validateConfig.d.ts.map +1 -0
  134. package/lib/typescript/module/core/authMachine.d.ts +14 -0
  135. package/lib/typescript/module/core/authMachine.d.ts.map +1 -0
  136. package/lib/typescript/module/core/profile.d.ts +15 -0
  137. package/lib/typescript/module/core/profile.d.ts.map +1 -0
  138. package/lib/typescript/module/core/session.d.ts +60 -0
  139. package/lib/typescript/module/core/session.d.ts.map +1 -0
  140. package/lib/typescript/module/diagnostics/errors.d.ts +37 -0
  141. package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
  142. package/lib/typescript/module/diagnostics/messageKeys.d.ts +57 -0
  143. package/lib/typescript/module/diagnostics/messageKeys.d.ts.map +1 -0
  144. package/lib/typescript/module/index.d.ts +27 -0
  145. package/lib/typescript/module/index.d.ts.map +1 -0
  146. package/lib/typescript/module/keychain.d.ts +7 -0
  147. package/lib/typescript/module/keychain.d.ts.map +1 -0
  148. package/lib/typescript/module/oidc/authClient.d.ts +75 -0
  149. package/lib/typescript/module/oidc/authClient.d.ts.map +1 -0
  150. package/lib/typescript/module/oidc/classifyError.d.ts +28 -0
  151. package/lib/typescript/module/oidc/classifyError.d.ts.map +1 -0
  152. package/lib/typescript/module/oidc/socialRouting.d.ts +22 -0
  153. package/lib/typescript/module/oidc/socialRouting.d.ts.map +1 -0
  154. package/lib/typescript/module/package.json +1 -0
  155. package/lib/typescript/module/react/AuthProvider.d.ts +17 -0
  156. package/lib/typescript/module/react/AuthProvider.d.ts.map +1 -0
  157. package/lib/typescript/module/react/hooks.d.ts +42 -0
  158. package/lib/typescript/module/react/hooks.d.ts.map +1 -0
  159. package/lib/typescript/module/testing/conformance.d.ts +32 -0
  160. package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
  161. package/lib/typescript/module/testing/index.d.ts +11 -0
  162. package/lib/typescript/module/testing/index.d.ts.map +1 -0
  163. package/lib/typescript/module/tokens/accessToken.d.ts +45 -0
  164. package/lib/typescript/module/tokens/accessToken.d.ts.map +1 -0
  165. package/lib/typescript/module/tokens/secureStore.d.ts +26 -0
  166. package/lib/typescript/module/tokens/secureStore.d.ts.map +1 -0
  167. package/package.json +68 -21
  168. package/skills/sdk-rn-auth/SKILL.md +35 -2
  169. package/src/config/types.ts +53 -5
  170. package/src/config/validateConfig.ts +32 -1
  171. package/src/core/authMachine.ts +40 -6
  172. package/src/core/profile.ts +6 -1
  173. package/src/core/session.ts +49 -3
  174. package/src/diagnostics/errors.ts +7 -5
  175. package/src/index.ts +7 -0
  176. package/src/oidc/authClient.ts +19 -1
  177. package/src/oidc/classifyError.ts +2 -1
  178. package/src/oidc/socialRouting.ts +3 -1
  179. package/src/react/hooks.ts +53 -14
  180. package/src/tokens/accessToken.ts +20 -9
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * What any `SecureTokenStore` and `OidcAuthClient` must do (IOS-12, AUTH-13).
5
+ *
6
+ * The same checks run against the in-memory doubles and against the keychain and
7
+ * app-auth adapters (native modules mocked in Jest, or for real from a demo
8
+ * screen on a device), so a test that drives a double proves something about the
9
+ * device path. Each check builds its own subject through a harness.
10
+ */
11
+ import { ensure, runChecks } from '@chipmobilesdk/rn-core/testing';
12
+ const KEY = '@chipmobilesdk/rn-auth/conformance';
13
+ const OTHER_KEY = '@chipmobilesdk/rn-auth/conformance-other';
14
+ export const secureTokenStoreChecks = [{
15
+ name: 'reads nothing for a key never written',
16
+ async run(harness) {
17
+ const value = await harness.create().getItem(KEY);
18
+ ensure(value === null, `expected null, got ${JSON.stringify(value)}`);
19
+ }
20
+ }, {
21
+ name: 'reads back the last value written',
22
+ async run(harness) {
23
+ const store = harness.create();
24
+ await store.setItem(KEY, 'first');
25
+ await store.setItem(KEY, 'second');
26
+ const value = await store.getItem(KEY);
27
+ ensure(value === 'second', `expected the last write, got ${JSON.stringify(value)}`);
28
+ }
29
+ }, {
30
+ name: 'keeps keys apart',
31
+ async run(harness) {
32
+ const store = harness.create();
33
+ await store.setItem(KEY, 'one');
34
+ await store.setItem(OTHER_KEY, 'two');
35
+ await store.removeItem(OTHER_KEY);
36
+ ensure((await store.getItem(KEY)) === 'one', 'removing one key touched another');
37
+ }
38
+ }, {
39
+ name: 'forgets a removed key, and removes a missing key safely',
40
+ async run(harness) {
41
+ const store = harness.create();
42
+ await store.removeItem(KEY);
43
+ await store.setItem(KEY, 'value');
44
+ await store.removeItem(KEY);
45
+ ensure((await store.getItem(KEY)) === null, 'a removed key still reads back');
46
+ }
47
+ }, {
48
+ name: 'keeps a long session artifact with non-ASCII text intact',
49
+ async run(harness) {
50
+ const store = harness.create();
51
+ const artifact = JSON.stringify({
52
+ name: 'Nguyễn Ánh',
53
+ pad: 'x'.repeat(4096)
54
+ });
55
+ await store.setItem(KEY, artifact);
56
+ ensure((await store.getItem(KEY)) === artifact, 'the artifact changed on the way back');
57
+ }
58
+ }];
59
+ const SIGN_IN = {
60
+ authority: 'https://login.example.com/tenant/v2.0',
61
+ clientId: 'conformance-client',
62
+ redirectUrl: 'com.example.app://auth',
63
+ scopes: ['openid', 'offline_access']
64
+ };
65
+ function codeOf(error) {
66
+ return error?.code;
67
+ }
68
+ export const oidcAuthClientChecks = [{
69
+ name: 'signs in with an access token, the id-token claims and a future expiry',
70
+ async run(harness) {
71
+ const subject = harness.create();
72
+ subject.issues({
73
+ oid: 'user-1',
74
+ name: 'Ada'
75
+ });
76
+ const before = Date.now();
77
+ const tokens = await subject.client.authorize(SIGN_IN);
78
+ ensure(typeof tokens.accessToken === 'string' && tokens.accessToken !== '', 'no access token');
79
+ ensure(tokens.claims.oid === 'user-1', `claims ${JSON.stringify(tokens.claims)}`);
80
+ ensure(tokens.accessTokenExpiresAt === undefined || tokens.accessTokenExpiresAt > before, 'the access token expires in the past');
81
+ }
82
+ }, {
83
+ name: 'refreshes with a refresh token',
84
+ async run(harness) {
85
+ const subject = harness.create();
86
+ subject.issues({
87
+ oid: 'user-1'
88
+ });
89
+ const tokens = await subject.client.refresh({
90
+ ...SIGN_IN,
91
+ refreshToken: 'refresh-1'
92
+ });
93
+ ensure(typeof tokens.accessToken === 'string' && tokens.accessToken !== '', 'no access token');
94
+ }
95
+ }, {
96
+ name: 'reports a closed sign-in sheet as provider-cancelled',
97
+ async run(harness) {
98
+ const subject = harness.create();
99
+ subject.userCancels();
100
+ let code;
101
+ try {
102
+ await subject.client.authorize(SIGN_IN);
103
+ } catch (error) {
104
+ code = codeOf(error);
105
+ }
106
+ ensure(code === 'provider-cancelled', `expected provider-cancelled, got ${String(code)}`);
107
+ }
108
+ }, {
109
+ name: 'reports a rejected refresh token as session-expired',
110
+ async run(harness) {
111
+ const subject = harness.create();
112
+ subject.rejectsRefresh();
113
+ let code;
114
+ try {
115
+ await subject.client.refresh({
116
+ ...SIGN_IN,
117
+ refreshToken: 'revoked'
118
+ });
119
+ } catch (error) {
120
+ code = codeOf(error);
121
+ }
122
+ ensure(code === 'session-expired', `expected session-expired, got ${String(code)}`);
123
+ }
124
+ }, {
125
+ name: 'ends the session',
126
+ async run(harness) {
127
+ const subject = harness.create();
128
+ await subject.client.endSession({
129
+ ...SIGN_IN,
130
+ idToken: undefined
131
+ });
132
+ }
133
+ }];
134
+ export function runSecureTokenStoreConformance(harness) {
135
+ return runChecks(() => harness, secureTokenStoreChecks);
136
+ }
137
+ export function runOidcAuthClientConformance(harness) {
138
+ return runChecks(() => harness, oidcAuthClientChecks);
139
+ }
140
+ //# sourceMappingURL=conformance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ensure","runChecks","KEY","OTHER_KEY","secureTokenStoreChecks","name","run","harness","value","create","getItem","JSON","stringify","store","setItem","removeItem","artifact","pad","repeat","SIGN_IN","authority","clientId","redirectUrl","scopes","codeOf","error","code","oidcAuthClientChecks","subject","issues","oid","before","Date","now","tokens","client","authorize","accessToken","claims","accessTokenExpiresAt","undefined","refresh","refreshToken","userCancels","String","rejectsRefresh","endSession","idToken","runSecureTokenStoreConformance","runOidcAuthClientConformance"],"sourceRoot":"../../../src","sources":["testing/conformance.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACCA,MAAM,EACNC,SAAS,QAGH,gCAAgC;AAwBvC,MAAMC,GAAG,GAAG,oCAAoC;AAChD,MAAMC,SAAS,GAAG,0CAA0C;AAE5D,OAAO,MAAMC,sBAA4D,GAAG,CA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AS,CAAC,MAAMM,OAAO,EAAEoB,oBAAoB,CAAC;AACtD","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * `@chipmobilesdk/rn-auth/testing`: test doubles and the port conformance suites.
5
+ *
6
+ * A separate entrypoint so neither can reach a production bundle.
7
+ */
8
+
9
+ /** A `SecureTokenStore` held in memory, for tests and for the conformance suite. */
10
+ export function createMemorySecureStore(seed = {}) {
11
+ const values = new Map(Object.entries(seed));
12
+ return {
13
+ async getItem(key) {
14
+ return values.get(key) ?? null;
15
+ },
16
+ async setItem(key, value) {
17
+ values.set(key, value);
18
+ },
19
+ async removeItem(key) {
20
+ values.delete(key);
21
+ }
22
+ };
23
+ }
24
+ export { oidcAuthClientChecks, runOidcAuthClientConformance, runSecureTokenStoreConformance, secureTokenStoreChecks } from "./conformance.js";
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createMemorySecureStore","seed","values","Map","Object","entries","getItem","key","get","setItem","value","set","removeItem","delete","oidcAuthClientChecks","runOidcAuthClientConformance","runSecureTokenStoreConformance","secureTokenStoreChecks"],"sourceRoot":"../../../src","sources":["testing/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAGA;AACA,OAAO,SAASA,uBAAuBA,CAACC,IAA4B,GAAG,CAAC,CAAC,EAAoB;EAC5F,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAiBC,MAAM,CAACC,OAAO,CAACJ,IAAI,CAAC,CAAC;EAC5D,OAAO;IACN,MAAMK,OAAOA,CAACC,GAAG,EAAE;MAClB,OAAOL,MAAM,CAACM,GAAG,CAACD,GAAG,CAAC,IAAI,IAAI;IAC/B,CAAC;IACD,MAAME,OAAOA,CAACF,GAAG,EAAEG,KAAK,EAAE;MACzBR,MAAM,CAACS,GAAG,CAACJ,GAAG,EAAEG,KAAK,CAAC;IACvB,CAAC;IACD,MAAME,UAAUA,CAACL,GAAG,EAAE;MACrBL,MAAM,CAACW,MAAM,CAACN,GAAG,CAAC;IACnB;EACD,CAAC;AACF;AAEA,SACCO,oBAAoB,EACpBC,4BAA4B,EAC5BC,8BAA8B,EAC9BC,sBAAsB,QAChB,kBAAe","ignoreList":[]}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Per-resource delegated access-token acquisition with an in-memory cache and
5
+ * silent refresh (FR-007, PERF-003, R4). Access tokens are never persisted to
6
+ * disk (FR-021) — only kept in memory keyed by resource until expiry.
7
+ */
8
+
9
+ import { isAuthError } from "../diagnostics/errors.js";
10
+ const EXPIRY_SKEW_MS = 60_000;
11
+ const SESSION_ENDED = {
12
+ status: 'unavailable',
13
+ errorCode: 'session-expired'
14
+ };
15
+ export function createAccessTokenManager(deps) {
16
+ const cache = new Map();
17
+ /**
18
+ * Refreshes in progress, by resource. Concurrent callers for one resource
19
+ * share a single network call; with a rotating refresh token, a second call
20
+ * would race the first with a token the first may have just retired.
21
+ */
22
+ const inFlight = new Map();
23
+ const fresh = resourceKey => {
24
+ const cached = cache.get(resourceKey);
25
+ return cached && cached.expiresAt - EXPIRY_SKEW_MS > Date.now() ? cached : undefined;
26
+ };
27
+ const refresh = async resource => {
28
+ const resourceKey = resource.key;
29
+ const epoch = deps.sessionEpoch();
30
+ const refreshToken = deps.getRefreshToken();
31
+ if (!refreshToken) {
32
+ return {
33
+ resourceKey,
34
+ ...SESSION_ENDED
35
+ };
36
+ }
37
+ try {
38
+ const tokens = await deps.authClient.refresh({
39
+ authority: deps.authority,
40
+ clientId: deps.clientId,
41
+ redirectUrl: deps.redirectUrl,
42
+ refreshToken,
43
+ scopes: resource.scopes
44
+ });
45
+ // Signed out, or signed in as someone else, while this was in flight:
46
+ // nothing from it may be written back, and its token is not handed out.
47
+ if (deps.sessionEpoch() !== epoch) {
48
+ return {
49
+ resourceKey,
50
+ ...SESSION_ENDED
51
+ };
52
+ }
53
+ if (tokens.refreshToken && tokens.refreshToken !== refreshToken) {
54
+ await deps.onRefreshTokenRotated(tokens.refreshToken, epoch);
55
+ if (deps.sessionEpoch() !== epoch) {
56
+ return {
57
+ resourceKey,
58
+ ...SESSION_ENDED
59
+ };
60
+ }
61
+ }
62
+ if (!tokens.accessToken) {
63
+ return {
64
+ resourceKey,
65
+ status: 'error',
66
+ errorCode: 'token-acquisition-failed'
67
+ };
68
+ }
69
+ const expiresAt = tokens.accessTokenExpiresAt ?? Date.now() + 3_600_000;
70
+ cache.set(resourceKey, {
71
+ token: tokens.accessToken,
72
+ expiresAt
73
+ });
74
+ return {
75
+ resourceKey,
76
+ status: 'success',
77
+ token: tokens.accessToken,
78
+ expiresAt
79
+ };
80
+ } catch (error) {
81
+ if (isAuthError(error)) {
82
+ if (error.code === 'consent-denied') {
83
+ return {
84
+ resourceKey,
85
+ status: 'denied',
86
+ errorCode: error.code
87
+ };
88
+ }
89
+ if (error.code === 'network-unavailable') {
90
+ return {
91
+ resourceKey,
92
+ status: 'unavailable',
93
+ errorCode: error.code
94
+ };
95
+ }
96
+ if (error.code === 'session-expired') {
97
+ return {
98
+ resourceKey,
99
+ status: 'unavailable',
100
+ errorCode: error.code
101
+ };
102
+ }
103
+ return {
104
+ resourceKey,
105
+ status: 'error',
106
+ errorCode: error.code
107
+ };
108
+ }
109
+ return {
110
+ resourceKey,
111
+ status: 'error',
112
+ errorCode: 'token-acquisition-failed'
113
+ };
114
+ }
115
+ };
116
+ return {
117
+ clear() {
118
+ cache.clear();
119
+ inFlight.clear();
120
+ },
121
+ hasFreshToken(resourceKey) {
122
+ return fresh(resourceKey) !== undefined;
123
+ },
124
+ request(resourceKey, options = {}) {
125
+ const resource = deps.resources.find(entry => entry.key === resourceKey);
126
+ if (!resource) {
127
+ return Promise.resolve({
128
+ resourceKey,
129
+ status: 'error',
130
+ errorCode: 'configuration-error'
131
+ });
132
+ }
133
+ if (options.forceRefresh === true) {
134
+ // Dropped, not just skipped: the token is known bad, so no later
135
+ // caller should be handed it either.
136
+ cache.delete(resourceKey);
137
+ }
138
+ const cached = options.forceRefresh === true ? undefined : fresh(resourceKey);
139
+ if (cached) {
140
+ return Promise.resolve({
141
+ resourceKey,
142
+ status: 'success',
143
+ token: cached.token,
144
+ expiresAt: cached.expiresAt
145
+ });
146
+ }
147
+ const running = inFlight.get(resourceKey);
148
+ if (running) {
149
+ return running;
150
+ }
151
+ const flight = refresh(resource).finally(() => {
152
+ if (inFlight.get(resourceKey) === flight) {
153
+ inFlight.delete(resourceKey);
154
+ }
155
+ });
156
+ inFlight.set(resourceKey, flight);
157
+ return flight;
158
+ }
159
+ };
160
+ }
161
+ //# sourceMappingURL=accessToken.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isAuthError","EXPIRY_SKEW_MS","SESSION_ENDED","status","errorCode","createAccessTokenManager","deps","cache","Map","inFlight","fresh","resourceKey","cached","get","expiresAt","Date","now","undefined","refresh","resource","key","epoch","sessionEpoch","refreshToken","getRefreshToken","tokens","authClient","authority","clientId","redirectUrl","scopes","onRefreshTokenRotated","accessToken","accessTokenExpiresAt","set","token","error","code","clear","hasFreshToken","request","options","resources","find","entry","Promise","resolve","forceRefresh","delete","running","flight","finally"],"sourceRoot":"../../../src","sources":["tokens/accessToken.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAIA,SAASA,WAAW,QAAQ,0BAAuB;AAEnD,MAAMC,cAAc,GAAG,MAAM;AA8C7B,MAAMC,aAAqD,GAAG;EAC7DC,MAAM,EAAE,aAAa;EACrBC,SAAS,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,wBAAwBA,CAACC,IAA4B,EAAsB;EAC1F,MAAMC,KAAK,GAAG,IAAIC,GAAG,CAAsB,CAAC;EAC5C;AACD;AACA;AACA;AACA;EACC,MAAMC,QAAQ,GAAG,IAAID,GAAG,CAAqC,CAAC;EAE9D,MAAME,KAAK,GAAIC,WAAmB,IAA8B;IAC/D,MAAMC,MAAM,GAAGL,KAAK,CAACM,GAAG,CAACF,WAAW,CAAC;IACrC,OAAOC,MAAM,IA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IACd;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * SecureTokenStore port + default react-native-keychain adapter (FR-021, R2).
5
+ *
6
+ * Refresh tokens and the session-restore artifact persist ONLY through this
7
+ * port, backed by platform secure storage (iOS Keychain / Android Keystore).
8
+ * Access tokens are never written here — they stay in memory (see accessToken).
9
+ * The default adapter loads the native module on its first read or write, so
10
+ * creating it, and unit tests that inject a fake, load no native code.
11
+ */
12
+
13
+ import { lazyPeer } from '@chipmobilesdk/rn-core';
14
+ import { AuthConfigError } from "../diagnostics/errors.js";
15
+
16
+ /** Single key under which the persisted session artifact is stored. */
17
+ export const AUTH_STORAGE_KEY = '@chipmobilesdk/rn-auth/session';
18
+ /**
19
+ * Default secure store backed by react-native-keychain. Each logical key maps to
20
+ * a Keychain "service" so multiple keys can coexist. Validated on device.
21
+ */
22
+ export function createKeychainSecureStore(options = {}) {
23
+ // The native module loads on the first read or write, never at startup (PERF-05).
24
+ const accessible = () => options.accessible ?? keychain().ACCESSIBLE?.WHEN_UNLOCKED_THIS_DEVICE_ONLY;
25
+ return {
26
+ async getItem(key) {
27
+ const result = await keychain().getGenericPassword({
28
+ service: key
29
+ });
30
+ return result ? result.password : null;
31
+ },
32
+ async setItem(key, value) {
33
+ await keychain().setGenericPassword('token', value, {
34
+ service: key,
35
+ accessible: accessible()
36
+ });
37
+ },
38
+ async removeItem(key) {
39
+ await keychain().resetGenericPassword({
40
+ service: key
41
+ });
42
+ }
43
+ };
44
+ }
45
+ const keychainPeer = lazyPeer('react-native-keychain', () => {
46
+ // Inside `try`, so Metro bundles an app that leaves this optional peer out.
47
+ try {
48
+ return require('react-native-keychain');
49
+ } catch (cause) {
50
+ throw cause;
51
+ }
52
+ });
53
+ function keychain() {
54
+ return keychainPeer.require(peer => new AuthConfigError('auth.error.configuration', `${peer} is not installed or its native module is not linked`));
55
+ }
56
+ //# sourceMappingURL=secureStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["lazyPeer","AuthConfigError","AUTH_STORAGE_KEY","createKeychainSecureStore","options","accessible","keychain","ACCESSIBLE","WHEN_UNLOCKED_THIS_DEVICE_ONLY","getItem","key","result","getGenericPassword","service","password","setItem","value","setGenericPassword","removeItem","resetGenericPassword","keychainPeer","require","cause","peer"],"sourceRoot":"../../../src","sources":["tokens/secureStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,wBAAwB;AAEjD,SAASC,eAAe,QAAQ,0BAAuB;;AAEvD;AACA,OAAO,MAAMC,gBAAgB,GAAG,gCAAgC;AAahE;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACxCC,OAAmC,GAAG,CAAC,CAAC,EACrB;EACnB;EACA,MAAMC,UAAU,GAAGA,CAAA,KAClBD,OAAO,CAACC,UAAU,IAAIC,QAAQ,CAAC,CAAC,CAACC,UAAU,EAAEC,8BAA8B;EAE5E,OAAO;IACN,MAAMC,OAAOA,CAACC,GAAG,EAAE;MAClB,MAAMC,MAAM,GAAG,MAAML,QAAQ,CAAC,CAAC,CAACM,kBAAkB,CAAC;QAAEC,OAAO,EAAEH;MAAI,CAAC,CAAC;MACpE,OAAOC,MAAM,GAAGA,MAAM,CAACG,QAAQ,GAAG,IAAI;IACvC,CAAC;IACD,MAAMC,OAAOA,CAACL,GAAG,EAAEM,KAAK,EAAE;MACzB,MAAMV,QAAQ,CAAC,CAAC,CAACW,kBAAkB,CAAC,OAAO,EAAED,KAAK,EAAE;QACnDH,OAAO,EAAEH,GAAG;QACZL,UAAU,EAAEA,UAAU,CAAC;MACxB,CAAC,CAAC;IACH,CAAC;IACD,MAAMa,UAAUA,CAACR,GAAG,EAAE;MACrB,MAAMJ,QAAQ,CAAC,CAAC,CAACa,oBAAoB,CAAC;QAAEN,OAAO,EAAEH;MAAI,CAAC,CAAC;IACxD;EACD,CAAC;AACF;AAaA,MAAMU,YAAY,GAAGpB,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EAC5D;EACA,IAAI;IACH,OAAOqB,OAAO,CAAC,uBAAuB,CAAC;EACxC,CAAC,CAAC,OAAOC,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;AAEF,SAAShB,QAAQA,CAAA,EAAmB;EACnC,OAAOc,YAAY,CAACC,OAAO,CAC1BE,IAAI,IACH,IAAItB,eAAe,CAClB,0BAA0B,EAC1B,GAAGsB,IAAI,sDACR,CACF,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Access-tier evaluation (FR-010/FR-011/FR-019/FR-020, R6).
3
+ *
4
+ * Pure function over the authenticated token's claims and the app-specific
5
+ * mapping. Object ids are authoritative; display names never grant access.
6
+ * Missing, stale, ambiguous, or group-overage claims fail closed (premium
7
+ * denied, verification = 'unverified').
8
+ */
9
+ import type { AccessTier, AccessTierMapping } from '../config/types';
10
+ /** The fail-closed default: free + unverified. */
11
+ export declare function failClosedTier(): AccessTier;
12
+ /** Evaluate the access tier, failing closed when entitlement is unverifiable. */
13
+ export declare function evaluateAccessTier(claims: Record<string, unknown>, mapping: AccessTierMapping, now?: number): AccessTier;
14
+ //# sourceMappingURL=accessTier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessTier.d.ts","sourceRoot":"","sources":["../../../../src/access/accessTier.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAEnF,kDAAkD;AAClD,wBAAgB,cAAc,IAAI,UAAU,CAE3C;AAoCD,iFAAiF;AACjF,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,EAAE,iBAAiB,EAC1B,GAAG,GAAE,MAAmB,GACtB,UAAU,CAgCZ"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `@chipmobilesdk/rn-auth/app-auth`: the default OIDC client over
3
+ * react-native-app-auth (AUTH-09). Its own entrypoint, so an app that injects its
4
+ * own client never reaches this module.
5
+ */
6
+ export { createAppAuthClient, type AppAuthClientOptions } from './oidc/authClient';
7
+ //# sourceMappingURL=app-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-auth.d.ts","sourceRoot":"","sources":["../../../src/app-auth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Public type contracts for @chipmobilesdk/rn-auth. Shapes follow
3
+ * specs/003-mobile-entra-auth/data-model.md.
4
+ */
5
+ import type { AccessTokenRequestOptions } from '../tokens/accessToken';
6
+ import type { SecureTokenStore } from '../tokens/secureStore';
7
+ import type { OidcAuthClient } from '../oidc/authClient';
8
+ import type { AuthError, AuthErrorCode } from '../diagnostics/errors';
9
+ import type { AuthMessageKey, AuthMessageMap } from '../diagnostics/messageKeys';
10
+ /** The providers this package has copy for out of the box. */
11
+ export type KnownProviderId = 'google' | 'apple' | 'facebook';
12
+ /**
13
+ * A provider id. Open on purpose: routing is `domain_hint` and nothing else, so
14
+ * adding an IdP the tenant federates — Microsoft account, an email one-time
15
+ * code — is a change to an app's config, not a release of this package
16
+ * (AUTH-14). `KnownProviderId` keeps the three familiar ones in autocomplete.
17
+ */
18
+ export type ProviderId = KnownProviderId | (string & {});
19
+ export type DevicePlatform = 'ios' | 'android';
20
+ export declare const DEVICE_PLATFORMS: readonly DevicePlatform[];
21
+ /** Provider Setup Configuration — non-secret public values only (FR-016/FR-017). */
22
+ export interface ProviderConfig {
23
+ id: ProviderId;
24
+ platforms: DevicePlatform[];
25
+ /** External ID `domain_hint` routing the user flow to this IdP (R3). */
26
+ domainHint: string;
27
+ /**
28
+ * Message key for the button label (Continue with Google / Apple). A key of
29
+ * this package's catalogue, or one of the app's own for a provider it added.
30
+ */
31
+ labelKey: AuthMessageKey | (string & {});
32
+ available?: boolean;
33
+ /**
34
+ * Extra OIDC authorize parameters for this provider, merged after
35
+ * `domain_hint` — `prompt`, `login_hint`, whatever the tenant's user flow
36
+ * expects. `domain_hint` itself cannot be overridden here.
37
+ */
38
+ additionalParameters?: Record<string, string>;
39
+ }
40
+ /** One configured protected resource for delegated token requests (FR-007). */
41
+ export interface ResourceConfig {
42
+ key: string;
43
+ scopes: string[];
44
+ displayName?: string;
45
+ }
46
+ export interface ClaimMatcher {
47
+ claim: string;
48
+ equals: string | number | boolean;
49
+ }
50
+ /** App-specific mapping from tenant indicators to access tiers (FR-019/FR-020). */
51
+ export interface AccessTierMapping {
52
+ /** Stable group object ids granting premium — authoritative (FR-020). */
53
+ premiumGroupObjectIds: string[];
54
+ premiumRoleNames?: string[];
55
+ premiumClaimMatchers?: ClaimMatcher[];
56
+ /** Diagnostics-only object-id → name map; never used for decisions (FR-020). */
57
+ groupDisplayNames?: Record<string, string>;
58
+ }
59
+ /** App-supplied, public-only setup input (FR-015/FR-016/FR-017). */
60
+ export interface AuthConfig {
61
+ authority: string;
62
+ clientId: string;
63
+ redirectUrl: string;
64
+ scopes: string[];
65
+ providers: ProviderConfig[];
66
+ resources?: ResourceConfig[];
67
+ accessTierMapping: AccessTierMapping;
68
+ secureStore: SecureTokenStore;
69
+ authClient?: OidcAuthClient;
70
+ /**
71
+ * Copy overrides for this package's own message keys, resolved over the
72
+ * English defaults and readable through `auth.getMessages()` and
73
+ * `useAuthMessages()`.
74
+ */
75
+ messages?: Partial<AuthMessageMap>;
76
+ }
77
+ /** Advanced/testing options. `platform` overrides the detected device platform. */
78
+ export interface CreateAuthOptions {
79
+ platform?: DevicePlatform;
80
+ }
81
+ export type AuthStatus = 'loading' | 'signed-out' | 'authenticating' | 'authenticated' | 'token-refreshing' | 'access-denied' | 'cancelled' | 'error';
82
+ export type RestoreStatus = 'pending' | 'restored' | 'unavailable' | 'offline';
83
+ /** Customer User / app-visible profile (FR-006). */
84
+ export interface Profile {
85
+ tenantUserId: string;
86
+ displayName?: string | undefined;
87
+ email?: string | undefined;
88
+ provider: string;
89
+ /**
90
+ * The id-token claims this profile was mapped from. Empty after a restore
91
+ * that could not reach the provider: the stored artifact holds the identity,
92
+ * not the token (AUTH-23). Read `restore` on the state to tell the two apart.
93
+ */
94
+ claims: Record<string, unknown>;
95
+ }
96
+ export interface ProviderIdentity {
97
+ provider: string;
98
+ subject: string;
99
+ emailBehavior: 'direct' | 'private-relay' | 'none';
100
+ }
101
+ /** Access Tier — local interpretation of tenant indicators (FR-010). */
102
+ export interface AccessTier {
103
+ tier: 'free' | 'premium';
104
+ source: 'group' | 'role' | 'claim' | 'default';
105
+ verification: 'verified' | 'unverified';
106
+ lastRefreshAt?: number;
107
+ }
108
+ export type AccessTokenStatus = 'success' | 'denied' | 'unavailable' | 'error';
109
+ /** Access Token Request result (FR-007). */
110
+ export interface AccessTokenResult {
111
+ resourceKey: string;
112
+ status: AccessTokenStatus;
113
+ token?: string;
114
+ expiresAt?: number;
115
+ errorCode?: AuthErrorCode;
116
+ }
117
+ /** Single active app-visible authenticated state (FR-005/FR-022). */
118
+ export interface AuthState {
119
+ status: AuthStatus;
120
+ profile?: Profile | undefined;
121
+ accessTier?: AccessTier | undefined;
122
+ restore: RestoreStatus;
123
+ error?: AuthError | undefined;
124
+ }
125
+ /** Result of a premium-only gate check (US3). */
126
+ export interface PremiumGateResult {
127
+ allowed: boolean;
128
+ tier: AccessTier;
129
+ }
130
+ /**
131
+ * What `signOutGlobal` did beyond the device (added in 0.2.2). Local state is
132
+ * cleared either way; `failed` means the tenant session may still be alive, so
133
+ * the next interactive sign-in can complete without a password prompt.
134
+ */
135
+ export interface GlobalSignOutResult {
136
+ global: 'ended' | 'failed';
137
+ /** Present when `global` is `failed`. Redacted like every AuthError. */
138
+ error?: AuthError;
139
+ }
140
+ /** The auth controller returned by `createAuth` (single active account). */
141
+ export interface Auth {
142
+ getState(): AuthState;
143
+ subscribe(listener: (state: AuthState) => void): () => void;
144
+ restore(): Promise<AuthState>;
145
+ signIn(providerId: ProviderId): Promise<AuthState>;
146
+ signOut(): Promise<void>;
147
+ signOutGlobal(): Promise<GlobalSignOutResult>;
148
+ /**
149
+ * A delegated token for one configured resource. Answers from the in-memory
150
+ * cache while the token is unexpired; `forceRefresh` skips and drops that
151
+ * cache, which is what a caller whose token was just rejected needs.
152
+ */
153
+ requestAccessToken(resourceKey: string, options?: AccessTokenRequestOptions): Promise<AccessTokenResult>;
154
+ getAccessTier(): AccessTier;
155
+ /** Whether a premium-only path is open, and the tier behind the answer. Reads nothing else and changes nothing (FR-011). */
156
+ canAccessPremium(): PremiumGateResult;
157
+ /**
158
+ * @deprecated Use `canAccessPremium` and show the denial where it happened.
159
+ * This also moves the whole controller to `access-denied`, which every screen
160
+ * reading `status` then sees, and only a `restore` or a sign-in leaves
161
+ * (AUTH-12). Kept for 0.4.x.
162
+ */
163
+ requirePremium(): PremiumGateResult;
164
+ /** This package's copy: the English defaults with the app's `messages` over them. */
165
+ getMessages(): AuthMessageMap;
166
+ /** The first available provider to present on the current platform (UX-004), or undefined. */
167
+ getPlatformProvider(): ProviderConfig | undefined;
168
+ /** All available providers for the current platform, in configuration order (FR-003/FR-004). */
169
+ getPlatformProviders(): ProviderConfig[];
170
+ }
171
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/config/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,cA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,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,aAAa,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC9C;;;;OAIG;IACH,kBAAkB,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,yBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,aAAa,IAAI,UAAU,CAAC;IAC5B,4HAA4H;IAC5H,gBAAgB,IAAI,iBAAiB,CAAC;IACtC;;;;;OAKG;IACH,cAAc,IAAI,iBAAiB,CAAC;IACpC,qFAAqF;IACrF,WAAW,IAAI,cAAc,CAAC;IAC9B,8FAA8F;IAC9F,mBAAmB,IAAI,cAAc,GAAG,SAAS,CAAC;IAClD,gGAAgG;IAChG,oBAAoB,IAAI,cAAc,EAAE,CAAC;CACzC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Deterministic configuration validation (FR-005 → configuration-error).
3
+ * Throws AuthConfigError before any provider flow can start (US4 scenario 2).
4
+ * Covers the auth-config.md Section A–F rules.
5
+ */
6
+ import { type AuthConfig } from './types';
7
+ export declare function validateConfig(config: AuthConfig): void;
8
+ //# sourceMappingURL=validateConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateConfig.d.ts","sourceRoot":"","sources":["../../../../src/config/validateConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAe5D,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CA2HvD"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Auth state machine / orchestrator (FR-005, FR-022, R5, R7). Holds the single
3
+ * active session, wires the OidcAuthClient + SecureTokenStore ports, profile
4
+ * mapping, access-tier evaluation, per-resource tokens, restore, and sign-out.
5
+ *
6
+ * Every operation that starts or ends a session bumps `sessionEpoch`. Work that
7
+ * awaited across such a change — a token refresh, a restore, an authorize —
8
+ * compares the epoch it started with before writing anything back, so a sign-out
9
+ * can never be undone by a request that was already in flight.
10
+ */
11
+ import type { Auth, AuthConfig, CreateAuthOptions, Profile } from '../config/types';
12
+ export declare function createAuthMachine(config: AuthConfig, options?: CreateAuthOptions): Auth;
13
+ export type { Profile };
14
+ //# sourceMappingURL=authMachine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authMachine.d.ts","sourceRoot":"","sources":["../../../../src/core/authMachine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,OAAO,KAAK,EACX,IAAI,EACJ,UAAU,EAEV,iBAAiB,EAIjB,OAAO,EAEP,MAAM,iBAAiB,CAAC;AAwBzB,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI,CAmW3F;AAED,YAAY,EAAE,OAAO,EAAE,CAAC"}