@onekeyfe/react-native-aes-crypto 3.0.157-alpha.275 → 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 +37 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @onekeyfe/react-native-aes-crypto
|
|
2
2
|
|
|
3
|
+
Native cryptographic primitives for OneKey on iOS and Android: AES encryption,
|
|
4
|
+
authenticated GCM operations, PBKDF2, HMAC, hashing and random values.
|
|
5
|
+
|
|
6
|
+
## Installation and usage
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
yarn add @onekeyfe/react-native-aes-crypto
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Install the application's iOS pods and rebuild its native binary. The exported
|
|
13
|
+
functions return promises and depend on the native TurboModule.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { sha256, randomKey } from '@onekeyfe/react-native-aes-crypto';
|
|
17
|
+
|
|
18
|
+
const digest = await sha256('example message');
|
|
19
|
+
const randomBytes = await randomKey(32);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## API and formats
|
|
23
|
+
|
|
24
|
+
Named exports include `encrypt`, `decrypt`, `aesGcmEncrypt`, `aesGcmDecrypt`,
|
|
25
|
+
`pbkdf2`, `hmac256`, `hmac512`, `sha1`, `sha256`, `sha512`, `randomUuid` and
|
|
26
|
+
`randomKey`. The default export is the native module.
|
|
27
|
+
|
|
28
|
+
The GCM helpers use lowercase hex inputs, a 12-byte nonce, a valid AES key
|
|
29
|
+
length and nonempty associated data. Encryption returns ciphertext followed
|
|
30
|
+
by a 16-byte authentication tag, encoded as hex. Decryption rejects when the
|
|
31
|
+
inputs or authentication tag are invalid. Those formats are specific to the
|
|
32
|
+
GCM helpers; do not assume that every other method uses the same encoding.
|
|
33
|
+
|
|
34
|
+
Use the exact signatures in [src/NativeAesCrypto.ts](src/NativeAesCrypto.ts) and
|
|
35
|
+
the GCM contract comments in [src/index.tsx](src/index.tsx). Applications own
|
|
36
|
+
key storage, nonce uniqueness, input encoding and handling promise failures.
|
|
37
|
+
|
|
38
|
+
## Upstream attribution
|
|
39
|
+
|
|
3
40
|
First, a sincere thank-you to tectiv3 and the
|
|
4
41
|
`react-native-aes-crypto` maintainers for their excellent work 🙏
|
|
5
42
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-aes-crypto",
|
|
3
|
-
"version": "3.0.157-alpha.
|
|
3
|
+
"version": "3.0.157-alpha.276",
|
|
4
4
|
"description": "react-native-aes-crypto",
|
|
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-aes-crypto"
|
|
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-aes-crypto#readme",
|
|
51
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-aes-crypto#readme",
|
|
51
52
|
"publishConfig": {
|
|
52
53
|
"registry": "https://registry.npmjs.org/"
|
|
53
54
|
},
|