Comparing version 2.8.1 to 2.8.2
@@ -28,10 +28,10 @@ "use strict"; | ||
const pemContents = secret.substring(pemHeader.length, secret.length - pemFooter.length); | ||
const binaryDerString = window.atob(pemContents); | ||
const binaryDerString = globalThis.atob(pemContents); | ||
const binaryDer = str2ab(binaryDerString); | ||
const key = yield window.crypto.subtle.importKey('pkcs8', binaryDer, { name: 'RSASSA-PKCS1-v1_5', hash: { name: 'SHA-256' } }, false, ['sign']); | ||
const signature = yield window.crypto.subtle.sign('RSASSA-PKCS1-v1_5', key, encoder.encode(message)); | ||
const key = yield globalThis.crypto.subtle.importKey('pkcs8', binaryDer, { name: 'RSASSA-PKCS1-v1_5', hash: { name: 'SHA-256' } }, false, ['sign']); | ||
const signature = yield globalThis.crypto.subtle.sign('RSASSA-PKCS1-v1_5', key, encoder.encode(message)); | ||
return btoa(String.fromCharCode(...new Uint8Array(signature))); | ||
} | ||
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)); | ||
const key = yield globalThis.crypto.subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign']); | ||
const signature = yield globalThis.crypto.subtle.sign('HMAC', key, encoder.encode(message)); | ||
return Array.prototype.map | ||
@@ -38,0 +38,0 @@ .call(new Uint8Array(signature), (x) => ('00' + x.toString(16)).slice(-2)) |
{ | ||
"name": "binance", | ||
"version": "2.8.1", | ||
"version": "2.8.2", | ||
"description": "Complete & robust node.js SDK for Binance's REST APIs and WebSockets, with TypeScript & end-to-end tests.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
463813