View Source OnFlow.Credentials (on_flow v0.13.0)
Defines a struct that contains an address, a public key, and a private key.
:address
might be nil
, but the key will be present in the struct.
Do not initialize this directly. Instead, call Credentials.new/1
or
Credentials.new!/1
.
Link to this section Summary
Functions
Returns a %Credentials{}
struct with the keypairs generated.
Initializes a %Credentials{}
struct. Returns {:ok, credentials}
on
success. The params must contain a :private_key
and :public_key
, or
{:error, :missing_keys}
will be returned.
Initializes a %Credentials{}
struct. Raises on error. See the documentation
for new/1
.
Link to this section Types
@type t() :: %OnFlow.Credentials{
address: nil | hex_string(),
private_key: hex_string(),
public_key: hex_string()
}
Link to this section Functions
@spec generate_keys() :: t()
Returns a %Credentials{}
struct with the keypairs generated.
@spec new(keys_with_address()) :: {:ok, t()} | {:error, :missing_keys}
Initializes a %Credentials{}
struct. Returns {:ok, credentials}
on
success. The params must contain a :private_key
and :public_key
, or
{:error, :missing_keys}
will be returned.
:public_key
and :private_key
must be hex-encoded strings.
Initializes a %Credentials{}
struct. Raises on error. See the documentation
for new/1
.