import { Buffer } from "buffer"; export const randomBytes = (len, cb) => { if (cb) throw "async not supported"; const arr = new Uint8Array(len); self.crypto.getRandomValues(arr); return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength); };