Closed mr-smit closed 1 year ago
When you run binanceapi.js in web worker , we get error
window is not defined
to fix this problem , just remove window.
from this code:
function signMessage(message, secret) { return __awaiter(this, void 0, void 0, function* () { const encoder = new TextEncoder(); const key = yield window.crypto.subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']); const signature = yield window.crypto.subtle.sign('HMAC', key, encoder.encode(message)); return Array.prototype.map.call(new Uint8Array(signature), (x) => ('00' + x.toString(16)).slice(-2)).join(''); }); }
Thanks for letting me know! Would you mind making a PR? It's this file: https://github.com/tiagosiebler/binance/blob/master/src/util/browser-support.ts#L4-L12
When you run binanceapi.js in web worker , we get error
window is not defined
to fix this problem , just remove window.
from this code: