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).
145 lines
5 KiB
Rust
145 lines
5 KiB
Rust
//! Sanctions list domain model.
|
|
//!
|
|
//! Each authority publishes a slightly different schema, but they all
|
|
//! agree on the same skeleton: an entity (person, organisation, vessel,
|
|
//! or aircraft) carries a primary name, aliases, identifying numbers,
|
|
//! addresses, and one-or-more sanctions programs it is named under.
|
|
//! [`SanctionedEntity`] is the union we ingest into.
|
|
|
|
use chrono::{DateTime, NaiveDate, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Which authority published the entry.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
pub enum SanctionsList {
|
|
/// US Treasury — Specially Designated Nationals (SDN).
|
|
OfacSdn,
|
|
/// US Treasury — Non-SDN Consolidated Sanctions list.
|
|
OfacConsolidated,
|
|
/// EU Council — consolidated financial sanctions list.
|
|
EuConsolidated,
|
|
/// UN Security Council — consolidated list.
|
|
UnConsolidated,
|
|
/// HM Treasury (UK) — consolidated list of financial sanctions targets.
|
|
HmtUk,
|
|
/// Australia DFAT — consolidated list.
|
|
AustraliaDfat,
|
|
/// Canada SEMA — Special Economic Measures Act regulations.
|
|
CanadaSema,
|
|
/// Japan Ministry of Finance.
|
|
JapanMof,
|
|
}
|
|
|
|
impl SanctionsList {
|
|
/// Human-readable short name.
|
|
#[must_use]
|
|
pub const fn label(self) -> &'static str {
|
|
match self {
|
|
Self::OfacSdn => "OFAC SDN",
|
|
Self::OfacConsolidated => "OFAC Consolidated",
|
|
Self::EuConsolidated => "EU Consolidated",
|
|
Self::UnConsolidated => "UN Consolidated",
|
|
Self::HmtUk => "HMT UK",
|
|
Self::AustraliaDfat => "Australia DFAT",
|
|
Self::CanadaSema => "Canada SEMA",
|
|
Self::JapanMof => "Japan MOF",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// What kind of thing the entry names.
|
|
///
|
|
/// Sanctions programs apply to natural persons, legal entities, and to
|
|
/// specific transportation assets (vessel IMO numbers, aircraft tail
|
|
/// numbers) that have themselves been designated.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum EntityType {
|
|
/// A natural person.
|
|
Individual,
|
|
/// A company, organisation, or other legal entity.
|
|
Entity,
|
|
/// A maritime vessel (named by IMO number and ship name).
|
|
Vessel,
|
|
/// An aircraft (named by registration / tail number).
|
|
Aircraft,
|
|
}
|
|
|
|
/// ISO 3166-1 alpha-2 country code.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
pub struct CountryCode(pub String);
|
|
|
|
/// Postal / business address attached to an entry.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct Address {
|
|
/// Street address line(s), joined with newlines.
|
|
pub street: Option<String>,
|
|
/// City or locality.
|
|
pub city: Option<String>,
|
|
/// State, province, or region.
|
|
pub region: Option<String>,
|
|
/// Postal code.
|
|
pub postal_code: Option<String>,
|
|
/// ISO 3166-1 alpha-2 country, if known.
|
|
pub country: Option<CountryCode>,
|
|
}
|
|
|
|
/// The kind of identifying document or number attached to an entry.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum IdentificationKind {
|
|
/// National identity card.
|
|
NationalId,
|
|
/// Passport.
|
|
Passport,
|
|
/// Driver's licence.
|
|
DriversLicence,
|
|
/// Tax identification number.
|
|
TaxId,
|
|
/// Maritime IMO number (vessels).
|
|
Imo,
|
|
/// Aircraft registration / tail number.
|
|
AircraftTail,
|
|
/// Anything not in the enum above; carry the raw label.
|
|
Other,
|
|
}
|
|
|
|
/// A piece of identifying information published with an entry.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct Identification {
|
|
/// What sort of identifier this is.
|
|
pub kind: IdentificationKind,
|
|
/// Free-text label as published (e.g. `"Cedula No."`, `"DNI"`).
|
|
pub label: Option<String>,
|
|
/// The identifier value itself.
|
|
pub value: String,
|
|
/// Issuing country, if known.
|
|
pub country: Option<CountryCode>,
|
|
}
|
|
|
|
/// A single sanctioned entity, normalised across all upstream list formats.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct SanctionedEntity {
|
|
/// Stable per-list identifier (e.g. OFAC's `uid`, EU `logicalId`).
|
|
pub id: String,
|
|
/// Canonical primary name as published.
|
|
pub name: String,
|
|
/// AKAs, FKAs, and other published aliases.
|
|
pub name_aliases: Vec<String>,
|
|
/// Individual / Entity / Vessel / Aircraft.
|
|
pub entity_type: EntityType,
|
|
/// Date of birth (individuals only).
|
|
pub dob: Option<NaiveDate>,
|
|
/// Place of birth, free-text (individuals only).
|
|
pub place_of_birth: Option<String>,
|
|
/// Known addresses.
|
|
pub addresses: Vec<Address>,
|
|
/// Nationalities / citizenships.
|
|
pub nationalities: Vec<CountryCode>,
|
|
/// Published identifications.
|
|
pub identifications: Vec<Identification>,
|
|
/// Sanctions programmes the entry sits under (e.g. `"SDGT"`, `"UKRAINE-EO13662"`).
|
|
pub programs: Vec<String>,
|
|
/// When the upstream list last updated this entry.
|
|
pub last_updated: DateTime<Utc>,
|
|
/// Which source list this entry came from.
|
|
pub source_list: SanctionsList,
|
|
}
|