UNPKG

@ledgerhq/live-common

Version:
27 lines 786 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUserHashes = void 0; const crypto_1 = require("./crypto"); const userHashesPerUserId = (userId) => { const firmwareSalt = (0, crypto_1.sha256)(userId + "|firmwareSalt") .toString("hex") .slice(0, 6); const endpointOverrides100 = (0, crypto_1.sha256)(userId + "|endpoint").readUInt16BE(0) % 100; return { firmwareSalt, endpointOverrides100, }; }; let cache; const getUserHashes = (userId) => { if (cache && userId === cache.userId) { return cache.value; } cache = { userId, value: userHashesPerUserId(userId), }; return cache.value; }; exports.getUserHashes = getUserHashes; //# sourceMappingURL=user.js.map