Skip to content

Commit c82741a

Browse files
Add fix for injecting crypto in webauthn test script for server
1 parent 0c8b068 commit c82741a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/server/webauthn/wasm_exec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@
144144
}
145145

146146
if (!globalThis.crypto) {
147-
throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
147+
try {
148+
globalThis.crypto = require("crypto");
149+
} catch (e) {
150+
console.error(e);
151+
throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
152+
}
148153
}
149154

150155
if (!globalThis.performance) {

0 commit comments

Comments
 (0)