From 2122747fde952ca46f38aaaf4c493c7f1be87b8f Mon Sep 17 00:00:00 2001 From: QQ Date: Sat, 14 Nov 2026 14:11:46 +0800 Subject: [PATCH] Import apps/android/src/polyfills.ts --- apps/android/src/polyfills.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 apps/android/src/polyfills.ts diff --git a/apps/android/src/polyfills.ts b/apps/android/src/polyfills.ts new file mode 100644 index 0000000..421fcb0 --- /dev/null +++ b/apps/android/src/polyfills.ts @@ -0,0 +1,17 @@ +import * as ExpoCrypto from 'expo-crypto' + +// Noble's browser builds resolve the Web Crypto random source while their +// modules are being evaluated. Install the native Expo implementation before +// importing App (and therefore before importing @dsh-remote/crypto). +const currentCrypto = globalThis.crypto + +if (currentCrypto?.getRandomValues === undefined) { + Object.defineProperty(globalThis, 'crypto', { + value: { + ...currentCrypto, + getRandomValues: ExpoCrypto.getRandomValues, + randomUUID: ExpoCrypto.randomUUID, + }, + configurable: true, + }) +}