Skip to main content

Crate hyprstream_pay

Crate hyprstream_pay 

Source
Expand description

§hyprstream-pay — settlement/tariff RPC contract (MIT)

The protocol surface for the pay-wave: SettlementIssuer + TariffProvider traits, shared types, capability model, and a client stub.

This protocol crate is MIT-only; the Hyprstream application is AGPL-3.0-only. This crate contains ONLY the protocol definitions. The AGPL service implementation — which verifies PQ-hybrid attestations server-side, checks the restricted settlement store, and calls the ledger’s internal credit path — lives in hyprstream::services::pay.

§Why a separate MIT crate (#1399)?

cyberdione-product (and any other consumer) must link against the settlement/tariff contract without inheriting the AGPL. The protocol/stub crate is MIT; the service that actually moves money is AGPL. This is the standard protocol/impl split: the wire format is free; the implementation is copyleft.

§The two contracts

  • SettlementIssuer — verified settlement → deterministic credit issuance. Idempotent: same settlement id → same transfer id, same outcome, across retries and crashes. The only purchased-credit issuance surface.
  • TariffProvider — resource → priced quote with a finite server-imposed ceiling. The server owns the price, catalog, and maximum quantum; clients cannot set these.

§Security model

Peer auth is transport-level (TLS 1.3 on QUIC, UDS peer credentials on iroh). Then capability-gated at the RPC layer (#[authorize] on handlers). The attestation itself is PQ-hybrid-signed (EdDSA + ML-DSA-65 COSE composite) and re-verified server-side — never trusts a client assertion. This reuses the #1129 spend-authorization verification path.

Re-exports§

pub use attestation::SettlementAttestation;
pub use attestation::ATTESTATION_V1_TAG;
pub use capability::ALL_SCOPES;
pub use types::IssueRequest;
pub use types::IssueResponse;
pub use types::TariffQuote;
pub use types::TariffRequest;
pub use types::UnitRef;

Modules§

attestation
The settlement attestation: a canonical, self-contained, content-addressed record (PAY-ARCH-01 guard-rail).
capability
Capability model for the settlement/tariff protocol (#1399).
types
Shared types for the settlement/tariff protocol (#1399).

Enums§

PayError
Errors from the settlement/tariff protocol.

Traits§

SettlementIssuer
The settlement-issuer contract: only a verified, server-revalidated settlement can cause purchased-credit issuance.
TariffProvider
The tariff-provider contract: resource → priced quote.