CharterAgreementProtocol.CompactJws (Charter Agreement Protocol v0.1.0)

Copy Markdown View Source

CAP never authorizes.

Bounded parser and verifier for attached compact JWS envelopes.

The parser accepts only canonical protected-header and payload bytes. A key identifier remains an untrusted hint until an artifact verifier resolves it against its caller-supplied verification context.

Summary

Functions

Parse one canonical attached compact JWS under caller bounds.

Verify the envelope signature with one exact raw Ed25519 public key.

Types

t()

@type t() :: %CharterAgreementProtocol.CompactJws{
  kid: binary(),
  message: binary(),
  payload: CharterAgreementProtocol.Json.value(),
  payload_bytes: binary(),
  payload_segment: binary(),
  protected_segment: binary(),
  signature: <<_::512>>,
  typ: binary()
}

Functions

parse(compact, expected_typ, limits)

@spec parse(term(), binary(), CharterAgreementProtocol.Limits.t()) ::
  {:ok, t()} | {:error, CharterAgreementProtocol.Error.t()}

Parse one canonical attached compact JWS under caller bounds.

verify_signature(envelope, public_key)

@spec verify_signature(t(), term()) ::
  :ok | {:error, CharterAgreementProtocol.Error.t()}

Verify the envelope signature with one exact raw Ed25519 public key.