Name Date Size #Lines LOC

..26-Sep-2023-

build/H26-Sep-2023-9269

src/H26-Sep-2023-181137

.eslintrc.jsH A D26-Sep-2023103 31

.npmignoreH A D26-Sep-2023183 128

README.mdH A D26-Sep-20231.3 KiB4325

babel.config.jsH A D26-Sep-2023104 31

package.jsonH A D26-Sep-20231.1 KiB4645

tsconfig.jsonH A D26-Sep-2023217 109

README.md

1# expo-standard-crypto
2
3A partial implementation of the W3C Crypto API for Expo
4
5# API documentation
6
7This package provides a partial polyfill of the W3C Crypto API for Expo. Namely, `Crypto#getRandomValues()` is implemented. See the [W3C Crypto specification](https://www.w3.org/TR/WebCryptoAPI/) for the API documentation.
8
9# Installation in Expo projects
10
11First follow the instructions for installing [`expo-crypto`](https://github.com/expo/expo/blob/main/packages/expo-crypto/README.md), which is required by this package. Then install this package.
12
13### Add the package to your npm dependencies
14
15```
16npm install expo-standard-web-crypto
17```
18
19### Using the polyfill
20
21There are two ways to use this package: you can import a `Crypto` instance or you can globally define `crypto`. Some code may expect the latter.
22
23Importing a `Crypto` instance:
24
25```js
26import crypto from 'expo-standard-web-crypto';
27```
28
29Globally defining `crypto`:
30
31```js
32import { polyfillWebCrypto } from 'expo-standard-web-crypto';
33
34polyfillWebCrypto();
35// crypto is now globally defined
36```
37
38In either case, if your runtime environment already defines `crypto` globally, this package uses that instance instead of providing its own.
39
40# Contributing
41
42Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).
43