View Source BitcoinLib.Key.HD.DerivationPath.Parser.Account (BitcoinLib v0.4.3)

Splits the key space into independent user identities.

This is a hardened value.

See: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#account

Link to this section Summary

Functions

Converts a list of path levels managed up until the account value, extracts the account and returns the remaining levels

Link to this section Functions

@spec extract(list()) :: {:ok, nil | integer(), list()} | {:error, binary()}

Converts a list of path levels managed up until the account value, extracts the account and returns the remaining levels

examples

Examples

iex> ["0'", "1", "2"]
...> |> BitcoinLib.Key.HD.DerivationPath.Parser.Account.extract()
{:ok, 0, ["1", "2"]}

iex> ["0", "1", "2"]
...> |> BitcoinLib.Key.HD.DerivationPath.Parser.Account.extract()
{:error, "account number must be a hardened value"}