mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
On web (browser/Electron), expo-crypto's randomUUID() and getRandomValues() just forward to globalThis.crypto.* (see expo-crypto/src/ExpoCrypto.web.ts). The previous polyfill installed `g.crypto.randomUUID = () => ExpoCrypto.randomUUID()`, which on web reads back through the same `globalThis.crypto.randomUUID` it just installed, recursing until the stack overflows. The same trap exists for getRandomValues, but it rarely triggers because the native version is almost always present. Capture a bound reference to the native getRandomValues *before* installing the polyfill, and generate UUID v4 in JS from 16 random bytes (RFC 4122 version + variant bits). The fallback path stays on ExpoCrypto.getRandomValues (non-recursive on native), and ExpoCrypto.randomUUID is no longer used.