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:
:secret
[binary/0
]: public key point data;:curve
[Tezex.Crypto.Curve.t/0
]: public key curve information.
Summary
Functions
Holds private key data.
Creates a new private key
Gets the public key associated with a private key
Types
@type t() :: %Tezex.Crypto.PrivateKey{curve: Tezex.Crypto.Curve.t(), secret: binary()}
Functions
Holds private key data.
Parameters:
:secret
[binary/0
]: private key secret number as bytes:curve
[Tezex.Crypto.Curve.t/0
]: private key curve information
Creates a new private key
Parameters:
secret
[binary/0
]: private key secret. Default: nil -> random key will be generatedcurve_name
[atom/0
]: curve name. Default: :secp256k1
Returns:
private_key
[Tezex.Crypto.PrivateKey.t/0
]: private key struct
Example:
iex> Tezex.Crypto.PrivateKey.generate()
%Tezex.Crypto.PrivateKey{...}
@spec get_public_key(t()) :: Tezex.Crypto.PublicKey.t()
Gets the public key associated with a private key
Parameters:
private_key
[Tezex.Crypto.PrivateKey.t/0
]: private key struct
Returns:
public_key
[Tezex.Crypto.PublicKey.t/0
]: public key struct
Example:
iex> Tezex.Crypto.PrivateKey.get_public_key(private_key)
%Tezex.Crypto.PublicKey{...}