UNPKG

@ledgerhq/coin-stacks

Version:
38 lines 1.5 kB
import { ResponseAddress } from "@zondax/ledger-stacks"; /** * Checks if a string is a valid hexadecimal value * @param msg - The string to validate * @returns True if the string is a valid hex string with even length */ export declare const isValidHex: (msg: string) => boolean; /** * Checks if a string is valid base64 format * @param msg - The string to validate * @returns True if the string is a valid base64 string */ export declare const isValidBase64: (msg: string) => boolean; /** * Checks if a return code indicates success (0x9000) * @param code - The return code to check * @returns True if the code is the success code (0x9000) */ export declare const isNoErrorReturnCode: (code: number) => code is 36864; /** * Ensures a derivation path has the proper "m/" prefix * @param path - The derivation path to normalize * @returns The path with "m/" prefix if needed */ export declare const getPath: (path: string) => string; /** * Throws an error if the response contains an error code * @param r - The response from the Ledger device * @throws Error with the error code and message if the response has an error */ export declare const throwIfError: (r: ResponseAddress) => void; /** * Converts a string to a Buffer based on its format * @param message - The string to convert (hex, base64, or plain text) * @returns A Buffer representation of the input string */ export declare const getBufferFromString: (message: string) => Buffer; //# sourceMappingURL=utils.d.ts.map