UNPKG

safe-apps-sdk

Version:

SDK developed to integrate third-party apps with Safe app.

18 lines 609 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateRequestId = void 0; // i.e. 0-255 -> '00'-'ff' const dec2hex = (dec) => dec.toString(16).padStart(2, '0'); const generateId = (len) => { const arr = new Uint8Array((len || 40) / 2); window.crypto.getRandomValues(arr); return Array.from(arr, dec2hex).join(''); }; const generateRequestId = () => { if (typeof window !== 'undefined') { return generateId(10); } return new Date().getTime().toString(36); }; exports.generateRequestId = generateRequestId; //# sourceMappingURL=utils.js.map