View Source Signet.Signer (Signet v0.1.0-rc4)
Link to this section Summary
Functions
Gets the address for this signer.
Gets the chain id for this signer.
Signet.Signer is a GenServer which can sign messages. This module takes an
mfa (mod, func, args triple) which defines how to actually sign messages.
For instance, Signet.Signer.Curvy
will sign with a public key, or
Signet.Signer.CloudKMS
will sign using a GCP Cloud KMS key. In either
case, the caller should start the GenServer, and then call:
Signet.Signer.sign(MySigner, "message")
. This should return back a
properly signed message.
Handles signing a message.
Tracks the address for determining the recovery bit. We do not permit signatures until this address is known.
Tracks the address for determining the recovery bit. We do not permit signatures until this address is known.
Initializes a new Signet.Signer. We make sure to assign set_address
, but we
send a message to perform that action, largely so that other processes have
a chance to start before this does. This is important for Goth keys to access
Cloud KMS.
Signs a message using this signing key.
Directly sign a message, not using a signer process.
Starts a new Signet.Signer process.
Link to this section Functions
Gets the address for this signer.
examples
Examples
iex> signer_proc = Signet.Test.Signer.start_signer()
iex> Signet.Signer.address(signer_proc) |> Base.encode16()
"63CC7C25E0CDB121ABB0FE477A6B9901889F99A7"
Gets the chain id for this signer.
examples
Examples
iex> signer_proc = Signet.Test.Signer.start_signer()
iex> Signet.Signer.chain_id(signer_proc)
5
Signet.Signer is a GenServer which can sign messages. This module takes an
mfa (mod, func, args triple) which defines how to actually sign messages.
For instance, Signet.Signer.Curvy
will sign with a public key, or
Signet.Signer.CloudKMS
will sign using a GCP Cloud KMS key. In either
case, the caller should start the GenServer, and then call:
Signet.Signer.sign(MySigner, "message")
. This should return back a
properly signed message.
Note: we also enforce that a given signer process knows its public key, such that we can verify signatures recovery bits. That is, since CloudKMS and other signing tools don't return a recovery bit, necessary for Ethereum, we test all 4 possible bits to make sure a signature recovers to the correct signer address, but we need to know what that address should be to accomplish this task.
Additionally, chain_id is used to return EIP-155 compliant signatures.
Handles signing a message.
Tracks the address for determining the recovery bit. We do not permit signatures until this address is known.
Tracks the address for determining the recovery bit. We do not permit signatures until this address is known.
Initializes a new Signet.Signer. We make sure to assign set_address
, but we
send a message to perform that action, largely so that other processes have
a chance to start before this does. This is important for Goth keys to access
Cloud KMS.
Signs a message using this signing key.
examples
Examples
iex> signer_proc = Signet.Test.Signer.start_signer()
iex> {:ok, sig} = Signet.Signer.sign("test", signer_proc)
iex> Signet.Recover.recover_eth("test", sig) |> Base.encode16()
"63CC7C25E0CDB121ABB0FE477A6B9901889F99A7"
Directly sign a message, not using a signer process.
This is mostly used internally, but can be used safely externally as well.
Starts a new Signet.Signer process.