跳到主要内容

Key Path

CryptoKeypath 用于描述 BIP-44 等 HD 钱包派生路径。离线签名请求会依赖它告诉设备应该使用哪个账户或地址对应的密钥。

参数说明

字段值类型用途
componentsPathComponent[]路径组件,默认可为空
sourceFingerprintBuffer来源指纹,可选
depthnumber路径深度,可选

PathComponent

PathComponent 类用于描述密钥路径中的单个组件,例如 44'60'0

参数说明

字段值类型用途
indexnumber当前组件的索引值(可选)
hardenedboolean是否为硬化派生

示范

import { CryptoKeypath, PathComponent } from "@keystonehq/bc-ur-registry";

// path note: BIP44: m/44'/60'/0'/0/0
const keypath = new CryptoKeypath([
new PathComponent({ index: 44, hardened: true }),
new PathComponent({ index: 60, hardened: true }),
new PathComponent({ index: 0, hardened: true }),
new PathComponent({ index: 0, hardened: false }),
new PathComponent({ index: 0, hardened: false }),
]);

UR例子

ur:crypto-keypath/xxxxx