Skip to Content
Auf dieser Seite

CryptoHDKey

Die Klasse CryptoHDKey stellt Informationen zu hierarchisch-deterministischen Schlüsseln dar.

OneKey kann dieses Registry-Objekt als QR-Code exportieren, damit die Wallet Adressen aus öffentlichen Schlüsseldaten ableiten kann.

Parameter

ParameterTypBeschreibung
isMasterbooleanOb es sich um einen Master-Schlüssel handelt
isPrivateKeybooleanOb es sich um einen privaten Schlüssel handelt
keyBufferDie Schlüsseldaten
chainCodeBufferDer Chain Code
useInfoCryptoCoinInfoNutzungsinformationen
originCryptoKeypathDer Ursprungspfad
childrenCryptoKeypathDer Pfad der untergeordneten Schlüssel
parentFingerprintBufferDer übergeordnete Fingerabdruck
namestringDer Name (optional)
notestringDie Notiz (optional)

Werte für die Notiz

  • 'account.standard' – BIP44-Standardkonto
  • 'account.ledger_live' – Ledger-Live-Konto
  • 'account.ledger_legacy' – Ledger-Legacy-Konto

UR-Beispiel

UR:CRYPTO-HDKEY/PDAXHDCLAOZTRDKBTKFPRFKBCWVEWYBGDPNTCPVLEOENJSWMBKFTLTRESNWTNLTLMKJYVYMWBSAAHDCXCSBNNLLNBZIAJZTPKPPKJOSTCEZSJEKGYKJOCSKNHFTPSWTIGHVABDIEGTBWWLTEAHTAADEHOYADCSFNAMTAADDYOYADLNCSDWYKCSFNYKAEYKATTAADDYOYADLRAEWKLAWKAYAEASINFPIAIAJLKPJTJYCXEHBKKOGHISINJKCXINJKCXHSC

Dekodierungsbeispiel

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(); }
Zuletzt aktualisiert am