@onekeyfe/react-native-keychain-module 3.0.162-alpha.272 → 3.0.163
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 +52 -0
- package/package.json +6 -5
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @onekeyfe/react-native-keychain-module
|
|
2
|
+
|
|
3
|
+
An iOS Keychain interface for storing and retrieving string values in OneKey
|
|
4
|
+
React Native applications. The native implementation uses the application's
|
|
5
|
+
bundle identifier as its service and supports optional iCloud synchronization.
|
|
6
|
+
The application owns key naming, data serialization and removal policy.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
yarn add @onekeyfe/react-native-keychain-module react-native-nitro-modules
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Install the application's iOS pods and rebuild the native application. iCloud
|
|
15
|
+
Keychain availability depends on the device account and application entitlement
|
|
16
|
+
configuration; this package does not configure either of those.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { KeychainModule } from '@onekeyfe/react-native-keychain-module';
|
|
22
|
+
|
|
23
|
+
await KeychainModule.setItem({
|
|
24
|
+
key: 'example.preference',
|
|
25
|
+
value: 'enabled',
|
|
26
|
+
enableSync: false,
|
|
27
|
+
});
|
|
28
|
+
const item = await KeychainModule.getItem({ key: 'example.preference' });
|
|
29
|
+
await KeychainModule.removeItem({ key: 'example.preference' });
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API and platform behavior
|
|
33
|
+
|
|
34
|
+
| Method | Result |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `setItem(params)` | Store a string; accepts optional sync, label and description. |
|
|
37
|
+
| `getItem({ key })` | Return `{ key, value }` or `null` when absent. |
|
|
38
|
+
| `hasItem({ key })` | Return whether an item exists. |
|
|
39
|
+
| `removeItem({ key })` | Remove the item. |
|
|
40
|
+
| `isICloudSyncEnabled()` | Probe whether synchronizable Keychain storage is available. |
|
|
41
|
+
|
|
42
|
+
On iOS, omitted `enableSync` defaults to `true`; pass it explicitly when storage
|
|
43
|
+
must remain local. Handle Keychain errors as promise rejections.
|
|
44
|
+
Android is a stub: writes/removals resolve without persistence, reads return
|
|
45
|
+
`null`, and existence/sync checks return `false`. Do not use this package as
|
|
46
|
+
Android secure storage or infer a successful backup from a resolved stub call.
|
|
47
|
+
|
|
48
|
+
The complete types are in [src/KeychainModule.nitro.ts](src/KeychainModule.nitro.ts).
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-keychain-module",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.163",
|
|
4
|
+
"description": "iOS Keychain string storage with optional iCloud synchronization for OneKey",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -50,14 +50,15 @@
|
|
|
50
50
|
],
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/OneKeyHQ/app-modules
|
|
53
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
54
|
+
"directory": "native-modules/react-native-keychain-module"
|
|
54
55
|
},
|
|
55
56
|
"author": "onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
56
57
|
"license": "MIT",
|
|
57
58
|
"bugs": {
|
|
58
|
-
"url": "https://github.com/OneKeyHQ/app-modules/
|
|
59
|
+
"url": "https://github.com/OneKeyHQ/app-modules/issues"
|
|
59
60
|
},
|
|
60
|
-
"homepage": "https://github.com/OneKeyHQ/app-modules/react-native-keychain-module#readme",
|
|
61
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-keychain-module#readme",
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"registry": "https://registry.npmjs.org/"
|
|
63
64
|
},
|