View Source BitcoinLib.Key.HD.DerivationPath.Parser.Type (BitcoinLib v0.4.7)

Extracts the first value of a derivation path, which is public or private.

This is a hardened value.

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

Link to this section Summary

Functions

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

Link to this section Functions

@spec extract(list()) :: {:ok, atom(), list()} | {:ok, nil, []} | {:error, binary()}

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

examples

Examples

iex> ["m", "0", "1", "2", "3", "4"]
...> |> BitcoinLib.Key.HD.DerivationPath.Parser.Type.extract()
{:ok, :private, ["0", "1", "2", "3", "4"]}