Technical Details
- Key Size: 256 bits (32 bytes), generated locally using a cryptographically secure pseudorandom number generator (CSPRNG).
- IV Size: 96 bits (12 bytes), generated fresh for every encryption call.
- Tag Size: 128 bits (16 bytes), ensuring integrity checks are mathematically robust.
- Library Compatibility: Implemented using the standard Web Crypto API (
crypto.subtle.encrypt), ensuring compatibility across Node.js, Deno, Bun, Cloudflare Workers, and modern browsers.
Envelope Wire Format
The serialized snapshot payload consists of the ciphertext base64 string and associated verification hashes:- IV Prefix: First 12 bytes of the raw binary payload represent the initialization vector.
- Ciphertext Body: The middle bytes.
- AES-GCM Auth Tag: The final 16 bytes.
Verified Semantic Recall (VSR)
When an agent triggers a memory restore operation,sovseal executes Verified Semantic Recall (VSR):
- Downloads the ciphertext from the replication endpoint.
- Extracts the 12-byte IV prefix and the 16-byte auth tag.
- Decrypts the body using the locally held 256-bit key.
- Re-derives
sha256(canonicalize(decrypted_payload)). - Compares it against the server-returned
client_payload_hash. - If any verification step fails (tag mismatch or hash mismatch), the payload should be treated as tampered and never handed to the agent.