Zero-Dependency Ed25519 Manifest Signing and Sparkle Cross-Verification for Local AI Runtimes

How Destiny verifies Ed25519 signatures over 'DESTINY-MODELS-V1.' + payload_b64u across 38 GGUF/ONNX weights in stdlib Python via OpenSSL SPKI DER -rawin, fails closed on single-bit tampering, and cross-verifies appcast.json against Sparkle appcast.xml and GitHub SHA256SUMS.txt.
Zero-Dependency Ed25519 Manifest Signing and Sparkle Cross-Verification for Local AI Runtimes

Zero-Dependency Ed25519 Manifest Signing and Sparkle Cross-Verification for Local AI Runtimes

Reporting signed: true by reading a JSON boolean provides zero cryptographic guarantee: an unverified MITM response or mutated payload field can set "signed": true while rewriting download URLs and SHA-256 digests.

In commit 44ecec5caa39d48c7aaa5f0fafa666643f0e2768 under github.com/karany97/destiny/tree/main/mcp, we upgraded Destiny’s zero-dependency MIT MCP server (io.github.karany97/destiny@2.0.0) so both model manifest enumeration (list_destiny_models) and release verification (verify_destiny_release) enforce real cryptographic checks and multi-source agreement using Python >=3.10 standard library only.


1. Canonical Domain-Separated Ed25519 Signing (DESTINY-MODELS-V1.)

The live catalog at models.nandai.org/v1/models-manifest.json ships a signed envelope containing:

  • schema: destiny-models-manifest-v1
  • kid: destiny-ota-ed25519-v1
  • public_key_b64: 7y6YzFY2ZxGdGx5secvm35hiuE9G7R6YTD0rbPcb8vA= (32-byte raw Ed25519 public key)
  • payload_b64u: URL-safe Base64 encoding of the canonical 38-entry manifest (177.9106 GB across GGUF/ONNX/image assets)
  • signature_b64u: 64-byte Ed25519 signature over the exact byte sequence "DESTINY-MODELS-V1." + payload_b64u

Signing the encoded payload_b64u string rather than re-serializing an in-memory dictionary avoids JSON whitespace or key-ordering ambiguity. Crucially, list_destiny_models also checks inline_manifest == decoded_manifest so altering the convenience manifest object while leaving payload_b64u and signature_b64u intact cannot slip unsigned URLs past verification.


2. Zero-Dependency OpenSSL SPKI DER -rawin Verification & Tamper Rejection

Because Python’s standard library does not include an Ed25519 primitive, wrapping the raw 32-byte Ed25519 public key into ASN.1 SubjectPublicKeyInfo DER requires only a fixed 12-byte OID prefix (id-Ed25519 1.3.101.112):

30 2a 30 05 06 03 2b 65 70 03 21 00 || <32-byte raw Ed25519 public key>

The verifier writes the 44-byte pub.der, 64-byte sig.bin, and "DESTINY-MODELS-V1." + payload_b64u message bytes into an ephemeral tempfile.TemporaryDirectory() and invokes:

openssl pkeyutl -verify -pubin -keyform DER -inkey pub.der -rawin -in msg.bin -sigfile sig.bin

Cross-platform behavior verified in mcp/test_mcp_stdio.py:

  • Linux & OpenSSL 3 hosts: Returns Signature Verified Successfully (ed25519_signature_verified: true, ed25519_verification_status: "verified").
  • macOS Darwin: System /usr/bin/openssl (LibreSSL 3.3.6) prints unknown option '-rawin', so the resolver checks Homebrew OpenSSL 3 (/opt/homebrew/opt/openssl@3/bin/openssl) automatically before falling back cleanly (ed25519_signature_verified: null, ed25519_verification_status: fallback_*) on minimal environments lacking -rawin.
  • Fail-Closed Single-Bit Tamper Rejection: Flipping any bit in signature_b64u or payload_b64u produces OpenSSL exit 1 (Signature Verification Failure), sets ed25519_signature_verified: false (verification_failed), and forces ok: false.

3. Multi-Source Release Cross-Verification (appcast.json + appcast.xml + SHA256SUMS.txt)

Instead of trusting a single release JSON endpoint, verify_destiny_release now cross-verifies four independent artifacts:

  1. nandai.org/appcast.json (schema: destiny-appcast-v1, kid: destiny-ota-ed25519-2026-v1, version: 2.0.0, build: 2000, size_bytes: 271345746)
  2. Sparkle XML dl.nandai.org/appcast.xml parsed with Python stdlib xml.etree.ElementTree, asserting sparkle:edSignature (64 decoded bytes), matching length="271345746", matching sparkle:sha256, and matching version/build (appcast_xml_verified: true)
  3. Release checksum manifest GitHub v2.0.0 SHA256SUMS.txt, matching Destiny-macOS-AppleSilicon.dmg and Destiny-2.0.0.dmg to 2da76c011c1bd511cc5547ff152b8b7382cf7793cc5d7e13078ba317abd54a3e (release_checksums_verified: true)
  4. HEAD probe confirming un-gated 271,345,746 bytes (pin_gate_active: false) plus local codesign --verify --deep --strict on macOS (TeamIdentifier=J5BH67967P, com.destiny.sovereign)

Full documentation, reproducible E2E stdio test suite, and security posture details are published at nandai.org/security/ and nandai.org/.well-known/mcp.json.


Write a comment