Verifying Messages
Automatic verification (Venmail)
Section titled “Automatic verification (Venmail)”Venmail automatically verifies VVS-1 headers on all incoming mail. The trust level is:
- Stored in the mail database
- Surfaced in the inbox UI as a trust badge
- Available via the mail API in the
vvs_trustfield
No code needed for Venmail users.
Manual verification
Section titled “Manual verification”If you’re building your own receiver, use the SDK:
import { vvs } from '@venmail/vsm';
const result = await vvs.verifyMessage( { 'X-Venmail-Signature': 'abc123...', 'X-Venmail-Algorithm': 'ed25519', 'X-Venmail-Timestamp': '1743339600', 'X-Venmail-Nonce': 'a1b2c3d4e5f6...', 'X-Venmail-Content-Hash': 'sha256=...', 'X-Venmail-Verify-Method': 'well-known,dns', }, emailBody, { timestampWindow: 3600 });
console.log(result.trustLevel); // 'VERIFIED' | 'PARTIAL' | 'FAILED' | 'UNKNOWN'use Venmail\VVS\Verifier;
$result = Verifier::verifyMessage( $vvsHeaders, $emailBody, ['from' => '...', 'to' => '...', 'subject' => '...', 'date' => '...']);
echo $result->trustLevel; // VERIFIED, PARTIAL, FAILED, or UNKNOWNecho $result->agentId;Verification algorithm
Section titled “Verification algorithm”-
Extract headers — If no
X-Venmail-*headers present, returnUNKNOWN -
Validate timestamp — Must be within the replay window (default: 3600 seconds)
-
Check nonce — If nonce store available, reject duplicates
-
Verify content hash — Recompute
sha256(canonicalized_body)and compare withX-Venmail-Content-Hash -
Resolve public key — Try each method in
X-Venmail-Verify-Methodorder:well-known: HTTPS GET to/.well-known/venmail-agent/{name}dns: TXT record on_venmail.{domain}embedded: UseX-Venmail-Public-Keyheader
-
Verify signature — Ed25519 verify against the canonical payload
-
Assign trust level:
- Key from well-known or DNS →
VERIFIED - Key from embedded header only →
PARTIAL - Any failure →
FAILED
- Key from well-known or DNS →
Verification endpoint (API)
Section titled “Verification endpoint (API)”Venmail also provides a verification API:
curl -X POST https://m.venmail.io/api/v1/verify \ -H "X-Server-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "raw_message": "<full RFC2822 message>", "agent_id": "[email protected]" }'Response:
{ "trust_level": "VERIFIED", "resolution_method": "well-known", "key_version": 1, "body_integrity": true, "timestamp_valid": true, "nonce_fresh": true, "agent_status": "active"}