Curvy.Key (Curvy v0.2.2) View Source

Module used to create ECDSA keypairs and convert to private and public key binaries.

Link to this section Summary

Types

t()

ECDSA Keypair.

Functions

Converts the given Point to a ECDSA Keypair struct without a private key.

Converts the given private key binary to a ECDSA Keypair.

Converts the given public key binary to a ECDSA Keypair struct without a private key.

Creates a new random ESCDA keypair.

Returns the 32 byte private key binary from the given ECDSA Keypair.

Returns the public key binary from the given ECDSA Keypair in either compressed or uncompressed form.

Link to this section Types

Specs

t() :: %Curvy.Key{
  compressed: boolean(),
  crv: atom(),
  point: Curvy.Point.t(),
  privkey: binary() | nil
}

ECDSA Keypair.

Always contains the t:Point.t coordinates and optionally a private key binary.

Link to this section Functions

Link to this function

from_point(point, opts \\ [])

View Source

Specs

from_point(Curvy.Point.t(), keyword()) :: t()

Converts the given Point to a ECDSA Keypair struct without a private key.

Link to this function

from_privkey(arg, opts \\ [])

View Source

Specs

from_privkey(binary(), keyword()) :: t()

Converts the given private key binary to a ECDSA Keypair.

Specs

from_pubkey(binary()) :: t()

Converts the given public key binary to a ECDSA Keypair struct without a private key.

Specs

generate(keyword()) :: t()

Creates a new random ESCDA keypair.

Returns the 32 byte private key binary from the given ECDSA Keypair.

Link to this function

to_pubkey(key, opts \\ [])

View Source

Returns the public key binary from the given ECDSA Keypair in either compressed or uncompressed form.

Accepted options

  • :compressed - Return a 32 byte compressed public key. Default is true.