32 lines
797 B
TypeScript
32 lines
797 B
TypeScript
import 'react-native-get-random-values';
|
|
import 'react-native-url-polyfill/auto';
|
|
import { Buffer } from 'buffer';
|
|
|
|
if (typeof global !== 'undefined') {
|
|
if (typeof global.Buffer === 'undefined') {
|
|
global.Buffer = Buffer;
|
|
}
|
|
} else if (typeof window !== 'undefined') {
|
|
if (typeof (window as any).Buffer === 'undefined') {
|
|
(window as any).Buffer = Buffer;
|
|
}
|
|
}
|
|
|
|
const { getRandomValues } = require('react-native-get-random-values');
|
|
|
|
if (typeof global !== 'undefined') {
|
|
if (typeof global.crypto === 'undefined') {
|
|
(global as any).crypto = {
|
|
getRandomValues: getRandomValues,
|
|
};
|
|
}
|
|
} else if (typeof window !== 'undefined') {
|
|
if (typeof window.crypto === 'undefined') {
|
|
(window as any).crypto = {
|
|
getRandomValues: getRandomValues,
|
|
};
|
|
}
|
|
}
|
|
|
|
export {};
|