Skip to Content
On this page

CryptoHDKey

The CryptoHDKey class represents hierarchical deterministic key information.

OneKey can export this registry object as a QR code so the wallet can derive addresses from public key data.

Parameters

ParameterTypeDescription
isMasterbooleanWhether it is a master key
isPrivateKeybooleanWhether it is a private key
keyBufferThe key data
chainCodeBufferThe chain code
useInfoCryptoCoinInfoUsage information
originCryptoKeypathThe origin path
childrenCryptoKeypathThe children path
parentFingerprintBufferThe parent fingerprint
namestringThe name (optional)
notestringThe note (optional)

Note Values

  • 'account.standard' – BIP44 Standard account
  • 'account.ledger_live' – Ledger Live account
  • 'account.ledger_legacy' – Ledger Legacy account

UR Example

UR:CRYPTO-HDKEY/PDAXHDCLAOZTRDKBTKFPRFKBCWVEWYBGDPNTCPVLEOENJSWMBKFTLTRESNWTNLTLMKJYVYMWBSAAHDCXCSBNNLLNBZIAJZTPKPPKJOSTCEZSJEKGYKJOCSKNHFTPSWTIGHVABDIEGTBWWLTEAHTAADEHOYADCSFNAMTAADDYOYADLNCSDWYKCSFNYKAEYKATTAADDYOYADLRAEWKLAWKAYAEASINFPIAIAJLKPJTJYCXEHBKKOGHISINJKCXINJKCXHSC

Decoding Example

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(); }
Last updated on