@hazae41/ledger
Version:
Private and supply-chain hardened Ledger controller for TypeScript
36 lines (33 loc) • 1.42 kB
TypeScript
import { ApduRequestInit, ApduResponse } from '@hazae41/apdu';
import { Writable, Opaque } from '@hazae41/binary';
declare const VENDOR_ID = 11415;
declare const PACKET_SIZE = 64;
declare class DeviceInterfaceNotFoundError extends Error {
#private;
readonly name: string;
constructor(options?: ErrorOptions);
static from(cause: unknown): DeviceInterfaceNotFoundError;
}
declare class DeviceTransferOutError extends Error {
#private;
readonly name: string;
constructor(options?: ErrorOptions);
static from(cause: unknown): DeviceTransferOutError;
}
declare class DeviceTransferInError extends Error {
#private;
readonly name: string;
constructor(options?: ErrorOptions);
static from(cause: unknown): DeviceTransferInError;
}
declare function getDevicesOrThrow(): Promise<USBDevice[]>;
declare function getOrRequestDeviceOrThrow(): Promise<USBDevice>;
declare function connectOrThrow(device: USBDevice): Promise<Connector>;
declare class Connector {
#private;
readonly device: USBDevice;
readonly iface: USBInterface;
constructor(device: USBDevice, iface: USBInterface);
requestOrThrow<T extends Writable>(init: ApduRequestInit<T>): Promise<ApduResponse<Opaque>>;
}
export { Connector, DeviceInterfaceNotFoundError, DeviceTransferInError, DeviceTransferOutError, PACKET_SIZE, VENDOR_ID, connectOrThrow, getDevicesOrThrow, getOrRequestDeviceOrThrow };