UNPKG

@ledgerhq/live-common

Version:
26 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errors_1 = require("@ledgerhq/errors"); /** * Attempt to fetch a hash of the custom image loaded on the device. * We will not consider the 0x662e status code an error since it just * means empty custom image and an empty string will fit better. */ exports.default = async (transport) => { const res = await transport.send(0xe0, 0x66, 0x00, 0x00, Buffer.from([]), [ errors_1.StatusCodes.OK, errors_1.StatusCodes.CUSTOM_IMAGE_EMPTY, errors_1.StatusCodes.DEVICE_IN_RECOVERY_MODE, ]); const status = res.readUInt16BE(res.length - 2); switch (status) { case errors_1.StatusCodes.OK: return res.slice(0, res.length - 2).toString("hex"); case errors_1.StatusCodes.CUSTOM_IMAGE_EMPTY: return ""; case errors_1.StatusCodes.DEVICE_IN_RECOVERY_MODE: throw new errors_1.UnexpectedBootloader(); } throw new errors_1.TransportStatusError(status); }; //# sourceMappingURL=customLockScreenFetchHash.js.map