Class Mnemonic
Helper class to produce public and private key values from mnemonic word phrases.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public sealed class Mnemonic
Remarks
Warning: this class has not been hardened against external attacks, it keeps the root seed in memory.
The words and passphrase are encoded as UTF-8 without the NFKD
normalization BIP-39 specifies. ASCII input, which includes the English
word list, is unaffected. A passphrase containing other characters can
derive different keys than other BIP-39 wallets do; to match them,
normalize it first with
passphrase.Normalize(System.Text.NormalizationForm.FormKD). The
SDK leaves it unnormalized so that keys already derived from such a
passphrase do not change.
Constructors
| Edit this page View SourceMnemonic(string[], string?)
Constructor taking an array of mnemonic words and a passphrase.
Declaration
public Mnemonic(string[] words, string? passphrase)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | words | An array of words that make up the mnemonic. |
| string | passphrase | Optional password (empty string or null is allowed for no password). It is used as given, without the NFKD normalization BIP-39 specifies; see the remarks. |
Methods
| Edit this page View SourceGenerateKeyPair(KeyDerivationPath)
Computes the HD key pair for this Mnemonic.
Declaration
public (ReadOnlyMemory<byte> publicKey, ReadOnlyMemory<byte> privateKey) GenerateKeyPair(KeyDerivationPath path)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyDerivationPath | path | The key derivation path that should be used to generate the private and public key values. |
Returns
| Type | Description |
|---|---|
| (ReadOnlyMemory<byte> publicKey, ReadOnlyMemory<byte> privateKey) | DER Encoded public and private key values. |