From ecb706310be695dd8b33906adec4b772ad64db9a Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Wed, 6 Apr 2022 01:22:05 +0900 Subject: [PATCH] remove react-native-get-random-values (#87) swap in react-native-uuid, which is a js-only impl of uuid without native requirements --- app/screens/ServerView.tsx | 8 ++++---- index.js | 1 - package.json | 4 +--- yarn.lock | 24 ++++++------------------ 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/app/screens/ServerView.tsx b/app/screens/ServerView.tsx index f41de16..1e74ef8 100644 --- a/app/screens/ServerView.tsx +++ b/app/screens/ServerView.tsx @@ -9,7 +9,7 @@ import { useNavigation } from '@react-navigation/native' import md5 from 'md5' import React, { useCallback, useState } from 'react' import { StyleSheet, Text, TextInput, View, ViewStyle } from 'react-native' -import { v4 as uuidv4 } from 'uuid' +import uuid from 'react-native-uuid' import SettingsSwitch from '@app/components/SettingsSwitch' const PASSWORD_PLACEHOLDER = 'PASSWORD_PLACEHOLDER' @@ -57,7 +57,7 @@ const ServerView: React.FC<{ const createServer = useCallback<() => Server>(() => { if (usePlainPassword) { return { - id: server?.id || uuidv4(), + id: server?.id || (uuid.v4() as string), usePlainPassword, plainPassword: password, address, @@ -72,12 +72,12 @@ const ServerView: React.FC<{ salt = server.salt token = server.token } else { - salt = uuidv4() + salt = uuid.v4() as string token = md5(password + salt) } return { - id: server?.id || uuidv4(), + id: server?.id || (uuid.v4() as string), address, username, usePlainPassword, diff --git a/index.js b/index.js index e9f6117..59a4b90 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,4 @@ import 'react-native-gesture-handler' -import 'react-native-get-random-values' import { enableScreens } from 'react-native-screens' enableScreens() diff --git a/package.json b/package.json index d5ca5c7..04b9673 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "react-native": "0.67.1", "react-native-fs": "^2.18.0", "react-native-gesture-handler": "^2.3.2", - "react-native-get-random-values": "^1.7.0", "react-native-image-colors": "^1.3.0", "react-native-linear-gradient": "^2.5.6", "react-native-popup-menu": "^0.15.11", @@ -48,9 +47,9 @@ "react-native-screens": "^3.4.0", "react-native-tab-view": "^2.16.0", "react-native-track-player": "https://github.com/austinried/react-native-track-player", + "react-native-uuid": "^2.0.1", "react-native-vector-icons": "^8.1.0", "react-native-webview": "^11.13.0", - "uuid": "^8.3.2", "zustand": "^3.7.1" }, "devDependencies": { @@ -64,7 +63,6 @@ "@types/md5": "^2.3.0", "@types/react-native-vector-icons": "^6.4.7", "@types/react-test-renderer": "^16.9.2", - "@types/uuid": "^8.3.0", "babel-jest": "^26.6.3", "babel-plugin-module-resolver": "^4.1.0", "eslint": "^7.14.0", diff --git a/yarn.lock b/yarn.lock index 76e6da2..67d59cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1584,11 +1584,6 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== -"@types/uuid@^8.3.0": - version "8.3.4" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc" - integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== - "@types/yargs-parser@*": version "20.2.1" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" @@ -3185,11 +3180,6 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -fast-base64-decode@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz#b434a0dd7d92b12b43f26819300d2dafb83ee418" - integrity sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q== - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -5982,13 +5972,6 @@ react-native-gesture-handler@^2.3.2: lodash "^4.17.21" prop-types "^15.7.2" -react-native-get-random-values@^1.7.0: - version "1.7.2" - resolved "https://registry.yarnpkg.com/react-native-get-random-values/-/react-native-get-random-values-1.7.2.tgz#60a9b6497d22e713779b71139f016a5fcec7ac04" - integrity sha512-28KRYGpIG/upV8+k/qFA+TwGW+yGjmtOHaCduJHpOQK1QUTyhiA6E2IgL4UvvU2dybeCTYFmUi9wcEQ0GiWe5g== - dependencies: - fast-base64-decode "^1.0.0" - react-native-image-colors@^1.3.0: version "1.5.0" resolved "https://registry.yarnpkg.com/react-native-image-colors/-/react-native-image-colors-1.5.0.tgz#42af81feb1c0654c8e4bad0d03bd9315c0b6a128" @@ -6046,6 +6029,11 @@ react-native-tab-view@^2.16.0: version "2.0.3" resolved "https://github.com/austinried/react-native-track-player#24cbbb4a4065ade9a38d2bcdeffa5b6a2f5c3d13" +react-native-uuid@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/react-native-uuid/-/react-native-uuid-2.0.1.tgz#ed4e2dfb1683eddb66967eb5dca140dfe1abddb9" + integrity sha512-cptnoIbL53GTCrWlb/+jrDC6tvb7ypIyzbXNJcpR3Vab0mkeaaVd5qnB3f0whXYzS+SMoSQLcUUB0gEWqkPC0g== + react-native-vector-icons@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/react-native-vector-icons/-/react-native-vector-icons-8.1.0.tgz#e8ee2b17bc4d9f636da1c6f67feee8e2a850c3d8" @@ -7245,7 +7233,7 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^8.3.0, uuid@^8.3.2: +uuid@^8.3.0: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==