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

Encrypted PIN working-key data carried in card authorization payloads.

The pinned schema requires string fields `key`, `kvc` and `iv` and forbids
additional fields. This codec validates JSON shape without imposing hex/length
constraints, checking key values, decrypting material or encrypting a PIN block.

Inspection omits all fields. Explicit `to_map/1` and JSON encoding include the
sensitive protocol values. Errors identify fields without retaining values.
Validate manually constructed or modified structs with `validate/1`;
`to_map/1` converts shape without validating it.

# `t`

```elixir
@type t() :: %OpenPayments.Types.PINWorkingKey{
  iv: String.t(),
  key: String.t(),
  kvc: String.t()
}
```

# `from_map`

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

Decodes and validates the encrypted PIN working-key JSON object.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts to protocol fields, including encrypted key data, without validating.

# `validate`

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

Validates the typed fields without performing cryptographic operations.

---

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