1 | export default {
|
2 | get name(): string {
|
3 | return 'ExpoRandom';
|
4 | },
|
5 | getRandomBytes(length: number): Uint8Array {
|
6 | const array = new Uint8Array(length);
|
7 | // @ts-ignore
|
8 | return (window.crypto ?? window.msCrypto).getRandomValues(array);
|
9 | },
|
10 | async getRandomBytesAsync(length: number): Promise<Uint8Array> {
|
11 | const array = new Uint8Array(length);
|
12 | // @ts-ignore
|
13 | return (window.crypto ?? window.msCrypto).getRandomValues(array);
|
14 | },
|
15 | };
|