@hazae41/ledger
Version:
Private and supply-chain hardened Ledger controller for TypeScript
46 lines (43 loc) • 1.73 kB
TypeScript
import { Uint8Array } from '@hazae41/bytes';
import { RsvSignature } from '@hazae41/cubane';
import { Connector } from '../apdu/index.js';
interface AppConfigResult {
readonly arbitraryDataEnabled: boolean;
readonly erc20ProvisioningNecessary: boolean;
readonly starkEnabled: boolean;
readonly starkv2Supported: boolean;
readonly version: string;
}
declare function getAppConfigOrThrow(device: Connector): Promise<AppConfigResult>;
interface GetAddressResult {
/**
* 0x-prefixed hex address
*/
readonly address: string;
/**
* Raw uncompressed public key bytes
*/
readonly uncompressedPublicKey: Uint8Array;
/**
* Raw chaincode bytes
*/
readonly chaincode: Uint8Array<32>;
}
/**
* Just get the address
* @param device
* @param path
* @returns
*/
declare function getAddressOrThrow(device: Connector, path: string): Promise<GetAddressResult>;
/**
* Ask the user to verify the address and get it
* @param device
* @param path
* @returns
*/
declare function verifyAndGetAddressOrThrow(device: Connector, path: string): Promise<GetAddressResult>;
declare function signPersonalMessageOrThrow(device: Connector, path: string, message: Uint8Array): Promise<RsvSignature>;
declare function signTransactionOrThrow(device: Connector, path: string, transaction: Uint8Array): Promise<RsvSignature>;
declare function signEIP712HashedMessageOrThrow(device: Connector, path: string, domain: Uint8Array<32>, message: Uint8Array<32>): Promise<RsvSignature>;
export { type AppConfigResult, type GetAddressResult, getAddressOrThrow, getAppConfigOrThrow, signEIP712HashedMessageOrThrow, signPersonalMessageOrThrow, signTransactionOrThrow, verifyAndGetAddressOrThrow };