Skip to content

Commit 3e305f9

Browse files
committed
add react-native support (experimental)
1 parent edc2819 commit 3e305f9

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Diff for: README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,12 @@ export const testMyFirstTest = tc => {
13881388
</dl>
13891389
</details>
13901390

1391+
### React-Native support
1392+
1393+
```sh
1394+
npm i isomorphic-webcrypto
1395+
```
1396+
13911397
### License
13921398

13931399
[The MIT License](./LICENSE) © Kevin Jahns

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@
441441
"types": "./webcrypto.d.ts",
442442
"deno": "./webcrypto.deno.js",
443443
"bun": "./webcrypto.js",
444+
"react-native": "./dist/webcrypto.react-native.cjs",
444445
"browser": {
445446
"module": "./webcrypto.js",
446447
"require": "./dist/webcrypto.cjs",

Diff for: rollup.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ export default [{
1414
entryFileNames: '[name].cjs',
1515
chunkFileNames: '[name]-[hash].cjs'
1616
},
17-
external: ['isomorphic.js', 'node:crypto', 'lib0/webcrypto', 'lib0/performance', 'perf_hooks']
17+
external: ['isomorphic.js', 'node:crypto', 'lib0/webcrypto', 'lib0/performance', 'perf_hooks', 'isomorphic-webcrypto', 'node:perf_hooks', 'lib0/logging']
1818
}]

Diff for: webcrypto.react-native.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import webcrypto from 'isomorphic-webcrypto'
2+
3+
webcrypto.ensureSecure()
4+
5+
export const subtle = webcrypto.subtle
6+
export const getRandomValues = webcrypto.getRandomValues.bind(webcrypto)

0 commit comments

Comments
 (0)