Skip to content

Commit

Permalink
chore: update crypto getRandomValues function
Browse files Browse the repository at this point in the history
  • Loading branch information
kalashshah committed Nov 16, 2023
1 parent 01a8595 commit 2fcb3d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

diff --git a/node_modules/react-native-get-random-values/index.js b/node_modules/react-native-get-random-values/index.jsindex d5a72cc..dacd0f0 100644
--- a/node_modules/react-native-get-random-values/index.js
+++ b/node_modules/react-native-get-random-values/index.js
@@ -74,6 +74,6 @@ if (typeof global.crypto !== 'object') {
global.crypto = {}
}

-if (typeof global.crypto.getRandomValues !== 'function') {
+// if (typeof global.crypto.getRandomValues !== 'function') {
global.crypto.getRandomValues = getRandomValues
-}
+// }
17 changes: 2 additions & 15 deletions packages/reactnative/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ import { ChatsOptionsType } from '@pushprotocol/restapi/src/lib/chat/chats.js';
import Constants from '@pushprotocol/restapi/src/lib/constants.js';
import { decryptPGPKey } from '@pushprotocol/restapi/src/lib/helpers/crypto.js';

// TODO:fix this
//@ts-ignore
crypto.getRandomValues = (input) => {
return input;
};

const PGPHelper: IPGPHelper = {
async generateKeyPair() {
let keys = await OpenPGP.generate({ keyOptions: { rsaBits: 2048 } });
Expand Down Expand Up @@ -120,16 +114,9 @@ const updateGroup = async (options: ChatUpdateGroupType) => {
};

// checking if ethers works
const genRandomAddress = async () => {
const privateKey =
'25520e97c3f31af3824ff62e350126299997322ff7d340ffd81faa7f84609ef9';

// Create an instance of Wallet using the private key
const wallet = new ethers.Wallet(privateKey);

// Get the address from the wallet
const genRandomAddress = () => {
const wallet = ethers.Wallet.createRandom();
const address = wallet.address;

return address;
};

Expand Down

0 comments on commit 2fcb3d4

Please sign in to comment.