@secux/transport
Version:
SecuX Hardware Wallet transport API for communication layer
59 lines (55 loc) • 1.49 kB
TypeScript
/*!
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" />
import { StatusCode } from "@secux/utility/lib/communication";
export type TransportConfig = {
timeout?: number;
};
/**
* @property {number} cla
* @property {number} ins
* @property {number} [p1]
* @property {number} [p2]
* @property {Buffer} [data]
*/
export interface IAPDURequest {
cla: number;
ins: number;
p1?: number;
p2?: number;
data?: Buffer;
}
/**
* @property {number} dataLength
* @property {Buffer} data
* @property {StatusCOde} status
*/
export interface IAPDUResponse {
dataLength: number;
data: Buffer;
status: StatusCode;
}
export declare const ProtocolV2: Readonly<{
HEAD_PREFIX: 128;
TAIL_PREFIX: 111;
SERIAL_START: 112;
SERIAL_END: 127;
USB_BUFFER_LEN: 64;
}>;
export declare enum DeviceType {
crypto = "crypto",
nifty = "nifty",
shield = "shield"
}