# Loxation MLS over Nostr — Secure, Modern Messaging Infrastructure

Loxation delivers an enterprise-grade, end-to-end encrypted messaging stack by combining Message Layer Security (MLS, RFC 9420) with the open Nostr transport. The result is a scalable, interoperable, and policy-aware communication substrate that works across commodity relays and our optimized gateway.

## Executive Summary

- End-to-end encryption, forward secrecy, and post-compromise security for groups (MLS) and direct messages (Noise).
- Standards-aligned transport over Nostr with selective delivery, robust routing, and cross-relay interoperability.
- Enterprise controls including admin-signed roster/policy events and system-driven key provisioning requests.
- Cloud-native gateway deployment with observability, rate-limiting, and secure defaults.
- Developer-friendly SDKs for iOS (SwiftMLS) and React Native, with simple APIs and deterministic event signing.

Primary gateway: wss://messaging.loxtion.com

## Why It Matters

Teams today need secure, frictionless communication that:
- Scales from small teams to large organizations.
- Preserves privacy across mobile and edge environments.
- Offers flexible deployment (public relays, private clusters, or managed gateway).
- Provides deterministic, auditable membership control.

Loxation’s MLS over Nostr meets these needs with a modern cryptographic core (MLS) and an open, resilient transport (Nostr).

## What Is MLS over Nostr?

- MLS (RFC 9420) provides state-of-the-art cryptography for group messaging: E2E, forward secrecy, and efficient group operations.
- Nostr provides an open protocol for event distribution with a global ecosystem of relays and clients.
- Loxation binds MLS messages to Nostr events, enabling secure messaging that travels wherever your users are—over commodity relays or via our optimized gateway.

## Key Capabilities

- Group Messaging (MLS) via Nostr Kind 445
  - E2E group messages with MLS core, published as Nostr events.
  - Deterministic signing (NIP-01) for reliable IDs and verifiability.
- Onboarding & Welcomes via Giftwrap (Kind 1059 carrying sealed 13 with inner 444)
  - Private delivery of MLS Welcome messages for seamless group joins.
- Direct Messages (Noise) via Kind 446
  - High-security 1:1 communication alongside MLS groups.
- Admin Controls
  - Kind 447 KeyPackage Request: system/admin-triggered provisioning prompts for secure, automated KeyPackage replenishment.
  - Kind 450 Roster/Policy: admin-signed, strictly ordered membership changes (add/remove/promote/demote/bootstrap/replace).
- Selective Delivery
  - By group (“h” tag), by recipient (“p” tag), or by policy—with rate limiting and allowlists as needed.

## How It Works (High-Level)

1) Publish KeyPackages (Kind 443)
- Clients publish KeyPackages (base64) with tags like ["mls_ver","1"], ["single_use","1"] for secure discovery and onboarding.

2) Onboard Members (444 → 13 → 1059)
- A Welcome is crafted inside an unsigned 444, sealed as kind 13, then wrapped as kind 1059 for private delivery to the recipient.

3) Group Messaging (Kind 445)
- MLS ciphertext is published inside kind 445 events with tags:
  - ["h", groupId], ["k", epoch], ["mls_ver","1"]
- Our gateway optimizes routing to group members; relays can fan out by group.

4) Direct Messages (Kind 446)
- Noise-based 1:1 messages are routed to specific recipients via ["p", recipient].

5) Admin & Operations (447/450)
- Kind 447: Allow relays/systems to request fresh KeyPackages from users or group-scoped replenishment.
- Kind 450: Deterministic, admin-signed membership control with strictly monotonic sequence numbers.

## Architecture Highlights

- Transport Flexibility
  - Commodity Mode: Works with standard relays you already use.
  - Gateway Mode: Optimized fanout, indexing, and acknowledgements via our managed gateway.
- Cloud-Native
  - Deployed on Google Cloud Run (or your own infra), with stateless autoscaling and Firestore/Cloud SQL storage options.
- Observability & Reliability
  - Prometheus-style metrics, structured logging, rate limiting, and health/readiness endpoints.
- Authentication & Access Control
  - NIP-42 auth, pubkey allowlisting, admin/system keys for privileged operations.

## Security Model

- End-to-End Encryption
  - MLS for groups, Noise for DMs; robust forward secrecy and post-compromise security.
- Selective Delivery
  - Group-wise and recipient-wise delivery via Nostr tags; zero server-side decryption.
- Policy Enforcement
  - Admin-signed roster control (Kind 450) ensures deterministic membership with auditability.
- Key Hygiene
  - Single-use KeyPackages, TTLs, and automated replenishment (Kind 447) reduce exposure windows.

## Standards Alignment

- MLS (RFC 9420)
- Nostr (NIP-01 canonical events, NIP-17 sealed messages, NIP-59 giftwrap, NIP-42 auth)
- Tag Conventions
  - 445 epoch tag is “k” (not “e”), aligning our builders and relay indexing.

## Interoperability & Extensibility

- Cross-Relay Operation
  - Commodity relays: subscribe to 445/446/1059 as needed; our SDKs provide helpers.
  - Gateway provides a high-performance path and future discovery endpoint for 443.
- Client SDKs
  - iOS (SwiftMLS): high-level APIs for group messaging, onboarding, DMs, and admin callbacks (e.g., didReceiveKeyPackageRequest).
  - React Native (TypeScript): builders and helpers for discovery and onboarding flows.
- Admin & Compliance
  - Roster changes are durable, auditable, and strictly ordered; key provisioning requests have TTLs and rate limits.

## Performance & Scale

- Autoscaling gateway to meet bursty workloads.
- Efficient MLS group operations for large teams.
- Optimized indexes for group fanout, with deduplication and ordering guarantees.

## Deployment Options

- Managed Gateway
  - Use wss://messaging.loxtion.com for production-grade performance and reliability.
- Self-Hosted
  - Deploy the gateway on your own Cloud Run or container platform; connect it to your relays and storage of choice.
- Hybrid
  - Combine commodity relays with gateway routing for the best of both worlds.

## Developer Experience

- Deterministic signing helpers ensure stable event IDs.
- Simple subscription APIs for group, DM, and giftwrap feeds.
- Optional auto-respond to 447:
  - Configure a KeyPackage provider and publisher SK; the SDK mints/publishes 443s automatically while surfacing the request to your app.

## Use Cases

- Secure Team Messaging
  - Persistent groups, admin-managed rosters, scalable fanout.
- Field Ops & Edge Environments
  - Operate with intermittent connectivity using commodity relays; switch to gateway when needed.
- Regulated Industries
  - Deterministic, admin-signed membership changes and durable audit history.
- Consumer Apps
  - Low-friction onboarding and discovery with best-in-class encryption.

## Why Loxation

- Security-first: MLS and Noise, end-to-end, with enterprise-grade controls.
- Open ecosystems: Tap into the Nostr relay network instead of a closed silo.
- Operational excellence: Cloud-native gateway, observability, and rate-limits built in.
- Developer velocity: High-level SDKs and examples that let teams ship fast.

## Get Started

- Try the gateway: wss://messaging.loxtion.com
- Explore the SDKs and examples in our repository
- Contact us to discuss enterprise rollout, migration, or compliance needs

Loxation makes secure, standards-driven messaging practical at scale—without locking you in.
