@symbiote-native/secure-store 0.1.0 → 0.3.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 +25 -24
- package/build/core/index.d.ts +1 -1
- package/build-ngc/core/index.d.ts +1 -1
- package/build-ngc/core/native-module.js.map +1 -1
- package/build-ngc/core/secure-store.js.map +1 -1
- package/package.json +46 -18
- package/src/core/index.ts +4 -1
- package/src/core/native-module.ts +26 -6
- package/src/core/secure-store.ts +27 -9
- package/build/react/index.d.ts +0 -1
- package/build/react/index.js +0 -5
- package/build/vue/index.d.ts +0 -1
- package/build/vue/index.js +0 -4
- package/src/react/index.ts +0 -5
- package/src/vue/index.ts +0 -4
package/README.md
CHANGED
|
@@ -26,12 +26,12 @@ Unlike a plain RN native module, `expo-secure-store`'s native code is discovered
|
|
|
26
26
|
`expo-modules-autolinking` — this needs wiring into the native host app **once**, covering this
|
|
27
27
|
package and every other `expo-modules-core` package with zero further changes:
|
|
28
28
|
|
|
29
|
-
| Platform | Touches
|
|
30
|
-
|
|
31
|
-
| iOS
|
|
32
|
-
| iOS
|
|
33
|
-
| Android
|
|
34
|
-
| Android
|
|
29
|
+
| Platform | Touches |
|
|
30
|
+
| -------- | ------------------------------------------------------------------------------------- |
|
|
31
|
+
| iOS | `ios/Podfile` — add `use_expo_modules!` |
|
|
32
|
+
| iOS | `AppDelegate.swift` — Expo's runtime-bootstrap hook |
|
|
33
|
+
| Android | `settings.gradle` / `app/build.gradle` — resolve and include the Expo Gradle projects |
|
|
34
|
+
| Android | `MainApplication.kt` — Expo's bootstrap hook, plus a native-module name map |
|
|
35
35
|
|
|
36
36
|
Full mechanics live in the `symbiote-expo-native-module` skill. The per-package half of that
|
|
37
37
|
table — the Gradle dependency, the module map entry, the `NSFaceIDUsageDescription` string, and
|
|
@@ -62,17 +62,16 @@ describe the rule files).
|
|
|
62
62
|
src/core/ the whole API: seven keychain-accessibility constants plus the
|
|
63
63
|
get/set/delete surface. native-module.ts resolves ExpoSecureStore
|
|
64
64
|
through expo-modules-core's requireNativeModule.
|
|
65
|
-
src/react/ @symbiote-native/secure-store/react
|
|
66
|
-
src/vue/ @symbiote-native/secure-store/vue
|
|
67
65
|
src/angular/ @symbiote-native/secure-store/angular
|
|
68
66
|
```
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
or service to wrap, the same reason
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
`./react`, `./vue`, and `./svelte` are `exports`-map aliases straight onto `src/core/` — no
|
|
69
|
+
physical per-framework file. Upstream ships free functions and constants — no per-instance state,
|
|
70
|
+
no event stream — so there is nothing for a hook, composable, or service to wrap, the same reason
|
|
71
|
+
[`@symbiote-native/local-auth`](../local-auth) does the same. `./angular` stays a physical
|
|
72
|
+
file/subpath since Angular ships through a separate `ngc`/AOT build (`build-ngc/`). Import from
|
|
73
|
+
`@symbiote-native/secure-store` directly if you don't care which adapter you're on; the
|
|
74
|
+
per-adapter subpaths exist so every wrapper package has the same import surface.
|
|
76
75
|
|
|
77
76
|
## Use it
|
|
78
77
|
|
|
@@ -103,20 +102,22 @@ Values are strings. JSON-encode anything else:
|
|
|
103
102
|
|
|
104
103
|
```ts
|
|
105
104
|
await SecureStore.setItemAsync('profile', JSON.stringify(profile));
|
|
106
|
-
const profile = JSON.parse(
|
|
105
|
+
const profile = JSON.parse(
|
|
106
|
+
(await SecureStore.getItemAsync('profile')) ?? 'null',
|
|
107
|
+
);
|
|
107
108
|
```
|
|
108
109
|
|
|
109
110
|
## API
|
|
110
111
|
|
|
111
|
-
| Export
|
|
112
|
-
|
|
113
|
-
| `isAvailableAsync`
|
|
114
|
-
| `getItemAsync`
|
|
115
|
-
| `getItem`
|
|
116
|
-
| `setItemAsync`
|
|
117
|
-
| `setItem`
|
|
118
|
-
| `deleteItemAsync`
|
|
119
|
-
| `canUseBiometricAuthentication`
|
|
112
|
+
| Export | Signature | Notes |
|
|
113
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
114
|
+
| `isAvailableAsync` | `() => Promise<boolean>` | `true` on Android and iOS. Says nothing about permissions. |
|
|
115
|
+
| `getItemAsync` | `(key, options?) => Promise<string \| null>` | `null` when there is no entry, or when the key has been invalidated. |
|
|
116
|
+
| `getItem` | `(key, options?) => string \| null` | Blocks the JS thread. |
|
|
117
|
+
| `setItemAsync` | `(key, value, options?) => Promise<void>` | Rejects if the value cannot be stored. |
|
|
118
|
+
| `setItem` | `(key, value, options?) => void` | Blocks the JS thread. |
|
|
119
|
+
| `deleteItemAsync` | `(key, options?) => Promise<void>` | |
|
|
120
|
+
| `canUseBiometricAuthentication` | `() => boolean` | Whether `requireAuthentication` can be used at all. |
|
|
120
121
|
| `AFTER_FIRST_UNLOCK`, `AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY`, `ALWAYS`, `ALWAYS_THIS_DEVICE_ONLY`, `WHEN_PASSCODE_SET_THIS_DEVICE_ONLY`, `WHEN_UNLOCKED`, `WHEN_UNLOCKED_THIS_DEVICE_ONLY` | `IKeychainAccessibilityConstant \| undefined` | Values for `options.keychainAccessible`. iOS only — Android's native module declares none of them, so they read `undefined` there. `ALWAYS` and `ALWAYS_THIS_DEVICE_ONLY` are deprecated upstream. |
|
|
121
122
|
|
|
122
123
|
`ISecureStoreOptions`: `keychainService`, `requireAuthentication`, `authenticationPrompt`,
|
package/build/core/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AFTER_FIRST_UNLOCK, AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY, ALWAYS, ALWAYS_THIS_DEVICE_ONLY, WHEN_PASSCODE_SET_THIS_DEVICE_ONLY, WHEN_UNLOCKED, WHEN_UNLOCKED_THIS_DEVICE_ONLY, isAvailableAsync, getItemAsync, getItem, setItemAsync, setItem, deleteItemAsync, canUseBiometricAuthentication, } from './secure-store';
|
|
2
|
-
export type { IKeychainAccessibilityConstant, ISecureStoreOptions } from './types';
|
|
2
|
+
export type { IKeychainAccessibilityConstant, ISecureStoreOptions, } from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { AFTER_FIRST_UNLOCK, AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY, ALWAYS, ALWAYS_THIS_DEVICE_ONLY, WHEN_PASSCODE_SET_THIS_DEVICE_ONLY, WHEN_UNLOCKED, WHEN_UNLOCKED_THIS_DEVICE_ONLY, isAvailableAsync, getItemAsync, getItem, setItemAsync, setItem, deleteItemAsync, canUseBiometricAuthentication, } from './secure-store';
|
|
2
|
-
export type { IKeychainAccessibilityConstant, ISecureStoreOptions } from './types';
|
|
2
|
+
export type { IKeychainAccessibilityConstant, ISecureStoreOptions, } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAMxD,MAAM,6BAA6B,GAAG,iBAAiB,CAAC;AA0CxD,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAChD,6BAA6B,CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secure-store.js","sourceRoot":"","sources":["../../src/core/secure-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"secure-store.js","sourceRoot":"","sources":["../../src/core/secure-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,E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BAAkB,EAAE,iBAAiB,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,eAAe,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B;IAC3C,IAAI,CAAC,eAAe,CAAC,6BAA6B,EAAE,CAAC;QACnD,MAAM,IAAI,mBAAmB,CAC3B,kBAAkB,EAClB,+BAA+B,CAChC,CAAC;IACJ,CAAC;IACD,OAAO,eAAe,CAAC,6BAA6B,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CACb,0HAA0H,CAC3H,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,6HAA6H,CAC9H,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/secure-store",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "expo-secure-store wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, and Angular adapters. Encrypted key-value storage in the iOS Keychain and the Android Keystore, optionally gated behind biometrics.",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "expo-secure-store wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Encrypted key-value storage in the iOS Keychain and the Android Keystore, optionally gated behind biometrics.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -23,12 +23,20 @@
|
|
|
23
23
|
"default": "./build/core/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./vue": {
|
|
26
|
-
"types": "./build/
|
|
27
|
-
"default": "./build/
|
|
26
|
+
"types": "./build/core/index.d.ts",
|
|
27
|
+
"default": "./build/core/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./react": {
|
|
30
|
-
"types": "./build/
|
|
31
|
-
"default": "./build/
|
|
30
|
+
"types": "./build/core/index.d.ts",
|
|
31
|
+
"default": "./build/core/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./svelte": {
|
|
34
|
+
"types": "./build/core/index.d.ts",
|
|
35
|
+
"default": "./build/core/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./solid": {
|
|
38
|
+
"types": "./build/core/index.d.ts",
|
|
39
|
+
"default": "./build/core/index.js"
|
|
32
40
|
},
|
|
33
41
|
"./angular": {
|
|
34
42
|
"types": "./build-ngc/angular/index.d.ts",
|
|
@@ -53,15 +61,19 @@
|
|
|
53
61
|
"expo-modules-core": "57.0.5"
|
|
54
62
|
},
|
|
55
63
|
"peerDependencies": {
|
|
64
|
+
"@symbiote-native/angular": ">=0.6.2",
|
|
56
65
|
"@symbiote-native/engine": ">=0.1.7",
|
|
66
|
+
"@symbiote-native/react": ">=0.2.8",
|
|
67
|
+
"@symbiote-native/solid": ">=0.0.1",
|
|
68
|
+
"@symbiote-native/svelte": ">=0.1.0",
|
|
69
|
+
"@symbiote-native/vue": ">=0.3.8",
|
|
57
70
|
"@angular/core": ">=20",
|
|
58
71
|
"@vue/runtime-core": "^3.5.13",
|
|
59
72
|
"react": ">=19.0.0",
|
|
60
73
|
"react-native": ">=0.86",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"@symbiote-native/vue": "0.3.8"
|
|
74
|
+
"solid-js": ">=1.9.0",
|
|
75
|
+
"svelte": ">=5.56.0",
|
|
76
|
+
"vue": ">=3.5.0"
|
|
65
77
|
},
|
|
66
78
|
"peerDependenciesMeta": {
|
|
67
79
|
"@symbiote-native/angular": {
|
|
@@ -70,6 +82,12 @@
|
|
|
70
82
|
"@symbiote-native/react": {
|
|
71
83
|
"optional": true
|
|
72
84
|
},
|
|
85
|
+
"@symbiote-native/solid": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"@symbiote-native/svelte": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
73
91
|
"@symbiote-native/vue": {
|
|
74
92
|
"optional": true
|
|
75
93
|
},
|
|
@@ -82,24 +100,34 @@
|
|
|
82
100
|
"react": {
|
|
83
101
|
"optional": true
|
|
84
102
|
},
|
|
103
|
+
"solid-js": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"svelte": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
85
109
|
"vue": {
|
|
86
110
|
"optional": true
|
|
87
111
|
}
|
|
88
112
|
},
|
|
89
113
|
"devDependencies": {
|
|
90
|
-
"@angular/compiler": "
|
|
91
|
-
"@angular/compiler-cli": "
|
|
92
|
-
"@angular/core": "
|
|
114
|
+
"@angular/compiler": "~22.0.8",
|
|
115
|
+
"@angular/compiler-cli": "~22.0.8",
|
|
116
|
+
"@angular/core": "~22.0.8",
|
|
93
117
|
"@types/node": "^26.0.0",
|
|
94
118
|
"@types/react": "^19.2.0",
|
|
95
119
|
"@vue/runtime-core": "^3.5.13",
|
|
96
120
|
"react": "19.2.3",
|
|
121
|
+
"solid-js": "^1.9.14",
|
|
122
|
+
"svelte": "^5.56.0",
|
|
97
123
|
"typescript": "~6.0.0",
|
|
98
|
-
"@symbiote-native/angular": "0.
|
|
99
|
-
"@symbiote-native/engine": "0.
|
|
100
|
-
"@symbiote-native/react": "0.
|
|
101
|
-
"@symbiote-native/
|
|
102
|
-
"@symbiote-native/
|
|
124
|
+
"@symbiote-native/angular": "0.8.0",
|
|
125
|
+
"@symbiote-native/engine": "0.3.0",
|
|
126
|
+
"@symbiote-native/react": "0.4.0",
|
|
127
|
+
"@symbiote-native/solid": "0.1.0",
|
|
128
|
+
"@symbiote-native/svelte": "0.3.0",
|
|
129
|
+
"@symbiote-native/test-utils": "0.2.0",
|
|
130
|
+
"@symbiote-native/vue": "0.5.0"
|
|
103
131
|
},
|
|
104
132
|
"scripts": {
|
|
105
133
|
"typecheck": "tsc --build",
|
package/src/core/index.ts
CHANGED
|
@@ -14,4 +14,7 @@ export {
|
|
|
14
14
|
deleteItemAsync,
|
|
15
15
|
canUseBiometricAuthentication,
|
|
16
16
|
} from './secure-store';
|
|
17
|
-
export type {
|
|
17
|
+
export type {
|
|
18
|
+
IKeychainAccessibilityConstant,
|
|
19
|
+
ISecureStoreOptions,
|
|
20
|
+
} from './types';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
IKeychainAccessibilityConstant,
|
|
4
|
+
ISecureStoreOptions,
|
|
5
|
+
} from './types';
|
|
3
6
|
|
|
4
7
|
const EXPO_SECURE_STORE_MODULE_NAME = 'ExpoSecureStore';
|
|
5
8
|
|
|
@@ -18,11 +21,28 @@ export type INativeSecureStoreModule = {
|
|
|
18
21
|
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY?: IKeychainAccessibilityConstant;
|
|
19
22
|
WHEN_UNLOCKED?: IKeychainAccessibilityConstant;
|
|
20
23
|
WHEN_UNLOCKED_THIS_DEVICE_ONLY?: IKeychainAccessibilityConstant;
|
|
21
|
-
getValueWithKeyAsync?(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
getValueWithKeyAsync?(
|
|
25
|
+
key: string,
|
|
26
|
+
options: ISecureStoreOptions,
|
|
27
|
+
): Promise<string | null>;
|
|
28
|
+
getValueWithKeySync?(
|
|
29
|
+
key: string,
|
|
30
|
+
options: ISecureStoreOptions,
|
|
31
|
+
): string | null;
|
|
32
|
+
setValueWithKeyAsync?(
|
|
33
|
+
value: string,
|
|
34
|
+
key: string,
|
|
35
|
+
options: ISecureStoreOptions,
|
|
36
|
+
): Promise<boolean>;
|
|
37
|
+
setValueWithKeySync?(
|
|
38
|
+
value: string,
|
|
39
|
+
key: string,
|
|
40
|
+
options: ISecureStoreOptions,
|
|
41
|
+
): boolean;
|
|
42
|
+
deleteValueWithKeyAsync?(
|
|
43
|
+
key: string,
|
|
44
|
+
options: ISecureStoreOptions,
|
|
45
|
+
): Promise<void>;
|
|
26
46
|
canUseBiometricAuthentication?(): boolean;
|
|
27
47
|
};
|
|
28
48
|
|
package/src/core/secure-store.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
|
|
3
3
|
import { expoSecureStore } from './native-module';
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
IKeychainAccessibilityConstant,
|
|
6
|
+
ISecureStoreOptions,
|
|
7
|
+
} from './types';
|
|
5
8
|
|
|
6
9
|
const NATIVE_MODULE_NAME = 'expo-secure-store';
|
|
7
10
|
|
|
@@ -22,7 +25,8 @@ export const AFTER_FIRST_UNLOCK: IKeychainAccessibilityConstant | undefined =
|
|
|
22
25
|
* from a backup.
|
|
23
26
|
* @platform ios
|
|
24
27
|
*/
|
|
25
|
-
export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY:
|
|
28
|
+
export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY:
|
|
29
|
+
IKeychainAccessibilityConstant | undefined =
|
|
26
30
|
expoSecureStore.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY;
|
|
27
31
|
|
|
28
32
|
/**
|
|
@@ -30,7 +34,8 @@ export const AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: IKeychainAccessibilityConstant
|
|
|
30
34
|
* @deprecated Use a level that offers some user protection, such as `AFTER_FIRST_UNLOCK`.
|
|
31
35
|
* @platform ios
|
|
32
36
|
*/
|
|
33
|
-
export const ALWAYS: IKeychainAccessibilityConstant | undefined =
|
|
37
|
+
export const ALWAYS: IKeychainAccessibilityConstant | undefined =
|
|
38
|
+
expoSecureStore.ALWAYS;
|
|
34
39
|
|
|
35
40
|
/**
|
|
36
41
|
* Like `ALWAYS`, except the entry does not migrate to a new device when restoring from a backup.
|
|
@@ -38,7 +43,8 @@ export const ALWAYS: IKeychainAccessibilityConstant | undefined = expoSecureStor
|
|
|
38
43
|
* `AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY`.
|
|
39
44
|
* @platform ios
|
|
40
45
|
*/
|
|
41
|
-
export const ALWAYS_THIS_DEVICE_ONLY:
|
|
46
|
+
export const ALWAYS_THIS_DEVICE_ONLY:
|
|
47
|
+
IKeychainAccessibilityConstant | undefined =
|
|
42
48
|
expoSecureStore.ALWAYS_THIS_DEVICE_ONLY;
|
|
43
49
|
|
|
44
50
|
/**
|
|
@@ -46,7 +52,8 @@ export const ALWAYS_THIS_DEVICE_ONLY: IKeychainAccessibilityConstant | undefined
|
|
|
46
52
|
* entry at all. Removing the passcode deletes the entry.
|
|
47
53
|
* @platform ios
|
|
48
54
|
*/
|
|
49
|
-
export const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY:
|
|
55
|
+
export const WHEN_PASSCODE_SET_THIS_DEVICE_ONLY:
|
|
56
|
+
IKeychainAccessibilityConstant | undefined =
|
|
50
57
|
expoSecureStore.WHEN_PASSCODE_SET_THIS_DEVICE_ONLY;
|
|
51
58
|
|
|
52
59
|
/**
|
|
@@ -61,7 +68,8 @@ export const WHEN_UNLOCKED: IKeychainAccessibilityConstant | undefined =
|
|
|
61
68
|
* backup.
|
|
62
69
|
* @platform ios
|
|
63
70
|
*/
|
|
64
|
-
export const WHEN_UNLOCKED_THIS_DEVICE_ONLY:
|
|
71
|
+
export const WHEN_UNLOCKED_THIS_DEVICE_ONLY:
|
|
72
|
+
IKeychainAccessibilityConstant | undefined =
|
|
65
73
|
expoSecureStore.WHEN_UNLOCKED_THIS_DEVICE_ONLY;
|
|
66
74
|
|
|
67
75
|
/**
|
|
@@ -97,7 +105,10 @@ export async function getItemAsync(
|
|
|
97
105
|
* > Blocks the JavaScript thread. With `requireAuthentication` on, the app stays unresponsive
|
|
98
106
|
* > until the user authenticates.
|
|
99
107
|
*/
|
|
100
|
-
export function getItem(
|
|
108
|
+
export function getItem(
|
|
109
|
+
key: string,
|
|
110
|
+
options: ISecureStoreOptions = {},
|
|
111
|
+
): string | null {
|
|
101
112
|
ensureValidKey(key);
|
|
102
113
|
if (!expoSecureStore.getValueWithKeySync) {
|
|
103
114
|
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getItem');
|
|
@@ -128,7 +139,11 @@ export async function setItemAsync(
|
|
|
128
139
|
* > Blocks the JavaScript thread. With `requireAuthentication` on, the app stays unresponsive
|
|
129
140
|
* > until the user authenticates.
|
|
130
141
|
*/
|
|
131
|
-
export function setItem(
|
|
142
|
+
export function setItem(
|
|
143
|
+
key: string,
|
|
144
|
+
value: string,
|
|
145
|
+
options: ISecureStoreOptions = {},
|
|
146
|
+
): void {
|
|
132
147
|
ensureValidKey(key);
|
|
133
148
|
ensureValidValue(value);
|
|
134
149
|
if (!expoSecureStore.setValueWithKeySync) {
|
|
@@ -155,7 +170,10 @@ export async function deleteItemAsync(
|
|
|
155
170
|
*/
|
|
156
171
|
export function canUseBiometricAuthentication(): boolean {
|
|
157
172
|
if (!expoSecureStore.canUseBiometricAuthentication) {
|
|
158
|
-
throw new UnavailabilityError(
|
|
173
|
+
throw new UnavailabilityError(
|
|
174
|
+
NATIVE_MODULE_NAME,
|
|
175
|
+
'canUseBiometricAuthentication',
|
|
176
|
+
);
|
|
159
177
|
}
|
|
160
178
|
return expoSecureStore.canUseBiometricAuthentication();
|
|
161
179
|
}
|
package/build/react/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../core';
|
package/build/react/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/secure-store/react: the React entry over the framework-agnostic core.
|
|
2
|
-
// Upstream ships free functions and seven constants, no per-instance state and no event stream
|
|
3
|
-
// — there is nothing for a hook to wrap, so this is a plain re-export, the same shape
|
|
4
|
-
// packages/local-auth's React entry has for the same reason.
|
|
5
|
-
export * from '../core/index.js';
|
package/build/vue/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../core';
|
package/build/vue/index.js
DELETED
package/src/react/index.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/secure-store/react: the React entry over the framework-agnostic core.
|
|
2
|
-
// Upstream ships free functions and seven constants, no per-instance state and no event stream
|
|
3
|
-
// — there is nothing for a hook to wrap, so this is a plain re-export, the same shape
|
|
4
|
-
// packages/local-auth's React entry has for the same reason.
|
|
5
|
-
export * from '../core';
|
package/src/vue/index.ts
DELETED