@zondax/ledger-js
Version:
TS / Node API for apps running on Ledger devices
149 lines • 9.49 kB
JavaScript
"use strict";
/******************************************************************************
* (c) 2018 - 2024 Zondax AG
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ERROR_DESCRIPTION_OVERRIDE = exports.LedgerError = exports.PAYLOAD_TYPE = exports.LEDGER_DASHBOARD_CLA = exports.HARDENED = void 0;
exports.HARDENED = 0x80000000;
exports.LEDGER_DASHBOARD_CLA = 0xb0;
// Payload types for transactions
exports.PAYLOAD_TYPE = {
INIT: 0x00,
ADD: 0x01,
LAST: 0x02,
};
// Ledger error codes and descriptions sorted by value
var LedgerError;
(function (LedgerError) {
LedgerError[LedgerError["U2FUnknown"] = 1] = "U2FUnknown";
LedgerError[LedgerError["U2FBadRequest"] = 2] = "U2FBadRequest";
LedgerError[LedgerError["U2FConfigurationUnsupported"] = 3] = "U2FConfigurationUnsupported";
LedgerError[LedgerError["U2FDeviceIneligible"] = 4] = "U2FDeviceIneligible";
LedgerError[LedgerError["U2FTimeout"] = 5] = "U2FTimeout";
LedgerError[LedgerError["Timeout"] = 14] = "Timeout";
LedgerError[LedgerError["GpAuthFailed"] = 25344] = "GpAuthFailed";
LedgerError[LedgerError["PinRemainingAttempts"] = 25536] = "PinRemainingAttempts";
LedgerError[LedgerError["ExecutionError"] = 25600] = "ExecutionError";
LedgerError[LedgerError["WrongLength"] = 26368] = "WrongLength";
LedgerError[LedgerError["IncorrectLength"] = 26368] = "IncorrectLength";
LedgerError[LedgerError["MissingCriticalParameter"] = 26624] = "MissingCriticalParameter";
LedgerError[LedgerError["ErrorDerivingKeys"] = 26626] = "ErrorDerivingKeys";
LedgerError[LedgerError["EmptyBuffer"] = 27010] = "EmptyBuffer";
LedgerError[LedgerError["SecurityStatusNotSatisfied"] = 27010] = "SecurityStatusNotSatisfied";
LedgerError[LedgerError["OutputBufferTooSmall"] = 27011] = "OutputBufferTooSmall";
LedgerError[LedgerError["DataIsInvalid"] = 27012] = "DataIsInvalid";
LedgerError[LedgerError["ConditionsOfUseNotSatisfied"] = 27013] = "ConditionsOfUseNotSatisfied";
LedgerError[LedgerError["CommandIncompatibleFileStructure"] = 27009] = "CommandIncompatibleFileStructure";
LedgerError[LedgerError["TransactionRejected"] = 27014] = "TransactionRejected";
LedgerError[LedgerError["BadKeyHandle"] = 27264] = "BadKeyHandle";
LedgerError[LedgerError["IncorrectData"] = 27264] = "IncorrectData";
LedgerError[LedgerError["ReferencedDataNotFound"] = 27272] = "ReferencedDataNotFound";
LedgerError[LedgerError["NotEnoughMemorySpace"] = 27268] = "NotEnoughMemorySpace";
LedgerError[LedgerError["FileAlreadyExists"] = 27273] = "FileAlreadyExists";
LedgerError[LedgerError["InvalidP1P2"] = 27392] = "InvalidP1P2";
LedgerError[LedgerError["IncorrectP1P2"] = 27392] = "IncorrectP1P2";
LedgerError[LedgerError["InstructionNotSupported"] = 27904] = "InstructionNotSupported";
LedgerError[LedgerError["InsNotSupported"] = 27904] = "InsNotSupported";
LedgerError[LedgerError["UnknownApdu"] = 27906] = "UnknownApdu";
LedgerError[LedgerError["DeviceNotOnboarded"] = 27911] = "DeviceNotOnboarded";
LedgerError[LedgerError["DeviceNotOnboarded2"] = 26129] = "DeviceNotOnboarded2";
LedgerError[LedgerError["CustomImageBootloader"] = 26159] = "CustomImageBootloader";
LedgerError[LedgerError["CustomImageEmpty"] = 26158] = "CustomImageEmpty";
LedgerError[LedgerError["AppDoesNotSeemToBeOpen"] = 28161] = "AppDoesNotSeemToBeOpen";
LedgerError[LedgerError["ClaNotSupported"] = 28160] = "ClaNotSupported";
LedgerError[LedgerError["Licensing"] = 28482] = "Licensing";
LedgerError[LedgerError["UnknownError"] = 28416] = "UnknownError";
LedgerError[LedgerError["TechnicalProblem"] = 28416] = "TechnicalProblem";
LedgerError[LedgerError["SignVerifyError"] = 28417] = "SignVerifyError";
LedgerError[LedgerError["Halted"] = 28586] = "Halted";
LedgerError[LedgerError["NoErrors"] = 36864] = "NoErrors";
LedgerError[LedgerError["DeviceIsBusy"] = 36865] = "DeviceIsBusy";
LedgerError[LedgerError["UnknownTransportError"] = 65535] = "UnknownTransportError";
LedgerError[LedgerError["AccessConditionNotFulfilled"] = 38916] = "AccessConditionNotFulfilled";
LedgerError[LedgerError["AlgorithmNotSupported"] = 38020] = "AlgorithmNotSupported";
LedgerError[LedgerError["CodeBlocked"] = 38976] = "CodeBlocked";
LedgerError[LedgerError["CodeNotInitialized"] = 38914] = "CodeNotInitialized";
LedgerError[LedgerError["ContradictionInvalidation"] = 38928] = "ContradictionInvalidation";
LedgerError[LedgerError["ContradictionSecretCodeStatus"] = 38920] = "ContradictionSecretCodeStatus";
LedgerError[LedgerError["InvalidKcv"] = 38021] = "InvalidKcv";
LedgerError[LedgerError["InvalidOffset"] = 37890] = "InvalidOffset";
LedgerError[LedgerError["LockedDevice"] = 21781] = "LockedDevice";
LedgerError[LedgerError["MaxValueReached"] = 38992] = "MaxValueReached";
LedgerError[LedgerError["MemoryProblem"] = 37440] = "MemoryProblem";
LedgerError[LedgerError["NoEfSelected"] = 37888] = "NoEfSelected";
LedgerError[LedgerError["InconsistentFile"] = 37896] = "InconsistentFile";
LedgerError[LedgerError["FileNotFound"] = 37892] = "FileNotFound";
LedgerError[LedgerError["UserRefusedOnDevice"] = 21761] = "UserRefusedOnDevice";
LedgerError[LedgerError["NotEnoughSpace"] = 20738] = "NotEnoughSpace";
LedgerError[LedgerError["GenericError"] = 4294967295] = "GenericError";
})(LedgerError || (exports.LedgerError = LedgerError = {}));
exports.ERROR_DESCRIPTION_OVERRIDE = {
[]: 'U2F: Unknown',
[]: 'U2F: Bad request',
[]: 'U2F: Configuration unsupported',
[]: 'U2F: Device Ineligible',
[]: 'U2F: Timeout',
[]: 'Timeout',
[]: 'No errors',
[]: 'Device is busy',
[]: 'Error deriving keys',
[]: 'Execution Error',
[]: 'Wrong Length',
[]: 'Empty Buffer',
[]: 'Output buffer too small',
[]: 'Data is invalid',
[]: 'Transaction rejected',
[]: 'Bad key handle',
[]: 'Invalid P1/P2',
[]: 'Instruction not supported',
[]: 'App does not seem to be open',
[]: 'Unknown error',
[]: 'Sign/verify error',
[]: 'Unknown transport error',
[]: 'GP Authentication Failed',
[]: 'PIN Remaining Attempts',
[]: 'Missing Critical Parameter',
[]: 'Conditions of Use Not Satisfied',
[]: 'Command Incompatible with File Structure',
[]: 'Referenced Data Not Found',
[]: 'Not Enough Memory Space',
[]: 'File Already Exists',
[]: 'Unknown APDU',
[]: 'Device Not Onboarded',
[]: 'Device Not Onboarded (Secondary)',
[]: 'Custom Image Bootloader Error',
[]: 'Custom Image Empty',
[]: 'CLA Not Supported',
[]: 'Licensing Error',
[]: 'Device Halted',
[]: 'Access Condition Not Fulfilled',
[]: 'Algorithm Not Supported',
[]: 'Code Blocked',
[]: 'Code Not Initialized',
[]: 'Contradiction Invalidation',
[]: 'Contradiction with Secret Code Status',
[]: 'Invalid KCV',
[]: 'Invalid Offset',
[]: 'Device Locked',
[]: 'Maximum Value Reached',
[]: 'Memory Problem',
[]: 'No EF Selected',
[]: 'Inconsistent File',
[]: 'File Not Found',
[]: 'User Refused on Device',
[]: 'Not Enough Space',
[]: 'Generic Error',
};
//# sourceMappingURL=consts.js.map