UNPKG

@metamask/eth-ledger-bridge-keyring

Version:
71 lines 3.18 kB
import type { Apdu, ApduResponse, Command, CommandResult } from "@ledgerhq/device-management-kit"; export type EthGetAppConfigurationResponse = { readonly blindSigningEnabled: boolean; readonly web3ChecksEnabled: boolean; readonly web3ChecksOptIn: boolean; readonly version: string; }; /** * Discriminator (`_tag`) used by `EthGetAppConfigurationCommand` when raising * a {@link DeviceExchangeError}. Exported so tests and translators can * reference the canonical string instead of repeating a magic literal. */ export declare const ETH_APP_COMMAND_ERROR_TAG = "EthAppCommandError"; /** * Reads the Ethereum app configuration via the Ethereum application's * `getAppConfiguration` APDU (CLA `0xE0`, INS `0x06`). * * ## Wire format * * Defined by the Ethereum application APDU specification * ([`doc/ethapp.adoc`](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp.adoc#get-app-configuration), * § *GET APP CONFIGURATION*). * * The 4-byte response payload is laid out as: * * ``` * byte 0 flags bitmask * bytes 1..3 app version (major, minor, patch) * ``` * * The `flags` byte is defined by the spec as: * * ``` * 0x01 arbitrary data signature enabled by user (blind signing) * 0x02 ERC 20 Token information needs to be provided externally * 0x10 Transaction Check enabled (web3 checks) * 0x20 Transaction Check Opt-In done (web3 checks opt-in) * ``` * * This command mirrors the implementation in * [`@ledgerhq/device-signer-kit-ethereum`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/signer/signer-eth/src/internal/app-binder/command/GetAppConfigurationCommand.ts) * (`internal/app-binder/command/GetAppConfigurationCommand`), which is not * re-exported from that package's public entry point. Until the signer kit * exposes `GetAppConfiguration` publicly, this module is the only way to * invoke the Ethereum `getAppConfiguration` APDU through the DMK * `sendCommand` API. * * ## Related APDU docs * * The other Ethereum APDUs the DMK signer kit sends on our behalf are also * defined in the same `ethapp.adoc` document: * * - `GET ETH PUBLIC ADDRESS` — INS `0x02` * - `SIGN ETH TRANSACTION` — INS `0x04` * - `SIGN ETH PERSONAL MESSAGE` — INS `0x08` * - `SIGN ETH EIP 712` — INS `0x0C` * - `SIGN EIP 7702 AUTHORIZATION` — INS `0x34` * * ## Distinguishing DMK commands * * Note: this command is distinct from the DMK OS-level * [`GetAppAndVersionCommand`](https://github.com/LedgerHQ/device-sdk-ts/blob/main/packages/device-management-kit/src/api/command/os/GetAppAndVersionCommand.ts) * (`@ledgerhq/device-management-kit`), which returns only the app's name and * version and does not expose Ethereum-specific feature flags. */ export declare class EthGetAppConfigurationCommand implements Command<EthGetAppConfigurationResponse, void, string> { readonly name = "getAppConfiguration"; getApdu(): Apdu; parseResponse(response: ApduResponse): CommandResult<EthGetAppConfigurationResponse, string>; } //# sourceMappingURL=eth-get-app-configuration-command.d.cts.map