UNPKG

@ledgerhq/live-common

Version:
26 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const errors_1 = require("@ledgerhq/errors"); /** * Attempt to fetch the size of the custom image set on the device, * or zero if there is no custom image set. */ exports.default = async (transport) => { const res = await transport.send(0xe0, 0x64, 0x00, 0x00, Buffer.from([]), [ errors_1.StatusCodes.OK, errors_1.StatusCodes.DEVICE_IN_RECOVERY_MODE, errors_1.StatusCodes.UNKNOWN_APDU, ]); const status = res.readUInt16BE(res.length - 2); switch (status) { case errors_1.StatusCodes.OK: return res.readUInt32BE(); case errors_1.StatusCodes.UNKNOWN_APDU: // Nb For il fw, since it doesn't support CLS case errors_1.StatusCodes.CUSTOM_IMAGE_EMPTY: return 0; case errors_1.StatusCodes.DEVICE_IN_RECOVERY_MODE: throw new errors_1.UnexpectedBootloader(); } throw new errors_1.TransportStatusError(status); }; //# sourceMappingURL=customLockScreenFetchSize.js.map