in packages/random-source-browser/src/index.ts [8:21]
export function testableRandomValues(
supports: typeof supportsWebCrypto
) {
return function randomValues(byteLength: number): Promise<Uint8Array> {
// Find the global scope for this runtime
const globalScope = locateWindow();
if (supports(globalScope)) {
return webCryptoRandomValues(byteLength);
}
return Promise.reject(new Error(`Unable to locate a secure random source.`));
}
}