@onekeyfe/react-native-lite-card 3.0.157-alpha.273 → 3.0.157-alpha.276

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 (2) hide show
  1. package/README.md +54 -0
  2. package/package.json +6 -5
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # @onekeyfe/react-native-lite-card
2
+
3
+ OneKey Lite NFC card operations for React Native on iOS and Android. The package
4
+ wraps native callbacks in promises for card inspection, PIN changes, mnemonic
5
+ backup/retrieval and reset. It also exposes native NFC connection UI events.
6
+ The application owns the user flow and handling sensitive card data.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ yarn add @onekeyfe/react-native-lite-card
12
+ ```
13
+
14
+ Install the application's iOS pods and rebuild the native application. NFC
15
+ hardware, platform permissions and host configuration are required; card
16
+ operations cannot be validated through a JavaScript-only development session.
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ import onekeyLite from '@onekeyfe/react-native-lite-card';
22
+
23
+ const result = await onekeyLite.checkNFCPermission();
24
+ if (result.error) {
25
+ // Handle the native error code and message in the application's NFC flow.
26
+ } else {
27
+ const permissionAvailable = result.data;
28
+ }
29
+ ```
30
+
31
+ ## API
32
+
33
+ - `getLiteInfo()` returns card information including serial number, backup
34
+ state, new-card status and remaining PIN retries.
35
+ - `setMnemonic(mnemonic, pwd, overwrite)` and `getMnemonicWithPin(pwd)` manage
36
+ the backup; `overwrite` defaults to `false`.
37
+ - `changePin(oldPin, newPin)` and `reset()` alter the card's state.
38
+ - `addConnectListener(listener)` subscribes to NFC UI events and returns the
39
+ native subscription. Keep it and call `remove()` when the owner finishes.
40
+ - `cancel()` invokes native cancellation on Android; `intoSetting()` opens
41
+ the platform settings path.
42
+
43
+ Operation promises resolve an object containing `error`, `data` and `cardInfo`.
44
+ Check `error` before consuming data: a resolved promise does not imply a successful
45
+ card operation. `CardErrors` provides the exported native error codes. PIN retry
46
+ and destructive reset behavior belong in the application's explicit card flow.
47
+
48
+ See [src/index.tsx](src/index.tsx) and
49
+ [src/NativeReactNativeLiteCard.ts](src/NativeReactNativeLiteCard.ts) for the wrapper
50
+ and callback/result types.
51
+
52
+ ## License
53
+
54
+ MIT.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-lite-card",
3
- "version": "3.0.157-alpha.273",
4
- "description": "lite card",
3
+ "version": "3.0.157-alpha.276",
4
+ "description": "OneKey Lite NFC card operations and connection events for React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
7
7
  "exports": {
@@ -49,14 +49,15 @@
49
49
  ],
50
50
  "repository": {
51
51
  "type": "git",
52
- "url": "git+https://github.com/OneKeyHQ/app-modules/onekeyfe-react-native-lite-card.git"
52
+ "url": "git+https://github.com/OneKeyHQ/app-modules.git",
53
+ "directory": "native-modules/react-native-lite-card"
53
54
  },
54
55
  "author": "@onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
55
56
  "license": "MIT",
56
57
  "bugs": {
57
- "url": "https://github.com/OneKeyHQ/app-modules/onekeyfe-react-native-lite-card/issues"
58
+ "url": "https://github.com/OneKeyHQ/app-modules/issues"
58
59
  },
59
- "homepage": "https://github.com/OneKeyHQ/app-modules/onekeyfe-react-native-lite-card#readme",
60
+ "homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-lite-card#readme",
60
61
  "publishConfig": {
61
62
  "registry": "https://registry.npmjs.org/"
62
63
  },