Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sidmorizon committed Oct 7, 2023
1 parent 6a2efd4 commit 2ef44a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/shared/src/modules3rdParty/cross-crypto/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const crypto = require('crypto-browserify');
if (process.env.NODE_ENV !== 'production') {
const getRandomValuesOld = global.crypto.getRandomValues;
global.crypto.getRandomValues = function (...args) {
console.log('------------ call global.crypto.getRandomValues (web)');
return getRandomValuesOld.apply(global.crypto, args);
};
}

// **** for test only
// if (process.env.NODE_ENV !== 'production') {
// const getRandomValuesOld = global.crypto.getRandomValues;
// global.crypto.getRandomValues = function (...args) {
// return getRandomValuesOld.apply(global.crypto, args);
// };
// }
const crypto = require('crypto-browserify');

if (global.crypto) {
global.crypto.randomBytes = global.crypto.randomBytes || crypto.randomBytes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ if (global.crypto && global.crypto.getRandomValues) {
// shim global.crypto.getRandomValues
require('react-native-get-random-values');

if (process.env.NODE_ENV !== 'production') {
const getRandomValuesOld = global.crypto.getRandomValues;
global.crypto.getRandomValues = function (...args) {
console.log('------------ call global.crypto.getRandomValues (native)');
return getRandomValuesOld.apply(global.crypto, args);
};
}

const crypto = require('react-native-crypto');

const { randomBytes } = require('@noble/hashes/utils');
Expand Down

0 comments on commit 2ef44a8

Please sign in to comment.