OpenPayments.Types.PINWorkingKey (open_payments_elixir v1.0.0)

Copy Markdown View Source

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.

Summary

Functions

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

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

Validates the typed fields without performing cryptographic operations.

Types

t()

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

Functions

from_map(data)

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

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

to_map(pwk)

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

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

validate(pwk)

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

Validates the typed fields without performing cryptographic operations.