OkSky OSS · MIT
Open Federation Specification

OkSky Federation Protocol (oksky-fed-v1)

Interoperable domain-to-domain addressing, cryptographic server verification, blind E2EE device relay, and stateless push wake.

01 · Identity & Authority

Email-Style Addressing & Strict Domain Authority

Every OkSky user is addressed as localpart@domain (for example alice@yourdomain.com or bob@sky.host). Domains are normalized to lowercase ASCII before discovery or signature verification.

403 E_DOMAIN_AUTHORITY_MISMATCH

Strict Domain Authority is mandatory: a homeserver configured for example.com may only create and assert handles ending in @example.com. Any attempt to register or spoof a foreign domain (such as claiming @sky.host on a self-hosted node) fails closed with HTTP 403 E_DOMAIN_AUTHORITY_MISMATCH.

02 · Server Discovery

Dual Discovery: /.well-known/sky-server & DNS TXT

To reach a remote user at user@domain, the sending homeserver resolves domain endpoints and Ed25519 signing keys in two stages with SSRF protection (blocking private, loopback, and link-local IPs and non-HTTPS URLs by default) and TTL caching.

Primary: HTTPS GET https://<domain>/.well-known/sky-server
{
  "version": 1,
  "domain": "example.com",
  "endpoints": {
    "api": "https://example.com",
    "ws": "wss://example.com/ws/dm",
    "federation": "https://example.com/v1/federation",
    "relay": "wss://relay.example.com"
  },
  "signingKeys": [
    {
      "keyId": "ed25519-2026-01",
      "alg": "Ed25519",
      "publicKeyJwk": {
        "kty": "OKP",
        "crv": "Ed25519",
        "x": "<base64url-ed25519-public-key>"
      }
    }
  ],
  "capabilities": {
    "dm": true,
    "rooms": true,
    "directoryLookup": true
  }
}
Fallback: DNS TXT _sky.<domain>
_sky.example.com. 300 IN TXT "v=sky1; api=https://example.com; fed=https://example.com/v1/federation; kid=ed25519-2026-01; ed25519=<base64url-public-key>"
03 · Server-to-Server Signing

Ed25519 Canonical Signing (oksky-fed-v1)

Every cross-domain HTTP POST to /v1/federation/dm/deliver or /v1/federation/lookup must carry five headers signed by a key published in the origin domain discovery document.

HTTP Header Requirement
X-OkSky-Origin-Domain Lowercase origin domain matching the sender address domain.
X-OkSky-Key-Id Key identifier matching signingKeys[].keyId in origin discovery.
X-OkSky-Timestamp Unix epoch milliseconds; receivers enforce a +-300,000 ms clock window.
X-OkSky-Nonce Single-use random token; receivers reject replayed nonces within the window.
X-OkSky-Signature Base64url Ed25519 signature over the canonical payload string below.
Canonical Signing String & Federation Endpoints
canonical = "oksky-fed-v1|" + METHOD + "|" + pathname + "|" + originDomain
          + "|" + keyId + "|" + timestamp + "|" + nonce + "|" + sha256Hex(rawBody)

POST /v1/federation/dm/deliver
  { "senderAddress": "alice@example.com", "senderDisplayName": "Alice",
    "recipientAddress": "bob@sky.host", "clientMessageId": "uuid",
    "content": "hello", "createdAt": "2026-11-25T08:00:00.000Z" }

POST /v1/federation/lookup
  { "addresses": ["bob@sky.host"] }
04 · Device Transport

End-to-End Encrypted Blind Device Relay

When a mobile or desktop client connects to an instance behind NAT, traffic traverses a blind WebSocket relay with two nested layers of TLS.

  • Outer TLS terminates at the relay edge solely for socket routing by opaque instanceId.
  • Inner TLS 1.3 handshake runs end-to-end between the paired client and the instance, pinned directly to Ed25519 identity keys exchanged during pairing.
  • The relay cannot decrypt messages, tool outputs, memory, or credentials, and holds no user accounts.
05 · Stateless Push

Zero-Plaintext APNs Gateway (push.oksky.ai)

Push wake is decoupled from the device relay so self-hosted homeservers can wake iOS devices without keeping an active relay WebSocket open.

  • Instances POST signed oksky.push.v2 payloads directly to https://push.oksky.ai/v1/push carrying their Ed25519 publicKey.
  • The gateway verifies identityId("instance", publicKey) === instanceId, enforces <=30s freshness, deduplicates nonces, and applies per-instance rate limiting (60/min).
  • Payloads accept only fixed alert enums (new_message, proactive) and an opaque conversation UUID. The gateway never receives message text and persists zero device tokens.