@pollar/core 0.6.0 → 0.7.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.
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Pluggable storage interface used by `PollarClient` to persist session and
3
+ * key material. All operations are async to accommodate native backends like
4
+ * Expo SecureStore and react-native-keychain whose underlying APIs are async.
5
+ */
6
+ interface Storage {
7
+ get(key: string): Promise<string | null>;
8
+ set(key: string, value: string): Promise<void>;
9
+ remove(key: string): Promise<void>;
10
+ }
11
+ /**
12
+ * Reasons emitted via `onStorageDegrade` when a primary storage backend
13
+ * silently degrades to in-memory mode (e.g. Safari private mode quota errors,
14
+ * sandboxed iframes without `allow-same-origin`, disabled storage).
15
+ */
16
+ type StorageDegradeReason = 'unavailable' | 'probe-failed' | 'read-failed' | 'write-failed' | 'remove-failed' | 'quota-exceeded';
17
+ type OnStorageDegrade = (reason: StorageDegradeReason, error?: unknown) => void;
18
+
19
+ export type { OnStorageDegrade as O, Storage as S, StorageDegradeReason as a };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Pluggable storage interface used by `PollarClient` to persist session and
3
+ * key material. All operations are async to accommodate native backends like
4
+ * Expo SecureStore and react-native-keychain whose underlying APIs are async.
5
+ */
6
+ interface Storage {
7
+ get(key: string): Promise<string | null>;
8
+ set(key: string, value: string): Promise<void>;
9
+ remove(key: string): Promise<void>;
10
+ }
11
+ /**
12
+ * Reasons emitted via `onStorageDegrade` when a primary storage backend
13
+ * silently degrades to in-memory mode (e.g. Safari private mode quota errors,
14
+ * sandboxed iframes without `allow-same-origin`, disabled storage).
15
+ */
16
+ type StorageDegradeReason = 'unavailable' | 'probe-failed' | 'read-failed' | 'write-failed' | 'remove-failed' | 'quota-exceeded';
17
+ type OnStorageDegrade = (reason: StorageDegradeReason, error?: unknown) => void;
18
+
19
+ export type { OnStorageDegrade as O, Storage as S, StorageDegradeReason as a };
package/package.json CHANGED
@@ -1,12 +1,23 @@
1
1
  {
2
2
  "name": "@pollar/core",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Core authentication functions for Pollar services",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
+ "react-native": "./dist/index.rn.mjs",
8
9
  "exports": {
9
10
  ".": {
11
+ "react-native": {
12
+ "import": {
13
+ "types": "./dist/index.rn.d.mts",
14
+ "default": "./dist/index.rn.mjs"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.rn.d.ts",
18
+ "default": "./dist/index.rn.js"
19
+ }
20
+ },
10
21
  "import": {
11
22
  "types": "./dist/index.d.mts",
12
23
  "default": "./dist/index.mjs"
@@ -15,24 +26,65 @@
15
26
  "types": "./dist/index.d.ts",
16
27
  "default": "./dist/index.js"
17
28
  }
29
+ },
30
+ "./adapters/expo": {
31
+ "import": {
32
+ "types": "./dist/adapters/expo-secure-store.d.mts",
33
+ "default": "./dist/adapters/expo-secure-store.mjs"
34
+ },
35
+ "require": {
36
+ "types": "./dist/adapters/expo-secure-store.d.ts",
37
+ "default": "./dist/adapters/expo-secure-store.js"
38
+ }
39
+ },
40
+ "./adapters/react-native-keychain": {
41
+ "import": {
42
+ "types": "./dist/adapters/react-native-keychain.d.mts",
43
+ "default": "./dist/adapters/react-native-keychain.mjs"
44
+ },
45
+ "require": {
46
+ "types": "./dist/adapters/react-native-keychain.d.ts",
47
+ "default": "./dist/adapters/react-native-keychain.js"
48
+ }
18
49
  }
19
50
  },
20
51
  "files": [
21
52
  "dist"
22
53
  ],
23
- "sideEffects": false,
54
+ "sideEffects": [
55
+ "./dist/index.mjs",
56
+ "./dist/index.js",
57
+ "./dist/index.rn.mjs",
58
+ "./dist/index.rn.js"
59
+ ],
24
60
  "scripts": {
25
61
  "build": "tsup",
26
62
  "dev": "tsup --watch",
27
63
  "lint": "tsc --noEmit",
28
64
  "clean": "rm -rf dist"
29
65
  },
66
+ "engines": {
67
+ "node": ">=20"
68
+ },
30
69
  "devDependencies": {
31
70
  "tsup": "^8.3.0",
32
71
  "typescript": "^5.7.0"
33
72
  },
34
73
  "dependencies": {
74
+ "@noble/curves": "~1.9.7",
35
75
  "@stellar/freighter-api": "^2.0.0",
36
76
  "openapi-fetch": "^0.17.0"
77
+ },
78
+ "peerDependencies": {
79
+ "expo-secure-store": ">=12",
80
+ "react-native-keychain": ">=8"
81
+ },
82
+ "peerDependenciesMeta": {
83
+ "expo-secure-store": {
84
+ "optional": true
85
+ },
86
+ "react-native-keychain": {
87
+ "optional": true
88
+ }
37
89
  }
38
90
  }