@react-native-module/crypto 2.1.3-6 → 2.1.3-9
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/.eslintrc.js +31 -31
- package/.travis.yml +31 -31
- package/.zuul.yml +1 -1
- package/LICENSE +23 -23
- package/README.md +66 -66
- package/package.json +71 -70
- package/rollup.config.js +49 -49
- package/src/global.ts +13 -13
- package/src/index.ts +63 -63
package/.eslintrc.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"env": {
|
|
3
|
-
"es2021": true,
|
|
4
|
-
node: true,
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended"
|
|
9
|
-
],
|
|
10
|
-
"parser": "@typescript-eslint/parser",
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": "latest",
|
|
13
|
-
},
|
|
14
|
-
"plugins": [
|
|
15
|
-
"@typescript-eslint"
|
|
16
|
-
],
|
|
17
|
-
"overrides": [
|
|
18
|
-
{
|
|
19
|
-
files: ['*.ts', '*.d.ts'],
|
|
20
|
-
extends: [
|
|
21
|
-
"standard-with-typescript"
|
|
22
|
-
],
|
|
23
|
-
"parserOptions": {
|
|
24
|
-
"project": "./tsconfig.json"
|
|
25
|
-
},
|
|
26
|
-
rules: {
|
|
27
|
-
"@typescript-eslint/ban-ts-comment": 0
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
"env": {
|
|
3
|
+
"es2021": true,
|
|
4
|
+
node: true,
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended"
|
|
9
|
+
],
|
|
10
|
+
"parser": "@typescript-eslint/parser",
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"ecmaVersion": "latest",
|
|
13
|
+
},
|
|
14
|
+
"plugins": [
|
|
15
|
+
"@typescript-eslint"
|
|
16
|
+
],
|
|
17
|
+
"overrides": [
|
|
18
|
+
{
|
|
19
|
+
files: ['*.ts', '*.d.ts'],
|
|
20
|
+
extends: [
|
|
21
|
+
"standard-with-typescript"
|
|
22
|
+
],
|
|
23
|
+
"parserOptions": {
|
|
24
|
+
"project": "./tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
"@typescript-eslint/ban-ts-comment": 0
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
32
|
|
package/.travis.yml
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
language: node_js
|
|
3
|
-
matrix:
|
|
4
|
-
include:
|
|
5
|
-
- node_js: '0.10'
|
|
6
|
-
env: TEST_SUITE=unit
|
|
7
|
-
- node_js: '0.11'
|
|
8
|
-
env: TEST_SUITE=unit
|
|
9
|
-
- node_js: '0.12'
|
|
10
|
-
env: TEST_SUITE=unit
|
|
11
|
-
- node_js: '4'
|
|
12
|
-
env: TEST_SUITE=unit
|
|
13
|
-
- node_js: '4'
|
|
14
|
-
env: TEST_SUITE=standard
|
|
15
|
-
- node_js: '4'
|
|
16
|
-
env: TEST_SUITE=browser BROWSER_NAME=ie BROWSER_VERSION="10..latest"
|
|
17
|
-
- node_js: '4'
|
|
18
|
-
env: TEST_SUITE=browser BROWSER_NAME=chrome BROWSER_VERSION="44..beta"
|
|
19
|
-
- node_js: '4'
|
|
20
|
-
env: TEST_SUITE=browser BROWSER_NAME=firefox BROWSER_VERSION="40..latest"
|
|
21
|
-
- node_js: '4'
|
|
22
|
-
env: TEST_SUITE=browser BROWSER_NAME=iphone BROWSER_VERSION="8.0..latest"
|
|
23
|
-
- node_js: '4'
|
|
24
|
-
env: TEST_SUITE=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest"
|
|
25
|
-
- node_js: '4'
|
|
26
|
-
env: TEST_SUITE=browser BROWSER_NAME=android BROWSER_VERSION="4.0..latest"
|
|
27
|
-
script: "npm run-script $TEST_SUITE"
|
|
28
|
-
env:
|
|
29
|
-
global:
|
|
30
|
-
- secure: YHNUDQmx/WiW3gmDcRCfb6KLDeio7Mr5tqPY2kHPdZlBSytsQjNk75ytM4U6Cu8Uk8iEIoj/aFlxiVMpJNA8J4QSUyW/YkbVaIz0+1oywoV0Ht8aRBfZ1jvXfX6789+1Q9c4xaMkYYbJpXSh9JcirsiwmqWd4+IDd7hcESodsDQ=
|
|
31
|
-
- secure: Nhj5yejKZxUbtHGZta+GjYWqXGaOZB7ainTkOuGcpXM+OwwjeDpYlTBrwS90Q7hqens7KXVzQM09aDbadpsDCsOo1nyaEigMtomAorZ1UC1CpEoVz1ZuikF9bEhb+/7M9pzuL1fX+Ke9Dx4mPPeb8sf/2SrAu1RqXkSwZV/duAc=
|
|
1
|
+
sudo: false
|
|
2
|
+
language: node_js
|
|
3
|
+
matrix:
|
|
4
|
+
include:
|
|
5
|
+
- node_js: '0.10'
|
|
6
|
+
env: TEST_SUITE=unit
|
|
7
|
+
- node_js: '0.11'
|
|
8
|
+
env: TEST_SUITE=unit
|
|
9
|
+
- node_js: '0.12'
|
|
10
|
+
env: TEST_SUITE=unit
|
|
11
|
+
- node_js: '4'
|
|
12
|
+
env: TEST_SUITE=unit
|
|
13
|
+
- node_js: '4'
|
|
14
|
+
env: TEST_SUITE=standard
|
|
15
|
+
- node_js: '4'
|
|
16
|
+
env: TEST_SUITE=browser BROWSER_NAME=ie BROWSER_VERSION="10..latest"
|
|
17
|
+
- node_js: '4'
|
|
18
|
+
env: TEST_SUITE=browser BROWSER_NAME=chrome BROWSER_VERSION="44..beta"
|
|
19
|
+
- node_js: '4'
|
|
20
|
+
env: TEST_SUITE=browser BROWSER_NAME=firefox BROWSER_VERSION="40..latest"
|
|
21
|
+
- node_js: '4'
|
|
22
|
+
env: TEST_SUITE=browser BROWSER_NAME=iphone BROWSER_VERSION="8.0..latest"
|
|
23
|
+
- node_js: '4'
|
|
24
|
+
env: TEST_SUITE=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest"
|
|
25
|
+
- node_js: '4'
|
|
26
|
+
env: TEST_SUITE=browser BROWSER_NAME=android BROWSER_VERSION="4.0..latest"
|
|
27
|
+
script: "npm run-script $TEST_SUITE"
|
|
28
|
+
env:
|
|
29
|
+
global:
|
|
30
|
+
- secure: YHNUDQmx/WiW3gmDcRCfb6KLDeio7Mr5tqPY2kHPdZlBSytsQjNk75ytM4U6Cu8Uk8iEIoj/aFlxiVMpJNA8J4QSUyW/YkbVaIz0+1oywoV0Ht8aRBfZ1jvXfX6789+1Q9c4xaMkYYbJpXSh9JcirsiwmqWd4+IDd7hcESodsDQ=
|
|
31
|
+
- secure: Nhj5yejKZxUbtHGZta+GjYWqXGaOZB7ainTkOuGcpXM+OwwjeDpYlTBrwS90Q7hqens7KXVzQM09aDbadpsDCsOo1nyaEigMtomAorZ1UC1CpEoVz1ZuikF9bEhb+/7M9pzuL1fX+Ke9Dx4mPPeb8sf/2SrAu1RqXkSwZV/duAc=
|
package/.zuul.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ui: tape
|
|
1
|
+
ui: tape
|
package/LICENSE
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
The MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2013 Dominic Tarr
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge,
|
|
6
|
-
to any person obtaining a copy of this software and
|
|
7
|
-
associated documentation files (the "Software"), to
|
|
8
|
-
deal in the Software without restriction, including
|
|
9
|
-
without limitation the rights to use, copy, modify,
|
|
10
|
-
merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
copies of the Software, and to permit persons to whom
|
|
12
|
-
the Software is furnished to do so,
|
|
13
|
-
subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice
|
|
16
|
-
shall be included in all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
22
|
-
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 Dominic Tarr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge,
|
|
6
|
+
to any person obtaining a copy of this software and
|
|
7
|
+
associated documentation files (the "Software"), to
|
|
8
|
+
deal in the Software without restriction, including
|
|
9
|
+
without limitation the rights to use, copy, modify,
|
|
10
|
+
merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom
|
|
12
|
+
the Software is furnished to do so,
|
|
13
|
+
subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice
|
|
16
|
+
shall be included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
22
|
+
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
24
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
# react-native-module/crypto
|
|
2
|
-
|
|
3
|
-
A port of node's `crypto` module to React Native.
|
|
4
|
-
The goal of this module is to reimplement node's crypto module so that it can run in react-native supported environments.
|
|
5
|
-
Features and interface must be compatible with node's crypto
|
|
6
|
-
|
|
7
|
-
this module is a clone of [crypto-browserify](https://github.com/crypto-browserify/crypto-browserify), [react-native-crypto](https://github.com/mvayngrib/react-native-crypto)
|
|
8
|
-
|
|
9
|
-
## Why use this module and Not others
|
|
10
|
-
|
|
11
|
-
If your app is running on mobile [android, ios] only, sufficient to use module react-native-crypto
|
|
12
|
-
Use this module if you are considering other platforms
|
|
13
|
-
|
|
14
|
-
## Install
|
|
15
|
-
|
|
16
|
-
This module has peerDependency "react-native"
|
|
17
|
-
|
|
18
|
-
A typical workflow:
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
npm i --save @react-native-module/crypto
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
yarn add @react-native-module/crypto
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## List of Support node's features
|
|
29
|
-
|
|
30
|
-
Here is the subset that is currently implemented:
|
|
31
|
-
|
|
32
|
-
- createHash (sha1, sha224, sha256, sha384, sha512, md5, rmd160)
|
|
33
|
-
- createHmac (sha1, sha224, sha256, sha384, sha512, md5, rmd160)
|
|
34
|
-
- pbkdf2
|
|
35
|
-
- pbkdf2Sync
|
|
36
|
-
- randomBytes
|
|
37
|
-
- pseudoRandomBytes
|
|
38
|
-
- createCipher (aes)
|
|
39
|
-
- createDecipher (aes)
|
|
40
|
-
- createDiffieHellman
|
|
41
|
-
- createSign (rsa, ecdsa)
|
|
42
|
-
- createVerify (rsa, ecdsa)
|
|
43
|
-
- createECDH (secp256k1)
|
|
44
|
-
- publicEncrypt/privateDecrypt (rsa)
|
|
45
|
-
|
|
46
|
-
## Todo
|
|
47
|
-
|
|
48
|
-
these features from node's `crypto` are still unimplemented.
|
|
49
|
-
|
|
50
|
-
- createCredentials
|
|
51
|
-
|
|
52
|
-
these features would benefit from native implementations
|
|
53
|
-
|
|
54
|
-
- pbkdf2
|
|
55
|
-
- createSign
|
|
56
|
-
- createVerify
|
|
57
|
-
- createECDH
|
|
58
|
-
- publicEncrypto/privateDecrypt (rsa)
|
|
59
|
-
|
|
60
|
-
## contributions
|
|
61
|
-
|
|
62
|
-
Thank you for investing your time in contributing to this project!
|
|
63
|
-
|
|
64
|
-
## License
|
|
65
|
-
|
|
66
|
-
MIT
|
|
1
|
+
# react-native-module/crypto
|
|
2
|
+
|
|
3
|
+
A port of node's `crypto` module to React Native.
|
|
4
|
+
The goal of this module is to reimplement node's crypto module so that it can run in react-native supported environments.
|
|
5
|
+
Features and interface must be compatible with node's crypto
|
|
6
|
+
|
|
7
|
+
this module is a clone of [crypto-browserify](https://github.com/crypto-browserify/crypto-browserify), [react-native-crypto](https://github.com/mvayngrib/react-native-crypto)
|
|
8
|
+
|
|
9
|
+
## Why use this module and Not others
|
|
10
|
+
|
|
11
|
+
If your app is running on mobile [android, ios] only, sufficient to use module react-native-crypto
|
|
12
|
+
Use this module if you are considering other platforms
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
This module has peerDependency "react-native"
|
|
17
|
+
|
|
18
|
+
A typical workflow:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
npm i --save @react-native-module/crypto
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
yarn add @react-native-module/crypto
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## List of Support node's features
|
|
29
|
+
|
|
30
|
+
Here is the subset that is currently implemented:
|
|
31
|
+
|
|
32
|
+
- createHash (sha1, sha224, sha256, sha384, sha512, md5, rmd160)
|
|
33
|
+
- createHmac (sha1, sha224, sha256, sha384, sha512, md5, rmd160)
|
|
34
|
+
- pbkdf2
|
|
35
|
+
- pbkdf2Sync
|
|
36
|
+
- randomBytes
|
|
37
|
+
- pseudoRandomBytes
|
|
38
|
+
- createCipher (aes)
|
|
39
|
+
- createDecipher (aes)
|
|
40
|
+
- createDiffieHellman
|
|
41
|
+
- createSign (rsa, ecdsa)
|
|
42
|
+
- createVerify (rsa, ecdsa)
|
|
43
|
+
- createECDH (secp256k1)
|
|
44
|
+
- publicEncrypt/privateDecrypt (rsa)
|
|
45
|
+
|
|
46
|
+
## Todo
|
|
47
|
+
|
|
48
|
+
these features from node's `crypto` are still unimplemented.
|
|
49
|
+
|
|
50
|
+
- createCredentials
|
|
51
|
+
|
|
52
|
+
these features would benefit from native implementations
|
|
53
|
+
|
|
54
|
+
- pbkdf2
|
|
55
|
+
- createSign
|
|
56
|
+
- createVerify
|
|
57
|
+
- createECDH
|
|
58
|
+
- publicEncrypto/privateDecrypt (rsa)
|
|
59
|
+
|
|
60
|
+
## contributions
|
|
61
|
+
|
|
62
|
+
Thank you for investing your time in contributing to this project!
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "sacru2red <sacru2red@gmail.com>",
|
|
3
|
-
"name": "@react-native-module/crypto",
|
|
4
|
-
"description": "implementation of crypto for React Native",
|
|
5
|
-
"version": "2.1.3-
|
|
6
|
-
"main": "lib/cjs/index.js",
|
|
7
|
-
"module": "lib/es/index.js",
|
|
8
|
-
"types": "lib/types/index.d.ts",
|
|
9
|
-
"source": "src/index",
|
|
10
|
-
"react-native": "src/index.ts",
|
|
11
|
-
"homepage": "https://github.com/react-native-module/crypto",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/react-native-module/crypto.git"
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"lint": "eslint",
|
|
18
|
-
"build": "rimraf ./lib && rollup -c ./rollup.config.js && npm run build:types",
|
|
19
|
-
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
|
|
20
|
-
"release": "npm run build && release-it",
|
|
21
|
-
"test": "npm run unit",
|
|
22
|
-
"unit": "echo 'tests not set up for React Native yet'"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@react-native-module/pbkdf2": "^0.3.
|
|
26
|
-
"@react-native-module/randombytes": "^3.6.7-1",
|
|
27
|
-
"browserify-cipher": "^1.0.0",
|
|
28
|
-
"browserify-sign": "^4.0.4",
|
|
29
|
-
"create-ecdh": "^4.0.0",
|
|
30
|
-
"create-hash": "^1.1.0",
|
|
31
|
-
"create-hmac": "^1.1.0",
|
|
32
|
-
"diffie-hellman": "^5.0.0",
|
|
33
|
-
"inherits": "^2.0.1",
|
|
34
|
-
"pbkdf2": "^3.1.2",
|
|
35
|
-
"public-encrypt": "^4.0.0"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@rollup/plugin-commonjs": "^22.0.1",
|
|
39
|
-
"@rollup/plugin-json": "^4.1.0",
|
|
40
|
-
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
41
|
-
"@rollup/plugin-typescript": "^8.3.3",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
43
|
-
"@typescript-eslint/parser": "^5.30.7",
|
|
44
|
-
"eslint": "^8.20.0",
|
|
45
|
-
"eslint-config-standard-with-typescript": "^22.0.0",
|
|
46
|
-
"eslint-plugin-import": "^2.26.0",
|
|
47
|
-
"eslint-plugin-n": "^15.2.4",
|
|
48
|
-
"eslint-plugin-promise": "^6.0.0",
|
|
49
|
-
"hash-test-vectors": "~1.3.2",
|
|
50
|
-
"pseudorandombytes": "^2.0.0",
|
|
51
|
-
"release-it": "^15.1.3",
|
|
52
|
-
"rimraf": "^3.0.2",
|
|
53
|
-
"rollup": "^2.77.0",
|
|
54
|
-
"tape": "~2.3.2",
|
|
55
|
-
"typescript": "^4.7.4",
|
|
56
|
-
"zuul": "^3.12.0"
|
|
57
|
-
},
|
|
58
|
-
"peerDependencies": {
|
|
59
|
-
"react
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"react
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
{
|
|
2
|
+
"author": "sacru2red <sacru2red@gmail.com>",
|
|
3
|
+
"name": "@react-native-module/crypto",
|
|
4
|
+
"description": "implementation of crypto for React Native",
|
|
5
|
+
"version": "2.1.3-9",
|
|
6
|
+
"main": "lib/cjs/index.js",
|
|
7
|
+
"module": "lib/es/index.js",
|
|
8
|
+
"types": "lib/types/index.d.ts",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"react-native": "src/index.ts",
|
|
11
|
+
"homepage": "https://github.com/react-native-module/crypto",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/react-native-module/crypto.git"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"lint": "eslint",
|
|
18
|
+
"build": "rimraf ./lib && rollup -c ./rollup.config.js && npm run build:types",
|
|
19
|
+
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
|
|
20
|
+
"release": "npm run build && release-it",
|
|
21
|
+
"test": "npm run unit",
|
|
22
|
+
"unit": "echo 'tests not set up for React Native yet'"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@react-native-module/pbkdf2": "^0.3.11",
|
|
26
|
+
"@react-native-module/randombytes": "^3.6.7-1",
|
|
27
|
+
"browserify-cipher": "^1.0.0",
|
|
28
|
+
"browserify-sign": "^4.0.4",
|
|
29
|
+
"create-ecdh": "^4.0.0",
|
|
30
|
+
"create-hash": "^1.1.0",
|
|
31
|
+
"create-hmac": "^1.1.0",
|
|
32
|
+
"diffie-hellman": "^5.0.0",
|
|
33
|
+
"inherits": "^2.0.1",
|
|
34
|
+
"pbkdf2": "^3.1.2",
|
|
35
|
+
"public-encrypt": "^4.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
39
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
40
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
41
|
+
"@rollup/plugin-typescript": "^8.3.3",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
43
|
+
"@typescript-eslint/parser": "^5.30.7",
|
|
44
|
+
"eslint": "^8.20.0",
|
|
45
|
+
"eslint-config-standard-with-typescript": "^22.0.0",
|
|
46
|
+
"eslint-plugin-import": "^2.26.0",
|
|
47
|
+
"eslint-plugin-n": "^15.2.4",
|
|
48
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
49
|
+
"hash-test-vectors": "~1.3.2",
|
|
50
|
+
"pseudorandombytes": "^2.0.0",
|
|
51
|
+
"release-it": "^15.1.3",
|
|
52
|
+
"rimraf": "^3.0.2",
|
|
53
|
+
"rollup": "^2.77.0",
|
|
54
|
+
"tape": "~2.3.2",
|
|
55
|
+
"typescript": "^4.7.4",
|
|
56
|
+
"zuul": "^3.12.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"react": "*",
|
|
60
|
+
"react-native": "*"
|
|
61
|
+
},
|
|
62
|
+
"keywords": [
|
|
63
|
+
"react native",
|
|
64
|
+
"react-native",
|
|
65
|
+
"crypto",
|
|
66
|
+
"ios",
|
|
67
|
+
"android",
|
|
68
|
+
"web"
|
|
69
|
+
],
|
|
70
|
+
"license": "MIT"
|
|
71
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import commonjs from "@rollup/plugin-commonjs"
|
|
2
|
-
import { nodeResolve } from "@rollup/plugin-node-resolve"
|
|
3
|
-
import typescript from '@rollup/plugin-typescript';
|
|
4
|
-
import json from "@rollup/plugin-json";
|
|
5
|
-
|
|
6
|
-
const inputSrc = [
|
|
7
|
-
["./src/index.ts", "es"],
|
|
8
|
-
["./src/index.ts", "cjs"],
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
const extensions = [".mjs", ".json", ".ts", ".native.ts", ".native.js"]
|
|
12
|
-
|
|
13
|
-
export default inputSrc
|
|
14
|
-
.map(([input, format]) => {
|
|
15
|
-
return {
|
|
16
|
-
input,
|
|
17
|
-
output: {
|
|
18
|
-
dir: `lib/${format}`,
|
|
19
|
-
format,
|
|
20
|
-
},
|
|
21
|
-
preserveModules: true,
|
|
22
|
-
external: [
|
|
23
|
-
"@react-native-module/randombytes",
|
|
24
|
-
'@react-native-module/pbkdf2',
|
|
25
|
-
"browserify-cipher",
|
|
26
|
-
"browserify-sign",
|
|
27
|
-
'browserify-sign/browser/algorithms.json',
|
|
28
|
-
"create-ecdh",
|
|
29
|
-
"create-hash",
|
|
30
|
-
"create-hmac",
|
|
31
|
-
"diffie-hellman",
|
|
32
|
-
"elliptic",
|
|
33
|
-
"inherits",
|
|
34
|
-
"pbkdf2",
|
|
35
|
-
"public-encrypt",
|
|
36
|
-
'react-native'
|
|
37
|
-
],
|
|
38
|
-
plugins: [
|
|
39
|
-
json(),
|
|
40
|
-
typescript(),
|
|
41
|
-
nodeResolve(),
|
|
42
|
-
// https://velog.io/@peterkimzz/rollup-%ED%94%8C%EB%9F%AC%EA%B7%B8%EC%9D%B8
|
|
43
|
-
// CommonJS 로 작성된 모듈들을 ES6 바꾸어서 rollup이 해석할 수 있게 도와줍니다.
|
|
44
|
-
commonjs({
|
|
45
|
-
extensions: [...extensions, ".js"],
|
|
46
|
-
}),
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
})
|
|
1
|
+
import commonjs from "@rollup/plugin-commonjs"
|
|
2
|
+
import { nodeResolve } from "@rollup/plugin-node-resolve"
|
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
|
4
|
+
import json from "@rollup/plugin-json";
|
|
5
|
+
|
|
6
|
+
const inputSrc = [
|
|
7
|
+
["./src/index.ts", "es"],
|
|
8
|
+
["./src/index.ts", "cjs"],
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
const extensions = [".mjs", ".json", ".ts", ".native.ts", ".native.js"]
|
|
12
|
+
|
|
13
|
+
export default inputSrc
|
|
14
|
+
.map(([input, format]) => {
|
|
15
|
+
return {
|
|
16
|
+
input,
|
|
17
|
+
output: {
|
|
18
|
+
dir: `lib/${format}`,
|
|
19
|
+
format,
|
|
20
|
+
},
|
|
21
|
+
preserveModules: true,
|
|
22
|
+
external: [
|
|
23
|
+
"@react-native-module/randombytes",
|
|
24
|
+
'@react-native-module/pbkdf2',
|
|
25
|
+
"browserify-cipher",
|
|
26
|
+
"browserify-sign",
|
|
27
|
+
'browserify-sign/browser/algorithms.json',
|
|
28
|
+
"create-ecdh",
|
|
29
|
+
"create-hash",
|
|
30
|
+
"create-hmac",
|
|
31
|
+
"diffie-hellman",
|
|
32
|
+
"elliptic",
|
|
33
|
+
"inherits",
|
|
34
|
+
"pbkdf2",
|
|
35
|
+
"public-encrypt",
|
|
36
|
+
'react-native'
|
|
37
|
+
],
|
|
38
|
+
plugins: [
|
|
39
|
+
json(),
|
|
40
|
+
typescript(),
|
|
41
|
+
nodeResolve(),
|
|
42
|
+
// https://velog.io/@peterkimzz/rollup-%ED%94%8C%EB%9F%AC%EA%B7%B8%EC%9D%B8
|
|
43
|
+
// CommonJS 로 작성된 모듈들을 ES6 바꾸어서 rollup이 해석할 수 있게 도와줍니다.
|
|
44
|
+
commonjs({
|
|
45
|
+
extensions: [...extensions, ".js"],
|
|
46
|
+
}),
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
})
|
package/src/global.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
2
|
-
import { randomBytesWithoutNativeModule } from '@react-native-module/randombytes/src/randomBytesWithoutNativeModule'
|
|
3
|
-
|
|
4
|
-
// https://github.com/mvayngrib/react-native-crypto/blob/204384f06e3fa78c3a272ac55dd3a9de4743f1f3/index.js#L7
|
|
5
|
-
if (typeof globalThis === 'object') {
|
|
6
|
-
if (!globalThis.crypto) {
|
|
7
|
-
// @ts-expect-error
|
|
8
|
-
globalThis.crypto = {}
|
|
9
|
-
}
|
|
10
|
-
if (!globalThis.crypto.getRandomValues) {
|
|
11
|
-
globalThis.crypto.getRandomValues = randomBytesWithoutNativeModule
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
|
|
2
|
+
import { randomBytesWithoutNativeModule } from '@react-native-module/randombytes/src/randomBytesWithoutNativeModule'
|
|
3
|
+
|
|
4
|
+
// https://github.com/mvayngrib/react-native-crypto/blob/204384f06e3fa78c3a272ac55dd3a9de4743f1f3/index.js#L7
|
|
5
|
+
if (typeof globalThis === 'object') {
|
|
6
|
+
if (!globalThis.crypto) {
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
globalThis.crypto = {}
|
|
9
|
+
}
|
|
10
|
+
if (!globalThis.crypto.getRandomValues) {
|
|
11
|
+
globalThis.crypto.getRandomValues = randomBytesWithoutNativeModule
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import createHashModule from 'create-hash'
|
|
2
|
-
import createHmacModule from 'create-hmac'
|
|
3
|
-
import randomBytesModule from '@react-native-module/randombytes'
|
|
4
|
-
import signAlogos from 'browserify-sign/browser/algorithms.json'
|
|
5
|
-
import * as pbkdf2Moule from '@react-native-module/pbkdf2'
|
|
6
|
-
import aes from 'browserify-cipher'
|
|
7
|
-
import dh from 'diffie-hellman'
|
|
8
|
-
import sign from 'browserify-sign'
|
|
9
|
-
import createEcdhModule from 'create-ecdh'
|
|
10
|
-
import publicEncryptModule from 'public-encrypt'
|
|
11
|
-
|
|
12
|
-
export const Hash = createHashModule
|
|
13
|
-
export const createHash = Hash
|
|
14
|
-
export const Hmac = createHmacModule
|
|
15
|
-
export const createHmac = createHmacModule
|
|
16
|
-
export const randomBytes = randomBytesModule
|
|
17
|
-
export const rng = randomBytes
|
|
18
|
-
export const pseudoRandomBytes = randomBytes
|
|
19
|
-
export const prng = randomBytes
|
|
20
|
-
|
|
21
|
-
const hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(signAlogos))
|
|
22
|
-
export function getHashes (): string[] {
|
|
23
|
-
return hashes
|
|
24
|
-
}
|
|
25
|
-
export const pbkdf2 = pbkdf2Moule.pbkdf2
|
|
26
|
-
export const pbkdf2Sync = pbkdf2Moule.pbkdf2Sync
|
|
27
|
-
|
|
28
|
-
export const Cipher = aes.Cipher
|
|
29
|
-
export const createCipher = aes.createCipher
|
|
30
|
-
export const Cipheriv = aes.Cipheriv
|
|
31
|
-
export const createCipheriv = aes.createCipheriv
|
|
32
|
-
export const Decipher = aes.Decipher
|
|
33
|
-
export const createDecipher = aes.createDecipher
|
|
34
|
-
export const Decipheriv = aes.Decipheriv
|
|
35
|
-
export const createDecipheriv = aes.createDecipheriv
|
|
36
|
-
export const getCiphers = aes.getCiphers
|
|
37
|
-
export const listCiphers = aes.listCiphers
|
|
38
|
-
|
|
39
|
-
export const DiffieHellmanGroup = dh.DiffieHellmanGroup
|
|
40
|
-
export const createDiffieHellmanGroup = dh.createDiffieHellmanGroup
|
|
41
|
-
export const getDiffieHellman = dh.getDiffieHellman
|
|
42
|
-
export const createDiffieHellman = dh.createDiffieHellman
|
|
43
|
-
export const DiffieHellman = dh.DiffieHellman
|
|
44
|
-
|
|
45
|
-
export const createSign = sign.createSign
|
|
46
|
-
export const Sign = sign.Sign
|
|
47
|
-
export const createVerify = sign.createVerify
|
|
48
|
-
export const Verify = sign.Verify
|
|
49
|
-
|
|
50
|
-
export const createECDH = createEcdhModule
|
|
51
|
-
|
|
52
|
-
export const publicEncrypt = publicEncryptModule.publicEncrypt
|
|
53
|
-
export const privateEncrypt = publicEncryptModule.privateEncrypt
|
|
54
|
-
export const publicDecrypt = publicEncryptModule.publicDecrypt
|
|
55
|
-
export const privateDecrypt = publicEncryptModule.privateDecrypt
|
|
56
|
-
|
|
57
|
-
export const createCredentials = (): any => {
|
|
58
|
-
throw new Error([
|
|
59
|
-
'sorry, createCredentials is not implemented yet',
|
|
60
|
-
'we accept pull requests',
|
|
61
|
-
'https://github.com/crypto-browserify/crypto-browserify'
|
|
62
|
-
].join('\n'))
|
|
63
|
-
}
|
|
1
|
+
import createHashModule from 'create-hash'
|
|
2
|
+
import createHmacModule from 'create-hmac'
|
|
3
|
+
import randomBytesModule from '@react-native-module/randombytes'
|
|
4
|
+
import signAlogos from 'browserify-sign/browser/algorithms.json'
|
|
5
|
+
import * as pbkdf2Moule from '@react-native-module/pbkdf2'
|
|
6
|
+
import aes from 'browserify-cipher'
|
|
7
|
+
import dh from 'diffie-hellman'
|
|
8
|
+
import sign from 'browserify-sign'
|
|
9
|
+
import createEcdhModule from 'create-ecdh'
|
|
10
|
+
import publicEncryptModule from 'public-encrypt'
|
|
11
|
+
|
|
12
|
+
export const Hash = createHashModule
|
|
13
|
+
export const createHash = Hash
|
|
14
|
+
export const Hmac = createHmacModule
|
|
15
|
+
export const createHmac = createHmacModule
|
|
16
|
+
export const randomBytes = randomBytesModule
|
|
17
|
+
export const rng = randomBytes
|
|
18
|
+
export const pseudoRandomBytes = randomBytes
|
|
19
|
+
export const prng = randomBytes
|
|
20
|
+
|
|
21
|
+
const hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(signAlogos))
|
|
22
|
+
export function getHashes (): string[] {
|
|
23
|
+
return hashes
|
|
24
|
+
}
|
|
25
|
+
export const pbkdf2 = pbkdf2Moule.pbkdf2
|
|
26
|
+
export const pbkdf2Sync = pbkdf2Moule.pbkdf2Sync
|
|
27
|
+
|
|
28
|
+
export const Cipher = aes.Cipher
|
|
29
|
+
export const createCipher = aes.createCipher
|
|
30
|
+
export const Cipheriv = aes.Cipheriv
|
|
31
|
+
export const createCipheriv = aes.createCipheriv
|
|
32
|
+
export const Decipher = aes.Decipher
|
|
33
|
+
export const createDecipher = aes.createDecipher
|
|
34
|
+
export const Decipheriv = aes.Decipheriv
|
|
35
|
+
export const createDecipheriv = aes.createDecipheriv
|
|
36
|
+
export const getCiphers = aes.getCiphers
|
|
37
|
+
export const listCiphers = aes.listCiphers
|
|
38
|
+
|
|
39
|
+
export const DiffieHellmanGroup = dh.DiffieHellmanGroup
|
|
40
|
+
export const createDiffieHellmanGroup = dh.createDiffieHellmanGroup
|
|
41
|
+
export const getDiffieHellman = dh.getDiffieHellman
|
|
42
|
+
export const createDiffieHellman = dh.createDiffieHellman
|
|
43
|
+
export const DiffieHellman = dh.DiffieHellman
|
|
44
|
+
|
|
45
|
+
export const createSign = sign.createSign
|
|
46
|
+
export const Sign = sign.Sign
|
|
47
|
+
export const createVerify = sign.createVerify
|
|
48
|
+
export const Verify = sign.Verify
|
|
49
|
+
|
|
50
|
+
export const createECDH = createEcdhModule
|
|
51
|
+
|
|
52
|
+
export const publicEncrypt = publicEncryptModule.publicEncrypt
|
|
53
|
+
export const privateEncrypt = publicEncryptModule.privateEncrypt
|
|
54
|
+
export const publicDecrypt = publicEncryptModule.publicDecrypt
|
|
55
|
+
export const privateDecrypt = publicEncryptModule.privateDecrypt
|
|
56
|
+
|
|
57
|
+
export const createCredentials = (): any => {
|
|
58
|
+
throw new Error([
|
|
59
|
+
'sorry, createCredentials is not implemented yet',
|
|
60
|
+
'we accept pull requests',
|
|
61
|
+
'https://github.com/crypto-browserify/crypto-browserify'
|
|
62
|
+
].join('\n'))
|
|
63
|
+
}
|