Expand description

Keyvault

Keyvault is a general purpose hierarchical deterministic (HD) generator for asymmetric keys. It is based on the same concepts as a Bitcoin HD-wallet and is built on the same specifications like HD wallets of Bip32, Mnemonic word lists of Bip39 and Purpose fields of Bip43.

Though keyvault is capable of generating wallet addresses as defined in Multi-Account cryptocurrency wallets of Bip44, it is not only an address generator for multiple cryptocurrencies. Keyvault can also derive all the keys you might need in other software stacks and aims to be your all-in-one Swiss Army knife identity manager.

Keyvault can

  • use the same seed to derive keys with multiple cipher suites, currently ed25519 and secp256k1
  • use any purpose field and account hierarchy, not only Bip43 and Bip44
  • handle several purposes (i.e. attached subhierarchies) at the same time
  • be used from other platforms via its C and WebAssembly bindings

Keyvault was originally created as part of the Mercury communication protocol but being a general-purpose tool it was reused in other components as well, hence was separated into its own repository then finally merged into this monorepository.

This documentation is optimized for reading after it is copied into JSDoc

For more information on this crate and potential usage, see the IOP developer site.

Structs

Entry point to generate extended private keys in a hierarchical deterministic wallet starting from a seed based on the BIP-0032 standard (and the SLIP-0010 for crypto suites other than Secp256k1).

In BIP-0032 each extended private key has the same operations, independently from the actual path. This struct represents such an extended private key in a given subtree.

In BIP-0032 a neutered extended private key is an extended public key. This object represents such an extended public key in a given subtree. It is able to do normal (public) derivation, signature verification, creating and validating key identifiers

Tool for generating, validating and parsing BIP-0039 phrases in different supported languages.

An intermediate object that represents a BIP39 phrase with a known language

Entry point to generate a hierarchical deterministic wallet using the BIP-0044 standard. It is a more structured way to use the same seed for multiple coins, each with multiple accounts, each accounts with a new key for each transaction request. The standard is built on BIP-0043 using the purpose code 44. And BIP-0043 itself uses BIP-0032 to derive all nodes from a single master extended private key.

Represents the private API of a given account of a given coin in the BIP32 tree.

Represents a given coin in the BIP32 tree.

Represents the private API of a key with a given index within a sub-account used on the chain for storing balance or authenticating actions.

Represents the public API of a given account of a given coin in the BIP32 tree.

Represents a public key with a given index within a sub-account used on the chain for verifying signatures or validating key identifiers.

Public API for a sub-account of a given account on a given coin that is either used for external keys (receiving addresses) or internal keys (change addresses). Some implementations do not distinguish these and just always use receiving addresses.

Private API for a sub-account of a given account on a given coin that is either used for external keys (receiving addresses) or internal keys (change addresses). Some implementations do not distinguish these and just always use receiving addresses.

Multicipher key id (fingerprint/digest/hash of a public key)

Multicipher private key

Multicipher public key

Multicipher signature

Starting point for deriving all Morpheus related keys in a BIP32 hierarchy. Morpheus uses Ed25519 cipher and currently there are no WASM wrappers for Bip32 nodes with that cipher. Still, Bip32 paths are returned by each object so compatible wallets can derive the same extended private keys.

Root node of a specific kind of DIDs. The kind used to derive a DID is indistiguishable outside the wallet.

The operations on an identifier that require the private key to be available in memory.

The operations on an identifier that do not require the private key to be available in memory.

Representation of the root node of the Morpheus subtree in the HD wallet.

Secp256k1 key id (fingerprint/digest/hash of a public key)

Secp256k1 private key

Secp256k1 public key

Secp256k1 signature

The seed used for BIP32 derivations. A seed cannot be turned back into a phrase, because there is salted hashing involed in creating it from the BIP39 mnemonic phrase.

Traits

An extension trait on Result that helps easy conversion of Rust errors to JavaScript error strings usable by wasm_bindgen

Most WASM types are wrapping a Rust type one-on-one. This trait helps to enforce a convention so that WASM types can easily peek under the hood of other such wrapped WASM types.

Most WASM types are wrapping a Rust type one-on-one. This trait helps to enforce a convention so that WASM types can easily peek under the hood of other such wrapped WASM types.

Functions

The list of all network names accepted by {@link validateNetworkName}

Decrypts the ciphertext with a password. The format of the ciphertext is defined by the {@link encrypt} function. Only the matching password will decrypt the ciphertext.

Encrypts the plaintext with a password. Make sure the password is not weak. A random nonce is generated for each call so each time the same plaintext is encrypted with the same password, the result is a different ciphertext. The ciphertext returned will be 40 bytes longer than the plaintext.

Converts any error that can be converted into a string into a JavaScript error string usable by wasm_bindgen

Free function that checks if a string is a valid network name usable as a parameter in some other calls.