# `Cartouche.Signer.CloudKMS`
[🔗](https://github.com/zenhive/cartouche/blob/main/lib/cartouche/signer/cloud_kms.ex#L2)

Signer to sign messages from a Google Cloud KMS key.

# `get_address`

```elixir
@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} = Cartouche.Signer.CloudKMS.get_address("token", "project", "location", "keychain", "key", "version")
    iex> Cartouche.Hex.to_hex(address)
    "0xdda641b2a76a4a7c3617815bb13281dd207b74d5"

# `sign`

```elixir
@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> use Cartouche.Hex
    iex> {:ok, sig} = Cartouche.Signer.CloudKMS.sign("test", "token", "project", "location", "keychain", "key", "version")
    iex> {:ok, recid} = Cartouche.Recover.find_recid("test", sig, ~h[0xDDA641B2A76A4A7C3617815BB13281DD207B74D5])
    iex> Cartouche.Recover.recover_eth("test", %{sig|recid: recid}) |> Hex.to_address()
    "0xDDa641B2A76a4A7c3617815bb13281DD207b74d5"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
