openpay/ (+3 crates)
op-bnpl/ Affirm + Klarna + Afterpay/Clearpay rails. Full lifecycle
typestate (Initiated→Approved→Captured→Settled→Refunded).
Per-provider sandbox+production base URLs, regions (NA/EU/OC
for Klarna; US/AuNz/Gb/Ca/Eu for Afterpay). HMAC-SHA256
webhook verification with constant-time compare. 61 tests.
op-batch/ NACHA ACH (94-char records, PPD/CCD/WEB/TEL/CTX, R01-R99
return codes, Same-Day ACH cutoffs); SEPA pain.001.001.09
(CT) + pain.008.001.08 (DD) with SCT-Inst flagging; Fedwire
MT103/MT202/CHIPS + pacs.008.001.12 / pacs.009.001.10 +
UETR; Bacs Standard 18. Per-rail cutoff scheduler. Exception
taxonomy unified across rails. 51 tests.
op-screening/ OFAC SDN + EU consolidated + UN consolidated + HMT UK
consolidated + Australia DFAT + Canada SEMA + Japan MOF.
Levenshtein + Jaro-Winkler + Soundex + Metaphone + token
Jaccard scoring. Unicode NFKD normalisation + Cyrillic /
Arabic transliteration. Ed25519-signed BLAKE3-chained
audit log. BSA helpers: CTR + SAR pattern detection
(structuring, round-dollar, rapid-in-out). 43 tests.
smart-byte/smart-byte-rs/ (+3 crates)
smart-byte-bbs/ BBS+ signatures (IETF draft-irtf-cfrg-bbs-signatures-08).
BLS12-381 keys, signatures, disclosure proofs with
cryptographic unlinkability. bbs-2023 Data Integrity
cryptosuite. AnonCreds-shaped link secrets +
predicate proofs. SecretKey zeroize-on-drop. 49 tests.
smart-byte-didcomm/ DIDComm v2 messaging per DIF spec. Pack-encrypted
(ECDH-1PU + ECDH-ES via X25519), pack-signed (JWS),
pack-plaintext. Aries protocols: issue-credential v3,
present-proof v3, basic-message, trust-ping, discover-
features, out-of-band, coordinate-mediation, message-
pickup. Mediator role with pluggable storage. 23 tests.
smart-byte-mdl/ ISO/IEC 18013-5 mobile driver's licence + 18013-7
online presentment. mDoc + MSO with salted-hash
selective disclosure (per item; SHA-256 digest tree).
org.iso.18013.5.1 namespace + AAMVA add-on. ES256
device-auth + issuer-auth. QR-code device-engagement
scaffolding. 28 tests.
eoc/eoc-rs/ (+3 crates)
eoc-local/ Local-inference backends behind one NeuralBackend:
llama.cpp (GGUF, Q4/Q5/Q6/Q8/F16/F32 quantisation),
MLX (Apple Silicon, feature-gated), MLC-LLM (TVM, feature-
gated marker), ONNX Runtime. GGUF file-format reader.
HuggingFace tokenizers. Greedy / top-k / top-p / temperature /
Mirostat samplers. Model registry scanning ~/.eoc/models/.
Joule attribution via eoc-meter. 39 tests.
eoc-rerank/ BM25 sparse + HNSW dense + RRF + min-max hybrid fusion.
Cohere v3.5 + Voyage v2 + bge-reranker v2-m3 + ms-marco
MiniLM + ColBERT v2 rerankers. Two-stage pipeline:
retrieve top-K hybrid → cross-encoder rerank → top-N.
KV-stage recovery shim into the cascade. 31 tests.
eoc-eval/ 15 canonical eval harnesses: MMLU, MMLU-Pro, GPQA,
HumanEval (pass@1 with python3 sandbox), BBH, IFEval (25
verifiable constraints), AlpacaEval, AGIEval, HellaSwag,
ARC (Easy + Challenge), TruthfulQA (MC1+MC2), BoolQ,
GSM8K, MATH (boxed-answer equivalence), Winogrande. Real
questions in BuiltinSamples. EvalRunner emits joules-per-
correct alongside accuracy. 49 tests.
Quality:
- cargo check across all three workspaces: clean
- cargo clippy --all-targets -- -D warnings on every new crate: clean
- 374 new tests, all passing
- #![forbid(unsafe_code)] across every new crate
- No unwrap/expect outside #[cfg(test)]
Rust 1.95.0 edition 2024 (inherited via root rust-toolchain.toml).
134 lines
4.6 KiB
Rust
134 lines
4.6 KiB
Rust
//! Aries RFC 0685: Message-Pickup Protocol v3 (DIDComm v2).
|
|
//!
|
|
//! Protocol URI: `https://didcomm.org/messagepickup/3.0`.
|
|
//! Messages: `status-request`, `status`, `delivery-request`, `delivery`,
|
|
//! `messages-received`, `live-delivery-change`.
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::message::DidcommMessage;
|
|
use crate::protocol::{Protocol, ProtocolMessage};
|
|
|
|
/// Base URI for this protocol.
|
|
pub const PROTOCOL_URI: &str = "https://didcomm.org/messagepickup";
|
|
/// Protocol version.
|
|
pub const VERSION: &str = "3.0";
|
|
|
|
/// Singleton handle.
|
|
pub struct MessagePickup;
|
|
impl Protocol for MessagePickup {
|
|
fn protocol_uri(&self) -> &str {
|
|
PROTOCOL_URI
|
|
}
|
|
fn version(&self) -> &str {
|
|
VERSION
|
|
}
|
|
}
|
|
|
|
/// Body of `status-request`.
|
|
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
|
|
pub struct StatusRequestBody {
|
|
/// Optional recipient_did filter.
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub recipient_did: Option<String>,
|
|
}
|
|
|
|
/// Body of `status`.
|
|
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
|
|
pub struct StatusBody {
|
|
/// Recipient did this status pertains to.
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub recipient_did: Option<String>,
|
|
/// Number of messages queued.
|
|
pub message_count: u64,
|
|
/// Longest delay in seconds among queued messages.
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub longest_waited_seconds: Option<u64>,
|
|
/// Newest received time (ISO-8601).
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub newest_received_time: Option<String>,
|
|
/// Oldest received time (ISO-8601).
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub oldest_received_time: Option<String>,
|
|
/// Aggregate bytes queued.
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub total_bytes: Option<u64>,
|
|
/// Whether live delivery is enabled.
|
|
#[serde(default)]
|
|
pub live_delivery: bool,
|
|
}
|
|
|
|
/// Body of `delivery-request`.
|
|
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
|
|
pub struct DeliveryRequestBody {
|
|
/// Maximum number of messages to deliver.
|
|
pub limit: u64,
|
|
/// Optional recipient filter.
|
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
|
pub recipient_did: Option<String>,
|
|
}
|
|
|
|
/// Body of `messages-received`.
|
|
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
|
|
pub struct MessagesReceivedBody {
|
|
/// Message ids that have been received and can be deleted.
|
|
pub message_id_list: Vec<String>,
|
|
}
|
|
|
|
/// Typed enum of message-pickup v3 message types.
|
|
#[derive(Debug, Clone)]
|
|
pub enum MessagePickupKind {
|
|
/// `status-request`.
|
|
StatusRequest(StatusRequestBody),
|
|
/// `status`.
|
|
Status(StatusBody),
|
|
/// `delivery-request`.
|
|
DeliveryRequest(DeliveryRequestBody),
|
|
/// `messages-received`.
|
|
MessagesReceived(MessagesReceivedBody),
|
|
}
|
|
|
|
impl ProtocolMessage for MessagePickupKind {
|
|
fn from_message(msg: &DidcommMessage) -> Option<Self> {
|
|
let base = format!("{PROTOCOL_URI}/{VERSION}");
|
|
let suffix = msg.type_.strip_prefix(&format!("{base}/"))?;
|
|
match suffix {
|
|
"status-request" => Some(Self::StatusRequest(
|
|
serde_json::from_value(msg.body.clone()).unwrap_or_default(),
|
|
)),
|
|
"status" => Some(Self::Status(
|
|
serde_json::from_value(msg.body.clone()).unwrap_or_default(),
|
|
)),
|
|
"delivery-request" => Some(Self::DeliveryRequest(
|
|
serde_json::from_value(msg.body.clone()).unwrap_or_default(),
|
|
)),
|
|
"messages-received" => Some(Self::MessagesReceived(
|
|
serde_json::from_value(msg.body.clone()).unwrap_or_default(),
|
|
)),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
fn to_message(&self) -> DidcommMessage {
|
|
let (suffix, body) = match self {
|
|
Self::StatusRequest(b) => (
|
|
"status-request",
|
|
serde_json::to_value(b).expect("body serialisable"),
|
|
),
|
|
Self::Status(b) => (
|
|
"status",
|
|
serde_json::to_value(b).expect("body serialisable"),
|
|
),
|
|
Self::DeliveryRequest(b) => (
|
|
"delivery-request",
|
|
serde_json::to_value(b).expect("body serialisable"),
|
|
),
|
|
Self::MessagesReceived(b) => (
|
|
"messages-received",
|
|
serde_json::to_value(b).expect("body serialisable"),
|
|
),
|
|
};
|
|
DidcommMessage::new(format!("{PROTOCOL_URI}/{VERSION}/{suffix}"))
|
|
.body(body)
|
|
}
|
|
}
|