Move the secure-random code into this project due to build issues with the module, which is no longer maintained
This commit is contained in:
@@ -1,7 +1,17 @@
|
||||
import {generateSecureRandom} from 'react-native-securerandom'
|
||||
// import {generateSecureRandom} from 'react-native-securerandom'
|
||||
import {NativeModules} from 'react-native'
|
||||
const {AppSecureRandomModule} = NativeModules
|
||||
import {toByteArray} from 'base64-js'
|
||||
import crypto from 'msrcrypto'
|
||||
import '@zxing/text-encoding' // TextEncoder / TextDecoder
|
||||
|
||||
async function generateSecureRandom(bytes: number) {
|
||||
console.log('a')
|
||||
return toByteArray(
|
||||
await AppSecureRandomModule.generateSecureRandomAsBase64(bytes),
|
||||
)
|
||||
}
|
||||
|
||||
export const whenWebCrypto = new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const bytes = await generateSecureRandom(48)
|
||||
|
||||
Reference in New Issue
Block a user