UNPKG

@secux/utility

Version:

SecuX Hardware Wallet internal tools for SDK

68 lines (64 loc) 2.29 kB
/*! Copyright 2022 SecuX Technology Inc Copyright Chen Wei-En Copyright Wu Tsung-Yu 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. */ /// <reference types="node" /> /// <reference types="node" /> export declare const ONESIGN_THRESHOLD = 4000; export declare const MAX_HEAD_SIZE = 25; export declare const toCommunicationData: ((data: Buffer) => Buffer) | ((data: Buffer) => string); export declare function wrapResult(data: any): any; export declare function Send(cla: number, ins: number, p1?: number, p2?: number, data?: Buffer): communicationData; export declare function toAPDUResponse(rsp: Buffer): { data: Buffer; dataLength: number; status: number; }; export declare function getBuffer(data: communicationData): Buffer; export declare function to_L1_APDU(data: communicationData): communicationData; export declare function communicationWrapper(instance: object): any; export declare class TransportStatusError extends Error { #private; constructor(code: number, version?: number); get name(): string; get message(): string; get statusCode(): number; get statusText(): string; get version(): number; } export type base64String = string; export type communicationData = base64String | Buffer; /** * @deprecated */ export declare const base64_regexp: RegExp; export declare const ow_communicationData: import("ow").AnyPredicate<string | Buffer>; export declare enum StatusCode { SUCCESS = 36864, USER_CANCEL = 36865, DATA_ERROR = 20481, CLA_ERROR = 20482, INS_ERROR = 20483 } export declare enum StatusCodeV2 { OK = 0, NO_LEADING_PACKET = 1, COMMAND_OVERLAY = 2, INVALID_COMMAND = 3, INCORRENT_PARAMETER_SIZE = 4, INVALID_PARAMETER_VALUE = 5, NOT_FOUND = 6, ALREADY_EXIST = 7, IO_ERROR = 8, NOT_SUPPORT = 9 }