Skip to Content
En esta página

CryptoHDKey

La clase CryptoHDKey representa información de claves deterministas jerárquicas.

OneKey puede exportar este objeto de registro como código QR para que la cartera derive direcciones a partir de los datos de la clave pública.

Parámetros

ParámetroTipoDescripción
isMasterbooleanSi es una clave maestra
isPrivateKeybooleanSi es una clave privada
keyBufferLos datos de la clave
chainCodeBufferEl código de cadena
useInfoCryptoCoinInfoInformación de uso
originCryptoKeypathLa ruta de origen
childrenCryptoKeypathLa ruta de los descendientes
parentFingerprintBufferLa huella digital de la clave superior
namestringEl nombre (opcional)
notestringLa nota (opcional)

Valores de la nota

  • 'account.standard' – Cuenta estándar BIP44
  • 'account.ledger_live' – Cuenta de Ledger Live
  • 'account.ledger_legacy' – Cuenta heredada de Ledger

Ejemplo de UR

UR:CRYPTO-HDKEY/PDAXHDCLAOZTRDKBTKFPRFKBCWVEWYBGDPNTCPVLEOENJSWMBKFTLTRESNWTNLTLMKJYVYMWBSAAHDCXCSBNNLLNBZIAJZTPKPPKJOSTCEZSJEKGYKJOCSKNHFTPSWTIGHVABDIEGTBWWLTEAHTAADEHOYADCSFNAMTAADDYOYADLNCSDWYKCSFNYKAEYKATTAADDYOYADLRAEWKLAWKAYAEASINFPIAIAJLKPJTJYCXEHBKKOGHISINJKCXINJKCXHSC

Ejemplo de decodificación

import { URDecoder } from '@ngraveio/bc-ur'; import { CryptoHDKey } from '@keystonehq/bc-ur-registry'; const dec = new URDecoder(); // push each scanned frame string into the decoder // dec.receivePart(frame) if (dec.isError()) throw new Error('Could not decode account QR code'); if (dec.isSuccess()) { const ur = dec.resultUR(); if (ur.type !== 'crypto-hdkey') throw new Error('Expected crypto-hdkey'); const hdkey = CryptoHDKey.fromCBOR(ur.cbor); if (hdkey.isPrivateKey()) throw new Error('Expected a public account export'); const name = hdkey.getName(); const note = hdkey.getNote(); const chainCode = hdkey.getChainCode(); const origin = hdkey.getOrigin(); const xfp = origin?.getSourceFingerprint(); }
Última actualización el