@onekeyfe/react-native-pbkdf2 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.
- package/README.md +36 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @onekeyfe/react-native-pbkdf2
|
|
2
2
|
|
|
3
|
+
Native PBKDF2 key derivation for OneKey on iOS and Android. The TurboModule
|
|
4
|
+
accepts explicitly encoded password and salt bytes and returns a derived key
|
|
5
|
+
through a promise.
|
|
6
|
+
|
|
7
|
+
## Installation and usage
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
yarn add @onekeyfe/react-native-pbkdf2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Install the application's iOS pods and rebuild the native application.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import Pbkdf2 from '@onekeyfe/react-native-pbkdf2';
|
|
17
|
+
|
|
18
|
+
// Encoded test strings only; application parameters belong to its key format.
|
|
19
|
+
const key = await Pbkdf2.derive('cGFzc3dvcmQ=', 'c2FsdA==', 1000, 32, 'sha-256');
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## API and formats
|
|
23
|
+
|
|
24
|
+
`derive(password, salt, rounds, keyLength, hash)` returns `Promise<string>`.
|
|
25
|
+
Password and salt are Base64-encoded byte sequences. `keyLength` is the output
|
|
26
|
+
length in bytes; the derived result is Base64. `sha-256` and `sha-512` select
|
|
27
|
+
the corresponding PRF, while other hash values use the legacy SHA-1 path.
|
|
28
|
+
|
|
29
|
+
Keep derivation parameters aligned with the application's existing key format;
|
|
30
|
+
the illustrative call above is not a recommendation for production password
|
|
31
|
+
parameters. Handle promise rejection and decode the returned Base64 when raw
|
|
32
|
+
key bytes are needed. The package does not store keys or choose parameters.
|
|
33
|
+
|
|
34
|
+
See [src/NativePbkdf2.ts](src/NativePbkdf2.ts) for the native interface and the
|
|
35
|
+
platform sources for encoding and derivation behavior.
|
|
36
|
+
|
|
37
|
+
## Upstream attribution
|
|
38
|
+
|
|
3
39
|
First, a sincere thank-you to the
|
|
4
40
|
`react-native-pbkdf2` maintainers for their excellent work 🙏
|
|
5
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-pbkdf2",
|
|
3
|
-
"version": "3.0.157-alpha.
|
|
3
|
+
"version": "3.0.157-alpha.276",
|
|
4
4
|
"description": "react-native-pbkdf2",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -40,14 +40,15 @@
|
|
|
40
40
|
],
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
|
-
"url": "git+https://github.com/OneKeyHQ/app-modules
|
|
43
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
44
|
+
"directory": "native-modules/react-native-pbkdf2"
|
|
44
45
|
},
|
|
45
46
|
"author": "@onekeyhq <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
46
47
|
"license": "MIT",
|
|
47
48
|
"bugs": {
|
|
48
|
-
"url": "https://github.com/OneKeyHQ/app-modules/
|
|
49
|
+
"url": "https://github.com/OneKeyHQ/app-modules/issues"
|
|
49
50
|
},
|
|
50
|
-
"homepage": "https://github.com/OneKeyHQ/app-modules/react-native-pbkdf2#readme",
|
|
51
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-pbkdf2#readme",
|
|
51
52
|
"publishConfig": {
|
|
52
53
|
"registry": "https://registry.npmjs.org/"
|
|
53
54
|
},
|