Architecture#
Capability-First Model#
Epicrypt is organized by responsibility, not by backend engine.
Top-level capability domains:
CertificateTokenCryptoDataProtectionPasswordIntegrityGenerateSecurityExceptionInternal
Core Rule#
Top-level domain answers: what is this for?
Backend namespace answers: how is this implemented?
Example:
Certificateis the capability.Certificate\\OpenSSLandCertificate\\Sodiumare backend implementations.
Named Backend Selection#
When multiple backends satisfy the same responsibility, Epicrypt exposes named constructors:
use Infocyph\Epicrypt\Certificate\Enum\KeyExchangeBackend;
use Infocyph\Epicrypt\Certificate\KeyExchange;
$keyExchange = KeyExchange::forBackend(KeyExchangeBackend::SODIUM);
// or:
$keyExchange = KeyExchange::forBackend(KeyExchangeBackend::OPENSSL);
Contracts and Ownership#
Contracts live with the capability that owns the behavior.
Examples:
Crypto\\Contract\\*Token\\Contract\\*Certificate\\Contract\\*
Public vs Internal#
Capability entry/service classes are public API surface.
SupportandInternalclasses are implementation details unless explicitly documented as public.Internal\\SignedPayloadCodecis a shared internal primitive used across domains.
Security Design Principles#
Epicrypt follows:
safe defaults
explicit inputs and outputs
deterministic validation
fail-closed behavior
versioned payload framing for sensitive formats
constant-time comparison for security checks where applicable