diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-23 15:04:44 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-23 15:04:44 -0600 |
commit | 810fcf99105016f5f55647d326909736c3641702 (patch) | |
tree | be4a46a0e0dccbb6c2dff47afacb0fced646e4b8 /src/platform | |
parent | 4eb8bc1249ccf6afaa0c77695057a13379cf1aa1 (diff) | |
download | voidsky-810fcf99105016f5f55647d326909736c3641702.tar.zst |
Remove webcrypto polyfill, as it's no longer needed
Diffstat (limited to 'src/platform')
-rw-r--r-- | src/platform/polyfills.native.ts | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/platform/polyfills.native.ts b/src/platform/polyfills.native.ts index e37a76958..26a535cca 100644 --- a/src/platform/polyfills.native.ts +++ b/src/platform/polyfills.native.ts @@ -1,30 +1 @@ -import {NativeModules} from 'react-native' -const {AppSecureRandomModule} = NativeModules -import {toByteArray} from 'base64-js' -// @ts-ignore we dont have types for this -prf -import crypto from '../third-party/msrcrypto' import '@zxing/text-encoding' // TextEncoder / TextDecoder - -async function generateSecureRandom(bytes: number) { - return toByteArray( - await AppSecureRandomModule.generateSecureRandomAsBase64(bytes), - ) -} - -export const whenWebCrypto = new Promise(async (resolve, reject) => { - try { - const bytes = await generateSecureRandom(48) - crypto.initPrng(Array.from(bytes)) - - // @ts-ignore global.window exists -prf - if (!global.window.crypto) { - // @ts-ignore global.window exists -prf - global.window.crypto = crypto - } - resolve(true) - } catch (e: any) { - reject(e) - } -}) - -export const webcrypto = crypto |