# `OpenPayments.Types.GrantClient`
[🔗](https://github.com/interledger/open-payments-elixir/blob/v1.0.0/lib/open_payments/types/grant_client.ex#L1)

A grant request's client identity, preserving all three protocol forms.

`from_value/1` accepts a wallet-address string, a `walletAddress` object, or a
directed-identity `jwk` object. Object forms support optional typed `display`
information and forbid extra fields. Wallet and JWK identities are mutually
exclusive. The string form is deprecated by the pinned specification but remains
supported without silently converting it to an object.

Wallet values follow the schema's absolute-URI format without normalization or
payment-pointer resolution. Directed identity contains a public `Types.JWK`;
it does not import a private signing key. This type does not fetch wallet keys,
check that a JWK matches the signing key, or decide whether a grant is interactive.
Directed identity's non-interactive restriction belongs to grant-request validation.

Inspection omits JWK/display data. `to_value/1` and JSON encoding preserve wire
shape and public JWK metadata. Validate manually modified structs with `validate/1`;
encoding converts shape without validating it.

# `t`

```elixir
@type t() :: %OpenPayments.Types.GrantClient{
  display: OpenPayments.Types.ClientDisplay.t() | nil,
  jwk: OpenPayments.Types.JWK.t() | nil,
  kind: :wallet_string | :wallet_address | :directed_identity,
  wallet_address: String.t() | nil
}
```

# `from_value`

```elixir
@spec from_value(term()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}
```

Decodes a protocol client string or object into a validated identity.

# `to_value`

```elixir
@spec to_value(t()) :: String.t() | map()
```

Converts to the original protocol string/object shape without validating.

# `validate`

```elixir
@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}
```

Checks the identity form and typed nested fields without performing HTTP.

---

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