@atlasauth/expo 0.1.0 → 0.1.1

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 ADDED
@@ -0,0 +1,19 @@
1
+ # @atlasauth/expo changelog
2
+
3
+ ## 0.1.1
4
+ - **`frontendApi` is validated at mount (via `@atlasauth/react`) and in `createNativeSessionManager()`.** A missing, empty or malformed value now throws an
5
+ `AtlasConfigError` (from `@atlasauth/js`; `code: 'FRONTEND_API_REQUIRED'` or `'FRONTEND_API_INVALID'`)
6
+ instead of silently sending requests to relative URLs on the app's own origin. Accepted: an absolute
7
+ `https:` URL (`http:` only for localhost / local development hosts). Native apps have no origin of their own, so `"same-origin"` is refused by the native session manager.
8
+
9
+ ## 0.1.0
10
+
11
+ First published release.
12
+
13
+ ### Added
14
+ - `AtlasProvider` for Expo that carries the session as a bearer token instead of a cookie.
15
+ - `createSecureStoreTokenCache()` backed by `expo-secure-store`, and `createInMemoryTokenCache()` for Expo Go and tests.
16
+ - `createCacheFetch()`, `tokenStorageFor()` and `createInMemoryStorage()` token-storage helpers.
17
+ - Native session management: `createNativeSessionManager()` and `clearNativeSession()`.
18
+ - Re-exports `useAuth`, `useUser`, `useSession`, `useSessionList`, `useOrganization`, `SignedIn`, `SignedOut`, `Protect`, `AtlasLoading` and `AtlasLoaded` from `@atlasauth/react`.
19
+ - `expo-secure-store`, `expo-web-browser` and `expo-auth-session` are optional peers.
@@ -30,10 +30,16 @@ const token_cache_1 = require("./token-cache");
30
30
  * adapter via the manager's `persist` hook.
31
31
  */
32
32
  async function createNativeSessionManager(config) {
33
+ // A native app has no origin of its own, so "same-origin" / a bare path is
34
+ // refused along with a missing value.
35
+ const baseUrl = (0, js_1.resolveFrontendApi)(config.frontendApi, {
36
+ component: 'createNativeSessionManager()',
37
+ allowSameOrigin: false,
38
+ });
33
39
  const storage = config.storage ?? (0, token_cache_1.createInMemoryStorage)();
34
40
  const initial = (0, js_1.parseNativeSession)(await storage.getToken()) ?? undefined;
35
41
  return new js_1.NativeSessionManager({
36
- baseUrl: config.frontendApi,
42
+ baseUrl,
37
43
  publishableKey: config.publishableKey,
38
44
  clientId: config.clientId,
39
45
  initial,
@@ -1 +1 @@
1
- {"version":3,"file":"native-session.js","sourceRoot":"","sources":["../src/native-session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAqCH,gEAsBC;AAGD,gDAEC;AA9DD,sCAKuB;AACvB,+CAAyE;AAqBzE;;;;;;;GAOG;AACI,KAAK,UAAU,0BAA0B,CAC9C,MAA2B;IAE3B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAA,mCAAqB,GAAE,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAA,uBAAkB,EAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,SAAS,CAAC;IAE1E,OAAO,IAAI,yBAAoB,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC,WAAW;QAC3B,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO;QACP,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,2EAA2E;QAC3E,2EAA2E;QAC3E,6EAA6E;QAC7E,OAAO,EAAE,CAAC,OAAsB,EAAE,EAAE;YAClC,KAAK,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAA,2BAAsB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAC3E,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,qDAAqD;AAC9C,KAAK,UAAU,kBAAkB,CAAC,OAAqB;IAC5D,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC;AAED,oCAAyE;AAAhE,0GAAA,oBAAoB,OAAA;AAC7B,oCAA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CAAyE;AAAhE,0GAAA,oBAAoB,OAAA;AAC7B,oCAAyE;AAAhE,wGAAA,kBAAkB,OAAA;AAAE,0GAAA,oBAAoB,OAAA"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlasauth/expo",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {
7
- "@atlasauth/js": "0.2.0",
8
- "@atlasauth/react": "0.1.30"
7
+ "@atlasauth/react": "0.5.0",
8
+ "@atlasauth/js": "0.6.0"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "react": ">=18",
@@ -42,7 +42,8 @@
42
42
  },
43
43
  "files": [
44
44
  "dist",
45
- "README.md"
45
+ "README.md",
46
+ "CHANGELOG.md"
46
47
  ],
47
48
  "scripts": {
48
49
  "build": "tsc -p tsconfig.build.json",