react-native-quick-crypto 0.4.2 → 0.4.3

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/LICENSE CHANGED
@@ -1,6 +1,8 @@
1
+ **react-native-quick-crypto**
2
+
1
3
  MIT License
2
4
 
3
- Copyright (c) 2021 Marc Rousavy
5
+ Copyright (c) 2021 Margelo GmbH
4
6
 
5
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
8
  of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +21,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
21
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
23
  SOFTWARE.
24
+
25
+ **NodeJS Crypto**
26
+
27
+ See https://github.com/nodejs/node/blob/main/LICENSE
package/README.md CHANGED
@@ -47,6 +47,7 @@ Creating a Wallet took 289 ms
47
47
 
48
48
  ```sh
49
49
  yarn add react-native-quick-crypto
50
+ yarn add react-native-quick-base64
50
51
  cd ios && pod install
51
52
  ```
52
53
 
@@ -56,16 +57,17 @@ cd ios && pod install
56
57
 
57
58
  ```sh
58
59
  expo install react-native-quick-crypto
60
+ expo install react-native-quick-base64
59
61
  expo prebuild
60
62
  ```
61
63
 
62
- ## Usage
64
+ ## Replace `crypto-browserify`
65
+
66
+ If you are using a library that depends on `crypto`, instead of polyfilling it with `crypto-browserify` (or `react-native-crypto`) you can use `react-native-quick-crypto` for a fully native implementation. This way you can get much faster crypto operations with just a single-line change!
63
67
 
64
68
  In your `babel.config.js`, add a module resolver to replace `crypto` with `react-native-quick-crypto`:
65
69
 
66
70
  ```diff
67
- +const path = require('path');
68
-
69
71
  module.exports = {
70
72
  presets: ['module:metro-react-native-babel-preset'],
71
73
  plugins: [
@@ -74,6 +76,8 @@ module.exports = {
74
76
  + {
75
77
  + alias: {
76
78
  + 'crypto': 'react-native-quick-crypto',
79
+ + 'stream': 'stream-browserify',
80
+ + 'buffer': '@craftzdog/react-native-buffer',
77
81
  + },
78
82
  + },
79
83
  + ],
@@ -84,16 +88,65 @@ module.exports = {
84
88
 
85
89
  Now, all imports for `crypto` will be resolved as `react-native-quick-crypto` instead.
86
90
 
91
+ > 💡 Since react-native-quick-crypto depends on `stream` and `buffer`, we can resolve those to `stream-browserify` and @craftzdog's `react-native-buffer` (which is faster than `buffer` because it uses JSI for base64 encoding and decoding).
92
+
93
+ ## Usage
94
+
95
+ For example, to hash a string with SHA256 you can do the following:
96
+
97
+ ```ts
98
+ import Crypto from 'react-native-quick-crypto'
99
+
100
+ const hashed = Crypto.createHash('sha256')
101
+ .update('Damn, Margelo writes hella good software!')
102
+ .digest('hex')
103
+ ```
104
+
87
105
  ---
88
106
 
89
107
  ## Sponsors
90
108
 
109
+ <!-- Onin -->
91
110
  <div align="center">
111
+ <img height="50" src="./img/sponsors/onin.svg" align="center"><br/>
112
+ <a href="https://onin.co"><b>Onin</b></a> - This library is supported by Onin. Plan events without leaving the chat: <a href="https://onin.co">onin.co</a>
113
+ </div>
114
+ <br/>
115
+ <br/>
116
+
117
+ <!-- Steakwallet -->
118
+ <div align="center">
119
+ <img height="37" src="./img/sponsors/omni.png" align="center"><br/>
120
+ <a href="https://steakwallet.fi"><b>Omni</b></a> - Web3 for all. Access all of Web3 in one easy to use wallet. Omni supports more blockchains so you get more tokens, more yields, more NFTs, and more fun!
121
+ </div>
122
+ <br/>
123
+ <br/>
92
124
 
93
- <img width="350" src="./img/sponsors/litentry.png" align="center"><br/>
125
+ <!-- Litentry -->
126
+ <div align="center">
127
+ <img height="70" src="./img/sponsors/litentry.png" align="center"><br/>
94
128
  <a href="https://litentry.com"><b>Litentry</b></a> - A decentralized identity aggregator, providing the structure and tools to empower you and your identity.
129
+ </div>
130
+ <br/>
131
+ <br/>
95
132
 
133
+ <!-- WalletConnect -->
134
+ <div align="center">
135
+ <img height="35" src="./img/sponsors/walletconnect.png" align="center"><br/>
136
+ <a href="https://walletconnect.com"><b>WalletConnect</b></a> - The communications protocol for web3, WalletConnect brings the ecosystem together by enabling wallets and apps to securely connect and interact.
137
+ </div>
138
+ <br/>
139
+ <br/>
140
+
141
+ <!-- WalletConnect -->
142
+
143
+ <!-- THORSwap -->
144
+ <div align="center">
145
+ <img height="40" src="./img/sponsors/thorswap.png" align="center"><br/>
146
+ <a href="https://thorswap.finance"><b>THORSwap</b></a> - THORSwap is a cross-chain DEX aggregator that enables users to swap native assets across chains, provide liquidity to earn yield, and more. THORSwap is fully permissionless and non-custodial. No account signup, your wallet, your keys, your coins.
96
147
  </div>
148
+ <br/>
149
+ <br/>
97
150
 
98
151
  ## Limitations
99
152
 
@@ -109,4 +162,5 @@ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the
109
162
 
110
163
  ## License
111
164
 
112
- MIT
165
+ - react-native-quick-crypto is licensed under MIT.
166
+ - react-native-quick-crypto is heavily inspired by NodeJS Crypto, which is licensed under [nodejs/LICENSE](https://github.com/nodejs/node/blob/main/LICENSE).
@@ -1,6 +1,6 @@
1
1
  //
2
2
  // MGLPublicCipher.h
3
- // react-native-fast-crypto
3
+ // react-native-quick-crypto
4
4
  //
5
5
  // Created by Oscar on 17.06.22.
6
6
  //
package/cpp/MGLKeys.cpp CHANGED
@@ -1,6 +1,6 @@
1
1
  //
2
2
  // MGLCipherKeys.cpp
3
- // react-native-fast-crypto
3
+ // react-native-quick-crypto
4
4
  //
5
5
  // Created by Oscar on 20.06.22.
6
6
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-quick-crypto",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "A fast implementation of Node's `crypto` module written in C/C++ JSI",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -152,7 +152,7 @@
152
152
  [
153
153
  "typescript",
154
154
  {
155
- "project": "tsconfig.build.json"
155
+ "project": "tsconfig.json"
156
156
  }
157
157
  ]
158
158
  ]
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
37
37
  "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\""
38
38
  }
39
39
 
40
- s.dependency "OpenSSL-Universal", "~> 1.1.1300"
40
+ s.dependency "OpenSSL-Universal"
41
41
  s.dependency "React-Core"
42
42
  s.dependency "React"
43
43
  s.dependency "React-callinvoker"