View Source Tezex.Crypto.PrivateKey (tezex v3.0.1)

Holds private key data.

Used to create private keys and created public keys from private keys.

Parameters:

Summary

Functions

Holds private key data.

Gets the public key associated with a private key

Types

@type t() :: %Tezex.Crypto.PrivateKey{curve: Tezex.Crypto.Curve.t(), secret: binary()}

Functions

Link to this function

%Tezex.Crypto.PrivateKey{}

View Source (struct)

Holds private key data.

Parameters:

Link to this function

generate(secret \\ nil, curve_name \\ :secp256k1)

View Source
@spec generate(nil | binary(), atom()) :: t()

Creates a new private key

Parameters:

  • secret [binary/0]: private key secret. Default: nil -> random key will be generated
  • curve_name [atom/0]: curve name. Default: :secp256k1

Returns:

Example:

iex> Tezex.Crypto.PrivateKey.generate()
%Tezex.Crypto.PrivateKey{...}
Link to this function

get_public_key(private_key)

View Source
@spec get_public_key(t()) :: Tezex.Crypto.PublicKey.t()

Gets the public key associated with a private key

Parameters:

Returns:

Example:

iex> Tezex.Crypto.PrivateKey.get_public_key(private_key)
%Tezex.Crypto.PublicKey{...}