Provides classes for interacting with Hermit.
Hermit uses the Blockchain Commons UR encoding for data IO with individual UR parts represented as QR codes.
When receiving data from Hermit, calling applications are
responsible for parsing UR parts from the animated sequence of QR
codes Hermit displays. The BCURDecode
class is designed to make
this easy.
When sending data to Hermit, these interaction classes encode the data into UR parts. Calling applications are responsible for displaying these UR parts as an animated QR code sequence.
The following API classes are implemented:
- HermitExportExtendedPublicKey
- HermitSignMultisigTransaction
Classes
Members
(inner, constant) DESCRIPTOR_REGEXP
Reads an extended public key from data returned by Hermit's
display-xpub
command.
This interaction class works in tandem with the BCURDecoder
class. The BCURDecoder
parses data from Hermit, this class
interprets it.
Example
// Hermit returns a descriptor encoded as hex through BC-UR. Some
// application function needs to work with the BCURDecoder class to
// parse this data.
const descriptorHex = readQRCodeSequence();
// The interaction parses the data from Hermit
const interaction = new HermitExportExtendedPublicKey();
const {xpub, bip32Path, rootFingerprint} = interaction.parse(descriptorHex);
console.log(xpub);
// "xpub..."
console.log(bip32Path);
// "m/45'/0'/0'"
console.log(rootFingerprint);
// "abcdefgh"