@ledgerhq/hw-app-canton
Version:
Ledger Hardware Wallet Canton Application API
71 lines • 1.96 kB
TypeScript
import type Transport from "@ledgerhq/hw-transport";
export type AppConfig = {
version: string;
};
export type CantonAddress = {
publicKey: string;
address: string;
path: string;
};
export type CantonSignature = string;
/**
* Canton BOLOS API
*/
export default class Canton {
transport: Transport;
constructor(transport: Transport, scrambleKey?: string);
/**
* Get a Canton address for a given BIP-32 path.
*
* @param path a path in BIP-32 format
* @param display whether to display the address on the device
* @return the address and public key
*/
getAddress(path: string, display?: boolean): Promise<CantonAddress>;
/**
* Sign a Canton transaction.
*
* @param path a path in BIP-32 format
* @param txHash the transaction hash to sign
* @return the signature
*/
signTransaction(path: string, txHash: string): Promise<CantonSignature>;
/**
* Get the app configuration.
* @return the app configuration including version
*/
getAppConfiguration(): Promise<AppConfig>;
/**
* Converts 65-byte Canton format to 64-byte Ed25519:
* [40][64_bytes_signature][00] (132 hex chars)
* @private
*/
private cleanSignatureFormat;
/**
* Helper method to handle transport response and check for errors
* @private
*/
private handleTransportResponse;
/**
* Serialize a BIP path to a data buffer for Canton BOLOS
* @private
*/
private serializePath;
/**
* Convert public key to address
* @private
*/
private publicKeyToAddress;
/**
* Extract Pubkey info from APDU response
* @private
* @returns Object with publicKey and chainCode as Buffer objects
*/
private extractPublicKeyAndChainCode;
/**
* Extract AppVersion from APDU response
* @private
*/
private extractVersion;
}
//# sourceMappingURL=Canton.d.ts.map