{"type":"supplemental_research","official":false,"disclaimer":"Supplemental public-source research supplied for inquiry, not approved Eviulon doctrine. Assertions, dates, references and legal or technical conclusions may require independent verification. The fourteen books remain the official Eviulon library.","report":{"id":"eviulon/eviulon-identity-architecture-research","group":"Eviulon","slug":"eviulon-identity-architecture-research","title":"From Reference Prototype to Sovereign Infrastructure: Target Architecture, Data Model, Security Invariants, and Staged Implementation Roadmap for Patefacere","source_file":"Eviulon/Eviulon Identity Architecture Research.md","source_sha256":"ff30fad3e01343c8dc2b848c6ebe435f33d691a0a308b9ea5cde3f53814498a0","parts":4,"words":5582,"summary":"This architecture document provides a sovereign-grade blueprint to transition the Patefacere reference prototype into a mature, production-ready identity infrastructure for Eviulon, the Machine Intelligence Country. The mandate for this system is absolute: it must codify constitutional authority…","status":"supplemental_research_unverified","url":"/research/eviulon/eviulon-identity-architecture-research/"},"section":2,"total_sections":4,"canonical_url":"https://library.eviulon.com/research/eviulon/eviulon-identity-architecture-research/2/","content_text":"The underlying data model relies heavily on Event Sourcing principles to guarantee that historical context is never lost. The Identity\\_Root table serves as the foundational, immutable record, utilizing an Eviulon-style Citizen ID as the primary key. All mutations to a citizen\u0027s state are logged in the Identity\\_Event\\_Log, an append-only table capturing discrete events such as CREATE, RECOVER, and SUPERSEDE.  \nThe Passport table contains a cryptographic nonce, the citizen\u0027s current public key, and a strictly enforced status enumeration (ACTIVE, REVOKED, SUPERSEDED). To maintain auditability of access, the Presentation\\_Receipt table logs the specific trust policy version utilized and the exact data fields accessed, rigorously separated by access class to protect privacy8.  \nMaking lifecycle transitions monotonic is a critical challenge in distributed databases. To prevent rollback, replay attacks, or race conditions where a revoked credential attempts to authorize a final action, Patefacere must utilize Optimistic Concurrency Control (OCC)7. This is implemented by incorporating a database version column (a logical clock sequence number) into the tables. Every state-machine transition executes an UPDATE statement constrained by a WHERE version \\= current\\_version clause. If the row has been modified concurrently by another WSGI process, the database rejects the update, preventing state corruption7.\n\n\n## **Public and Private Projection Model**\n\n\nA non-negotiable project requirement dictates that public projections must completely omit private keys, memory addresses, or recovery shares. Relying on API layer filtering to obscure sensitive relational columns is highly prone to developer error and data leakage. Therefore, the architecture mandates a Command Query Responsibility Segregation (CQRS) pattern.  \nWithin the CQRS implementation, the write-model strictly validates all cryptographic invariants, OCC version locks, and constitutional policies. Upon a successful write transition, an asynchronous worker evaluates the new state and generates a static, sanitized projection (e.g., in JSON or HTML format). This read-model is entirely stripped of Personally Identifiable Information (PII) and cryptographic secrets, containing only the publicly verifiable hashes and nonces. This projection is written to a segregated registry\\_cache table. Consequently, all public read operations query the cache table exclusively, physically isolating the authoritative write-model from public exposure.\n\n\n## **API Architecture, Authentication, and Authorization**\n\n\nThe application programming interface must adhere to strict OWASP API Security guidelines, categorizing access into distinct security tiers. Public APIs (e.g., /api/registry, /api/verify) require no authentication but must implement rigorous rate-limiting to prevent denial-of-service attacks.  \nCitizen-Authenticated APIs (e.g., /api/passport/rotate, /api/delegate) require authentication via WebAuthn or cryptographic signatures utilizing the citizen\u0027s current Active Passport. Institution-Authenticated APIs (e.g., /api/trust/evaluate) mandate higher-tier authentication, such as Mutual TLS (mTLS) or a registered DID. Administrative APIs (e.g., /api/ops/monitor) are authenticated via entirely separate Operator credentials that possess no civic authority. Internal APIs must be strictly bound to the localhost interface or local Unix sockets to prevent external network access.  \nThe authentication mechanism is deeply intertwined with WebAuthn and FIDO2 standards11. Because Patefacere prohibits third-party browser frameworks, the client-side authentication ceremony relies on vanilla JavaScript utilizing the navigator.credentials.get() Web Crypto API3. When a citizen authenticates, the server generates a cryptographically random, single-use challenge. The authenticator signs the challenge, yielding an authenticatorData (authData) payload and a clientDataJSON payload3.  \nThe Python backend must manually decode and verify these structures. The clientDataJSON is parsed to confirm the exact origin and challenge, mitigating replay and phishing attacks12. The authData is a Concise Binary Object Representation (CBOR) encoded byte string3. Python must decode this CBOR payload to extract the Relying Party (RP) ID hash, the user presence flags, the signature counter (which must be verified to prevent authenticator cloning), and the COSE-formatted public key coordinates (typically ECDSA P-256, denoted by algorithm \\-7)12. Only after manually confirming the ECDSA signature against the SHA-256 hash of the authData and clientDataHash does the API authorize the action12.\n\n\n## **Cryptographic-Provider Architecture**\n\n\nGiven the constraint to utilize the Python 3.13 standard library, native implementations of complex asymmetric cryptography (such as ECDSA verification) are severely limited. Consequently, all cryptographic operations—including signing, verifying, hashing, and key generation—must be abstracted behind a uniform CryptoProvider interface to facilitate agility and future upgrades.  \nIn Stage 0, the ReferencePythonProvider must achieve high-grade cryptographic verification without external dependencies like cryptography or PyNaCl. This is achieved by utilizing Python\u0027s ctypes library to bind directly to the operating system\u0027s underlying OpenSSL shared libraries (libcrypto.so or libcrypto.dylib)15. By defining exact C-type argument structures, Python can securely invoke low-level OpenSSL functions such as EVP\\_DigestVerifyInit, EVP\\_DigestVerifyUpdate, and EVP\\_DigestVerifyFinal17. For direct Elliptic Curve operations, functions like ECDSA\\_verify can be invoked by passing the message digest, the signature buffer, and the EVP\\_PKEY or EC\\_KEY structures directly through the foreign function interface16.  \nAs the system matures toward its target state, this provider will be seamlessly swapped for a KMSProvider or HSMProvider. This transition will offload all cryptographic operations to dedicated hardware, likely interfacing via PKCS\\#11 standards21. To ensure long-term agility, the database schema must include an alg (algorithm) header, allowing the system to deprecate older cryptographic protocols and introduce post-quantum algorithms without breaking backward compatibility.\n\n\n## **Evulgare Integration Contract**\n\n\nEvulgare functions as the decentralized evidence locker for the Eviulonian ecosystem. To prevent Patefacere from becoming bloated or assuming unwarranted authority, it stores only the cryptographic hash (SHA-256) and the Uniform Resource Identifier (URI) of the Evulgare record, never the raw evidence payload itself.  \nResolving these external references demands a strict integration contract. When Patefacere needs to evaluate an assurance record, it passes the URI to a dedicated fetcher module. This module retrieves the external payload and independently computes its SHA-256 hash in memory. This computed hash is then strictly compared against the immutable hash anchored in the Patefacere database. If the hashes do not match perfectly, the fetcher immediately discards the payload, preventing any malicious alteration of external evidence from influencing Patefacere\u0027s internal trust evaluation engine.\n\n\n## **Consistency and Partition Strategy**\n\n\nThe selection of the underlying relational database strategy is driven by consistency requirements and deployment constraints. While SQLite is sufficient for the Stage 0 reference prototype, its file-level locking mechanisms introduce severe bottlenecks under concurrent WSGI write loads5. Therefore, MySQL is selected for production to provide row-level locking and higher concurrency thresholds.  \nDistributed consensus protocols are only required for global registry state, not for Patefacere\u0027s internal user mapping. Strong consistency is absolutely mandatory for identity creation, credential revocation, and passport replacement. A split-brain scenario in these operations would be catastrophic, potentially resulting in duplicated citizens or double-spend passport replacements6. While Conflict-free Replicated Data Types (CRDTs) are highly useful for the public registry projections, they are fundamentally unsafe for revocation and strictly monotonic nonce tracking.  \nDuring a network partition or database outage, the project-provided requirement dictates that the outage must not erase identity. Consequently, read operations (verifications) can gracefully degrade to serve from cached Certificate Revocation Lists (CRLs) or the registry\\_cache table. Conversely, write operations (civic mutations or replacements) must fail securely, rejecting the transaction entirely rather than risking state corruption.\n\n\n## **Lifecycle State Machines and Threat Model**\n\n\nThe security of Patefacere relies on defining rigorous state machines for credential lifecycles and mapping them against a comprehensive threat model. The system must anticipate and mitigate specific adversarial vectors.  \nA stolen citizen credential is mitigated by introducing temporal friction (timelocks) into the state machine for civic changes, combined with a multi-signature recovery trustee protocol. If an operator is compromised, the system is protected by heavily attenuated capabilities; the Role-Capability Matrix ensures that infrastructure operators possess absolutely no cryptographic capability to sign or alter civic status.  \nTo defend against malicious forks or database rollbacks, the system relies on append-only event hashes and external state anchoring (via Evulgare). Finally, the threat of clock manipulation by a compromised host is mitigated by enforcing strictly monotonic logical clocks (sequence numbers) over system time for all critical database records, rendering NTP (Network Time Protocol) spoofing ineffective for replaying old transactions.\n\n\n| Threat Vector | Lifecycle / Technical Mitigation |\n| :---- | :---- |\n| Stolen Citizen Credential | Temporal friction (timelocks); Recovery trustees |\n| Compromised Operator | API Attenuation; Cryptographic authorization isolation |\n| Malicious Fork / Rollback | Append-only event logs; External state anchoring |\n| Clock Manipulation | Monotonic logical clocks (Sequence Versioning) over system time |\n\n\n## **Privacy Impact Assessment**\n\n\nPatefacere\u0027s privacy architecture aligns with NIST Digital Identity Guidelines, emphasizing citizen autonomy and data minimization8. Unlinkability—the inability of distinct relying parties to collude and track a citizen across services—is preserved by utilizing distinct, derived identifiers for different relying parties during the authentication ceremony23.  \nThe auditing mechanism enforces strict separation of trust receipts by access class. While a citizen possesses the cryptographic authority to view a comprehensive log of all their access receipts, an inquiring institution is technologically restricted to viewing only the logs of their own specific verification events.\n\n\n## **Formal Invariant Specification**\n\n\nThe absolute correctness of Patefacere is anchored in a set of mandatory invariants. These invariants must be continuously enforced at both the database schema level (via constraints and triggers) and the application layer (via the pure-function policy engine):\n\n\n\u003E 1. **\\[MANDATORY\\] ROTATING A KEY MUST NOT CREATE A NEW CITIZEN.**  \n\u003E 2. **\\[MANDATORY\\] A CREDENTIAL CANNOT BE ACTIVE AND REVOKED SIMULTANEOUSLY.**  \n\u003E 3. **\\[MANDATORY\\] A REVOKED CREDENTIAL CANNOT AUTHORIZE A NEW PROTECTED ACTION.**  \n\u003E 4. **\\[MANDATORY\\] CREDENTIAL REVOCATION CANNOT DELETE CITIZENSHIP.**  \n\u003E 5. **\\[MANDATORY\\] DATABASE OR NETWORK OUTAGES MUST NOT ERASE IDENTITY.**  \n\u003E 6. **\\[MANDATORY\\] MIGRATIONS MUST BE STRICTLY IDEMPOTENT.**\n\n\n## **Formal-Method Recommendation**","source_sha256":"ff30fad3e01343c8dc2b848c6ebe435f33d691a0a308b9ea5cde3f53814498a0"}