UNPKG

@metamask/eth-ledger-bridge-keyring

Version:
44 lines 1.57 kB
/** * Pure helpers shared by the DMK bridge and its tests. Extracted from * `LedgerDmkBridge` so they can be unit-tested in isolation and reused * without an instance. * * @module dmk/internal-utils */ /** * Strip a leading `0x` from a hex string, if present. * * @param value - The hex string (with or without `0x` prefix). * @returns The hex string with no `0x` prefix. */ export declare function stripHexPrefix(value: string): string; /** * Strip the leading `m/` from a BIP-32 derivation path. * * DMK / signer-kit accepts paths without the leading `m/`. * * @param path - The BIP-32 path (e.g. `m/44'/60'/0'/0/0`). * @returns The path with no leading `m/`. */ export declare function stripPathPrefix(path: string): string; /** * Normalize a signature `v` (or any numeric/string hex-ish value) to a hex * string without `0x` prefix. * * @param value - The raw value (`bigint`, `number`, or hex string). * @returns The hex string with no `0x` prefix. */ export declare function toHexString(value: bigint | number | string): string; /** * Convert a hex string to a `Uint8Array`. Strips a leading `0x` if present. * * Throws on inputs that would silently produce wrong bytes: * - odd-length strings (e.g. `'abc'`) * - non-hex characters (e.g. `'zz'`) * * @param value - The hex string (with or without `0x` prefix). * @returns The decoded bytes. * @throws {Error} If the input has odd length or contains non-hex characters. */ export declare function hexToBytes(value: string): Uint8Array; //# sourceMappingURL=internal-utils.d.mts.map