Skip to content

Latest commit

 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ Aegis — Licensing, Entitlement & Authentication Platform

A production-ready Licensing, Entitlement & Authentication Platform — passkey-first auth, signed offline license certificates (Ed25519), Stripe + crypto wallet billing, a tightly-scoped audit-logged remote Lock/Wipe kill switch, and full i18n (en · fr · ar RTL · ru · zh-Hans).

This repository ships with:

  • src/ — a polished, runnable Next.js 16 admin dashboard (App Router, RSC, Tailwind v4, shadcn/ui, Framer Motion) that demonstrates the entire Aegis platform against a comprehensive mock data layer.
  • packages/license-sdk/ — the embeddable @aegis/license-sdk package (Ed25519 certificate verification, OAuth 2.0 Device Authorization Grant, heartbeat scheduler, remote command handler).
  • docs/ — the full Prisma 7 / PostgreSQL 18 schema, architecture documentation, and security model.
  • prisma/schema.prisma — a minimal SQLite demo schema (so bun dev works out of the box; swap for docs/schema.prisma when wiring up the real NestJS API).

Quickstart

# 1. Install
bun install

# 2. Run the dev server (auto-starts on :3000)
bun dev
# → open http://localhost:3000

# 3. Lint
bun run lint

The dashboard opens on a passkey-first login screen (any email + password signs you in for the demo). Once inside, you can:

  • Browse the overview with a resizable widget grid (MRR, activations, geo distribution, tamper signals, recent activity, security alerts).
  • Manage licenses — issue, filter, view the signed EdDSA certificate in a detail drawer, verify its signature locally (mocked for the BANNED license to demo failure), revoke/suspend/extend.
  • Browse customers — see their wallets, licenses, transaction history; trigger a time-boxed impersonation.
  • Manage machines — see the lock-state escalation ladder (Flag → Warn → Lock → Wipe), issue LOCK / WIPE_LICENSE commands with the dual-control safeguard UI, view tamper signals and command history.
  • Read the audit log — immutable, append-only timeline of every sensitive mutation.
  • Top up the wallet — Stripe (card) or NOWPayments (crypto, with a real QR code) feeding the same append-only ledger.
  • Answer support tickets — inbox + thread UI with priority escalation.
  • Configure settings — organization, policies, API keys (with one-time-reveal), webhook endpoints, security posture, and i18n (live locale switching including RTL Arabic).

Stack

Layer Choice
Frontend Next.js 16 (App Router, RSC) · TypeScript 5 · Tailwind v4 · shadcn/ui · Framer Motion
State Zustand (client state) · TanStack Query (server state)
i18n Custom provider (mirrors next-intl semantics) with five catalogs (en/fr/ar/ru/zh-Hans) and ICU-style pluralization
Auth (UI demo) Passkey-first login screen, TOTP fallback with input-otp, backup-code recovery
SDK @aegis/license-sdk@noble/curves (Ed25519) · @noble/hashes (SHA-256)
Backend (target) NestJS 11 (Fastify) · PostgreSQL 18 · Prisma 7 · Valkey/Redis · BullMQ — see docs/ARCHITECTURE.md
Visual One UI–inspired design system (Manrope + Inter, Galaxy blue, soft ambient shadows, 24px+ radii, spring physics with prefers-reduced-motion respected)

Why this exists

Aegis is the single source of truth for identity and licensing that sits in front of a desktop product. Instead of ad hoc license-key spreadsheets or a hand-rolled if (key === validKey) check baked into the desktop app, the desktop app talks to Aegis:

  • On first run / login → Aegis authenticates the user via OAuth 2.0 Device Authorization Grant (no embedded browser, no password in the desktop shell).
  • On activation → Aegis issues a cryptographically signed license certificate scoped to that machine.
  • On every subsequent launch → the desktop app verifies that certificate locally, offline, in milliseconds — no network call required to unlock.
  • Periodically in the background → the desktop app heartbeats to catch renewals, plan changes, or revocations, with a configurable offline grace period.
  • When the team needs to intervene → the admin dashboard can revoke, extend, transfer, or refund a license in a few clicks, fully audit-logged.

Think of it as building your own Keygen / Cryptlex / LicenseSpring — except you own the code, the data, and the roadmap.

Project layout

