UNPKG

@funded-labs/plug-controller

Version:

Internet Computer Plug wallet's controller

17 lines (16 loc) 559 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bufferFromHex = exports.bufferToHex = void 0; const bufferToHex = (buffer) => { return [...new Uint8Array(buffer)] .map(x => x.toString(16).padStart(2, '0')) .join(''); }; exports.bufferToHex = bufferToHex; const bufferFromHex = (hexString) => { var typedArray = new Uint8Array((hexString.match(/[\da-f]{2}/gi) || []).map(function (h) { return parseInt(h, 16); })); return typedArray.buffer; }; exports.bufferFromHex = bufferFromHex;