1 parent 06859bd commit 1b41bc2Copy full SHA for 1b41bc2
1 file changed
cmd/workers-assets-gen/assets/wasm_exec_tinygo.js
@@ -296,6 +296,15 @@
296
return BigInt((timeOrigin + performance.now()) * 1e6);
297
},
298
299
+ // func getRandomData(r []byte)
300
+ "runtime.getRandomData": (slice_ptr, slice_len, slice_cap) => {
301
+ const buf = loadSlice(slice_ptr, slice_len, slice_cap);
302
+ // crypto.getRandomValues has a 65536-byte limit per call
303
+ for (let offset = 0; offset < buf.length; offset += 65536) {
304
+ crypto.getRandomValues(buf.subarray(offset, Math.min(offset + 65536, buf.length)));
305
+ }
306
+ },
307
+
308
// func sleepTicks(timeout int64)
309
"runtime.sleepTicks": (timeout) => {
310
// Do not sleep, only reactivate scheduler after the given timeout.
0 commit comments