From c65a0f3fa73b901959d638d1e3591dfacdbed867 Mon Sep 17 00:00:00 2001 From: Christoph Tavan Date: Sun, 4 Oct 2020 17:29:58 +0200 Subject: [PATCH] fix: support expo>=39.0.0 (#515) Thanks to https://github.com/LinusU/react-native-get-random-values/pull/13 Expo finally has support for a sync CSPRNG. See also: https://dev.to/expo/expo-sdk-39-is-now-available-1lm8#new-synchronous-method-in-raw-exporandom-endraw- Fixes #375 --- README.md | 6 ++++-- README_js.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6a023798..6cea0393 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs - Node 8, 10, 12, 14 - Chrome, Safari, Firefox, Edge, IE 11 browsers - Webpack and rollup.js module bundlers - - [React Native](#react-native) + - [React Native / Expo](#react-native-expo) - **Secure** - Cryptographically-strong random values - **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers - **CLI** - Includes the [`uuid` command line](#command-line) utility @@ -405,7 +405,7 @@ Methods for the other algorithms ([`uuidv1()`](#uuidv1options-buffer-offset), [` This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill: -### React Native +### React Native / Expo 1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) 1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point: @@ -415,6 +415,8 @@ import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid'; ``` +Note: If you are using Expo, you must be using at least `react-native-get-random-values@1.5.0` and `expo@39.0.0`. + ### Web Workers / Service Workers (Edge <= 18) [In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please). diff --git a/README_js.md b/README_js.md index 2762aac7..6dbd05b9 100644 --- a/README_js.md +++ b/README_js.md @@ -24,7 +24,7 @@ For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs - Node 8, 10, 12, 14 - Chrome, Safari, Firefox, Edge, IE 11 browsers - Webpack and rollup.js module bundlers - - [React Native](#react-native) + - [React Native / Expo](#react-native-expo) - **Secure** - Cryptographically-strong random values - **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers - **CLI** - Includes the [`uuid` command line](#command-line) utility @@ -411,7 +411,7 @@ Methods for the other algorithms ([`uuidv1()`](#uuidv1options-buffer-offset), [` This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill: -### React Native +### React Native / Expo 1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme) 1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point: @@ -421,6 +421,8 @@ import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid'; ``` +Note: If you are using Expo, you must be using at least `react-native-get-random-values@1.5.0` and `expo@39.0.0`. + ### Web Workers / Service Workers (Edge <= 18) [In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please).