.
├── src/
│   ├── app/                        # Next.js 16 App Router
│   │   ├── layout.tsx              # Root layout: fonts, theme, locale, motion providers
│   │   ├── page.tsx                # Single-page admin dashboard (state-driven nav)
│   │   └── globals.css             # One UI design tokens (light + dark)
│   ├── components/
│   │   ├── ui/                     # shadcn/ui (New York style)
│   │   └── aegis/                  # Aegis dashboard components
│   │       ├── login-screen.tsx
│   │       ├── sidebar.tsx
│   │       ├── top-bar.tsx
│   │       ├── overview-view.tsx
│   │       ├── licenses-view.tsx
│   │       ├── machines-view.tsx
│   │       ├── lock-wipe-dialog.tsx
│   │       ├── wallet-view.tsx
│   │       ├── audit-view.tsx
│   │       ├── support-view.tsx
│   │       ├── settings-view.tsx
│   │       ├── charts.tsx
│   │       └── ...
│   ├── lib/
│   │   ├── i18n.ts                 # 5-locale catalog (en/fr/ar RTL/ru/zh-Hans)
│   │   ├── mock-data.ts            # Comprehensive mock data mirroring the Prisma schema
│   │   ├── format.ts               # Intl.NumberFormat / DateTimeFormat helpers
│   │   └── utils.ts
│   └── stores/
│       └── app-store.ts            # Zustand: auth, view, selection, widget layout
├── packages/
│   └── license-sdk/                # @aegis/license-sdk (shippable to npm)
│       ├── src/
│       │   ├── client.ts           # AegisClient — main entry
│       │   ├── certificate.ts      # Ed25519 sign / verify (compact JWT, EdDSA)
│       │   ├── fingerprint.ts      # SHA-256 hardware fingerprint
│       │   ├── device-auth.ts      # OAuth 2.0 Device Authorization Grant (RFC 8628)
│       │   ├── storage.ts          # SecureStorage abstraction (Electron safeStorage etc.)
│       │   ├── heartbeat.ts        # Background loop with grace-window escalation
│       │   ├── tamper.ts           # Integrity / debugger / clock-rollback signals
│       │   ├── lock-wipe.ts        # Remote command handler (tightly-scoped WIPE)
│       │   └── ...
│       └── README.md
├── prisma/
│   └── schema.prisma               # SQLite demo schema (for `bun dev`)
├── docs/
│   ├── schema.prisma               # Full PostgreSQL 18 / Prisma 7 production schema
│   ├── ARCHITECTURE.md             # System architecture & wire protocol
│   └── SECURITY.md                 # Security model & controls
├── README.md                       # ← you are here
└── package.json

Documentation

  • docs/ARCHITECTURE.md — system architecture, the OAuth 2.0 Device Authorization Grant flow, the activation/heartbeat wire protocol, and the remote command delivery path.
  • docs/SECURITY.md — security model, AAL2 requirements, the kill-switch scope enforcement, and the SOC 2 / ISO 27001 audit trail.
  • docs/schema.prisma — the full PostgreSQL 18 / Prisma 7 production schema (15+ models, all indexes for hot paths, append-only audit log, wallet ledger invariant).
  • packages/license-sdk/README.md — SDK quickstart for Electron / Tauri / .NET / native, with a complete code sample.

Design system

The UI is One UI–inspired — distilled from One UI 8.5's well-documented visual language (immersive edge-to-edge chrome, heavy rounding, fluid spring motion, oversized confident numerals) and translated into concrete web tokens.

  • Color: Galaxy blue #0074E4 (light) / #2E96FF (dark) — reserved for primary actions only. Galaxy destructive #D93025 — used only for Lock/Wipe and destructive confirmations, so its appearance alone signals severity.
  • Type: Manrope (700–800) for display/headings with oversized numerals; Inter (400–600) for body/UI; Noto Sans Arabic for ar; Noto Sans SC for zh-Hans. Per-script loading via next/font keeps payloads small.
  • Layout & motion: 24–28px corner radii, pill buttons, soft ambient shadows, glass-bar top on scroll, spring physics (Framer Motion) with prefers-reduced-motion respected everywhere.
  • RTL: built with CSS logical properties from day one (margin-inline-start/end, text-align: start/end). Switching to Arabic sets <html dir="rtl"> and the entire design system mirrors correctly with zero one-off overrides.

i18n

Five locales at launch:

Code Language Notes
en English Base catalog
fr French Two-form pluralization
ar Modern Standard Arabic Full RTL + six-form pluralization (zero/one/two/few/many/other)
ru Russian Three-form pluralization
zh-Hans Chinese Simplified No plural forms

Every string goes through the translation function — no inline strings in components. The backend (target) uses nestjs-i18n with the same message-key vocabulary, so translators maintain one catalog per language, not two.

License

MIT.

About

Production-grade licensing, entitlement & authentication platform — Next.js 16, Prisma, RBAC, GraphQL, customer portal, webhook retry queue, audit log, MFA

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages