# `Ethers.Authorization.Signed`
[🔗](https://github.com/ExWeb3/elixir_ethers/blob/v0.8.0/lib/ethers/authorization/signed.ex#L1)

A signed [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) authorization.

Wraps an `Ethers.Authorization` together with its secp256k1 signature. Signed
authorizations are what goes into the `authorization_list` of a type-4 transaction
(`Ethers.Transaction.Eip7702`) and serialize to the on-wire tuple
`[chain_id, address, nonce, y_parity, r, s]`.

Produce one with `Ethers.sign_authorization/2`. Use `recover_authority/1` to get the
address of the account that signed (the *authority* — the EOA whose code will be set).

# `t`

```elixir
@type t() :: %Ethers.Authorization.Signed{
  authorization: Ethers.Authorization.t(),
  signature_r: binary(),
  signature_s: binary(),
  signature_y_parity: 0 | 1
}
```

A signed EIP-7702 authorization incorporating the following fields:
- `authorization` - the signed `Ethers.Authorization` payload
- `signature_y_parity` - signature recovery bit (`0` or `1`)
- `signature_r` - signature `r` value (big-endian binary)
- `signature_s` - signature `s` value (big-endian binary)

# `recover_authority`

```elixir
@spec recover_authority(t()) :: {:ok, Ethers.Types.t_address()} | {:error, term()}
```

Recovers the authority (signer) address of a signed authorization.

Enforces the EIP-2 low-`s` rule that EIP-7702 mandates: a signature with
`s > secp256k1n / 2` returns `{:error, :invalid_signature_s}` because the chain would
silently skip such an authorization.

## Returns
- `{:ok, address}` with the checksummed authority address on success.
- `{:error, reason}` if the signature is malformed or recovery fails.

---

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