@walletconnect/iso-crypto
Advanced tools
Comparing version 1.6.5 to 1.6.6
@@ -5,10 +5,10 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const crypto = tslib_1.__importStar(require("@walletconnect/crypto")); | ||
const encoding = tslib_1.__importStar(require("@walletconnect/encoding")); | ||
const crypto = (0, tslib_1.__importStar)(require("@walletconnect/crypto")); | ||
const encoding = (0, tslib_1.__importStar)(require("@walletconnect/encoding")); | ||
const utils_1 = require("@walletconnect/utils"); | ||
function generateKey(length) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const _length = (length || 256) / 8; | ||
const bytes = crypto.randomBytes(_length); | ||
const result = utils_1.convertBufferToArrayBuffer(encoding.arrayToBuffer(bytes)); | ||
const result = (0, utils_1.convertBufferToArrayBuffer)(encoding.arrayToBuffer(bytes)); | ||
return result; | ||
@@ -19,3 +19,3 @@ }); | ||
function verifyHmac(payload, key) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const cipherText = encoding.hexToArray(payload.data); | ||
@@ -36,6 +36,6 @@ const iv = encoding.hexToArray(payload.iv); | ||
function encrypt(data, key, providedIv) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const _key = encoding.bufferToArray(utils_1.convertArrayBufferToBuffer(key)); | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const _key = encoding.bufferToArray((0, utils_1.convertArrayBufferToBuffer)(key)); | ||
const ivArrayBuffer = providedIv || (yield generateKey(128)); | ||
const iv = encoding.bufferToArray(utils_1.convertArrayBufferToBuffer(ivArrayBuffer)); | ||
const iv = encoding.bufferToArray((0, utils_1.convertArrayBufferToBuffer)(ivArrayBuffer)); | ||
const ivHex = encoding.arrayToHex(iv, false); | ||
@@ -58,4 +58,4 @@ const contentString = JSON.stringify(data); | ||
function decrypt(payload, key) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const _key = encoding.bufferToArray(utils_1.convertArrayBufferToBuffer(key)); | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
const _key = encoding.bufferToArray((0, utils_1.convertArrayBufferToBuffer)(key)); | ||
if (!_key) { | ||
@@ -62,0 +62,0 @@ throw new Error("Missing key: required for decryption"); |
{ | ||
"name": "@walletconnect/iso-crypto", | ||
"version": "1.6.5", | ||
"version": "1.6.6", | ||
"description": "Isomorphic Crypto for WalletConnect", | ||
@@ -65,6 +65,6 @@ "scripts": { | ||
"@walletconnect/crypto": "^1.0.1", | ||
"@walletconnect/types": "^1.6.5", | ||
"@walletconnect/utils": "^1.6.5" | ||
"@walletconnect/types": "^1.6.6", | ||
"@walletconnect/utils": "^1.6.6" | ||
}, | ||
"gitHead": "165f7993c2acc907c653c02847fb02721052c6e7" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
202870
Updated@walletconnect/types@^1.6.6
Updated@walletconnect/utils@^1.6.6