close to final version added the subtaskand comment working section
This commit is contained in:
23
server/polyfill.js
Normal file
23
server/polyfill.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// Polyfill for crypto in Wizer environment
|
||||
if (!globalThis.crypto) {
|
||||
globalThis.crypto = {
|
||||
getRandomValues: (buffer) => {
|
||||
// Check if buffer is valid
|
||||
if (!buffer || typeof buffer.length !== 'number') {
|
||||
throw new Error("crypto.getRandomValues: invalid buffer");
|
||||
}
|
||||
// Fill with pseudo-random numbers
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
buffer[i] = Math.floor(Math.random() * 256);
|
||||
}
|
||||
return buffer;
|
||||
},
|
||||
randomUUID: () => {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
};
|
||||
console.log("Polyfilled globalThis.crypto for Wizer/Spin");
|
||||
}
|
||||
Reference in New Issue
Block a user