View Source Signet.Signer.CloudKMS (Signet v1.0.0-beta7)

Signer to sign messages from a Google Cloud KMS key.

Summary

Functions

Get the Ethereum address associated with the given KMS key version.

Signs a message with the given KMS key version, after digesting the message with keccak.

Functions

Link to this function

get_address(cred, project, location, keychain, key, version)

View Source
@spec get_address(term(), String.t(), String.t(), String.t(), String.t(), String.t()) ::
  {:ok, binary()} | {:error, String.t()}

Get the Ethereum address associated with the given KMS key version.

Examples

iex> {:ok, address} = Signet.Signer.CloudKMS.get_address("token", "project", "location", "keychain", "key", "version")
iex> Base.encode16(address)
"DDA641B2A76A4A7C3617815BB13281DD207B74D5"
Link to this function

sign(message, cred, project, location, keychain, key, version)

View Source
@spec sign(
  String.t(),
  term(),
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  String.t()
) ::
  {:ok, Curvy.Signature.t()} | {:error, String.t()}

Signs a message with the given KMS key version, after digesting the message with keccak.

Examples

iex> {:ok, sig} = Signet.Signer.CloudKMS.sign("test", "token", "project", "location", "keychain", "key", "version")
iex> {:ok, recid} = Signet.Recover.find_recid("test", sig, Base.decode16!("DDA641B2A76A4A7C3617815BB13281DD207B74D5"))
iex> Signet.Recover.recover_eth("test", %{sig|recid: recid}) |> Base.encode16()
"DDA641B2A76A4A7C3617815BB13281DD207B74D5"