The Open-Source Server for Zero-Knowledge Credential Infrastructure.
The high-performance, asynchronous REST backend for AgentSecrets — enabling multi-device secret synchronization, asymmetric team key exchange, microsecond agent verification, and tamper-evident telemetry without ever touching plaintext credentials.
Website · Documentation · CLI Repository · Engineering Publication
Traditional secrets managers operate as trusted vaults: the server receives plaintext over TLS, holds decryption keys, decrypts secrets in server memory, and logs access. If the server is compromised or subpoenaed, every secret is exposed.
agentsecrets-server is architecturally blind. It operates on zero-knowledge cryptographic principles:
┌───────────────────────────┐ ┌───────────────────────────┐
│ AgentSecrets CLI │ │ agentsecrets-server │
│ (Client Security Boundary)│ │ (Blind Ciphertext Host) │
├───────────────────────────┤ ├───────────────────────────┤
│ 1. Generates Project Key │ │ │
│ 2. Encrypts Secret (GCM) │ Ciphertext │ 3. Stores Ciphertext │
│ 3. Encrypts Key w/ PubKey │ ──────────────> │ Server CANNOT decrypt │
│ │ (X25519/NaCl) │ No master key on disk │
│ 4. Decrypts locally with │ │ Zero plaintext in memory│
│ user private key │ <────────────── │ 4. Serves encrypted blobs │
└───────────────────────────┘ └───────────────────────────┘
- Client-Side Encryption: Secrets are encrypted on the client machine using AES-256-GCM before transmission.
- Asymmetric Team Sharing: Workspace encryption keys are wrapped using recipients' public keys (X25519 / NaCl SealedBox). The server stores wrapped key envelopes it structurally cannot unlock.
- No Value Storage:
agentsecrets-serverstores ciphertext blobs and metadata (environment, project, usage policies). The server holds no master decryption keys and has no code path to return plaintext.
If the server cannot decrypt secrets, why does agentsecrets-server require a Fernet ENCRYPTION_KEY?
The answer is defense-in-depth double-envelope encryption:
[ Developer Machine ] [ agentsecrets-server Database ]
Plaintext Secret (sk_live_...)
│
▼ (Client AES-256-GCM)
Client Ciphertext (Opaque)
│
▼ (Network Payload)
Received by Server ──────────────────────> Outer Fernet Layer (ENCRYPTION_KEY)
└── Inner Client Ciphertext (AES-256-GCM)
- Client Layer (Zero-Knowledge Boundary): The
agentsecretsCLI encrypts raw values using AES-256-GCM on your local machine. The payload sent across the wire is already opaque ciphertext. - Server Layer (At-Rest Database Protection): When
agentsecrets-serverwrites to the database, it wraps the already-encrypted client blob in an additional Fernet layer (ENCRYPTION_KEY). - Cryptographic Guarantee: The server is simply encrypting an encrypted blob. Even if a rogue actor gains direct access to PostgreSQL and obtains the server's
ENCRYPTION_KEY, decrypting the database layer only yields the client-side AES-256-GCM ciphertext. The underlying credential values remain structurally unreadable. This is just a step added by me(steppacodes) because i can lol.
agentsecrets-server is engineered in Python with a strict 5-Layer Asynchronous Architecture built on top of Django 5 and Django Ninja Extra:
┌─────────────────────────────────────────┐
│ HTTP Request (TLS) │
└────────────────────┬────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ 1. Thin API Controllers │
│ (Route parsing, Auth, HTTP mapping) │
└────────────────────┬────────────────────┘
│
┌──────────────────┴──────────────────┐
▼ ▼
┌───────────────────────┐ ┌───────────────────────┐
│ 2. Query Selectors │ │ 3. Domain Services │
│ (Pure Reads, Caching) │ │ (Mutations & Atomicity)│
└───────────┬───────────┘ └───────────┬───────────┘
│ │
└──────────────────┬──────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ 4. Strict Pydantic Schemas │
│ (Input validation, extra="forbid") │
└────────────────────┬────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ 5. Django ORM Models │
│ (PostgreSQL / Temporal Pinning) │
└─────────────────────────────────────────┘
| Layer | Responsibility | Invariant |
|---|---|---|
Controllers (views.py) |
Route handlers, request/response serialization, status code mapping. | Thin: Maximum 25 LOC per route. Zero database queries. |
Selectors (selectors.py) |
Read-only database queries, joins, prefetching, and query caching. | Pure reads: Zero state mutations. Idempotent and concurrency-safe. |
Services (services.py) |
Business logic, state transitions, cryptographic derivation, multi-step flows. | Atomic: Wrapped in transactions. All external side effects managed here. |
Schemas (schemas.py) |
Type definitions, payload validation, response envelopes (DataResponse[T]). |
Strict: extra="forbid" on inputs. Rejects unvalidated fields. |
Models (models.py) |
Database schemas, indexing, and temporal constraints. | Explicit: UUID primary keys, composite indices, strict foreign keys. |
- Personal & Shared Boundaries: Workspaces form the administrative boundary for access control and allowlists.
- Asymmetric Envelopes: Member invitations exchange workspace encryption keys encrypted with recipient public keys.
- Role-Based Access Control: Strict Owner, Admin, Member, and Read-Only privilege separation.
- Internal Resolver Endpoint: Microsecond constant-time SHA-256 token verification (
AgentToken) for runtime proxy validation. - Capability Scoping: Enforces granular HTTP method and domain allowlists per agent registration.
- Batch Sync Ingestion: Aggregates CLI execution metrics, injection style breakdowns, and shielding blocks over rolling 24-hour windows.
- Temporal Pinning:
calculate_metricscomputes historically accurate platform aggregates, DAU/WAU/MAU trends, and unique user adoption rates. - Zero-Leakage Sanitization: Real-time command classification and regex sanitization strip filesystem artifacts, ensuring zero developer paths or usernames leak into logs.
- Zero PII: No email addresses, tokens, secrets, or client IP addresses are emitted in stdout or file logs.
- Unified Error Handling: Structured error responses with unique error codes (
ErrorCode.FORBIDDEN,ErrorCode.INVALID_ENTRY).
- Runtime: Python 3.10+ / ASGI Async
- Framework: Django 5.x + Django Ninja Extra
- Authentication:
SimpleJWT+ HMAC-SHA256 Service Tokens + Asymmetric Public Keys - Admin UI: Django Unfold
- Database: PostgreSQL (Production) / SQLite (Testing)
- Validation: Pydantic v2
git clone https://github.com/The-17/agentsecrets-server.git
cd agentsecrets-server
python3 -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
pip install -r requirements.txtManage and govern all database, encryption, and Django configuration securely with the agentsecrets CLI:
# Initialize and link your project
agentsecrets init
agentsecrets project create agentsecrets-server
# Set all required server credentials
agentsecrets secrets set SECRET_KEY="your-django-secret-key"
agentsecrets secrets set ENCRYPTION_KEY="your-fernet-encryption-key"
agentsecrets secrets set SETTINGS="core.settings.dev"
agentsecrets secrets set ALLOWED_HOSTS="localhost,127.0.0.1"
agentsecrets secrets set POSTGRES_DB="agentsecrets"
agentsecrets secrets set POSTGRES_USER="postgres"
agentsecrets secrets set POSTGRES_PASSWORD="your-postgres-password"
agentsecrets secrets set POSTGRES_HOST="localhost"
agentsecrets secrets set POSTGRES_PORT="5432"Run database migrations and start the server with zero-knowledge runtime credential injection:
# Apply database migrations via AgentSecrets injection
agentsecrets env -- python manage.py migrate
# Launch the development server
agentsecrets env -- python manage.py runserverComprehensive technical guides and specifications are available in the docs/ directory:
| Guide | Description |
|---|---|
| System Architecture | Technical overview of the 5-layer architecture, concurrency model, and cryptographic invariants |
| Workspace Encryption Model | Zero-knowledge asymmetric key exchange, X25519 envelopes, and team sharing mechanics |
| Self-Hosting & Operations | Production setup, Docker Compose, Gunicorn/Uvicorn ASGI workers, and cron configuration |
| API Overview & Protocols | Request/response envelopes, error codes, and complete endpoint catalog |
agentsecrets-server exposes two distinct OpenAPI routing trees:
| Domain | Endpoint | Methods | Description |
|---|---|---|---|
| System | /api/status/ |
GET |
Health check & diagnostic pipeline (/, /health/) |
| Auth | /api/auth/register/ |
POST |
User registration with key-pair provisioning |
/api/auth/login/ |
POST |
Authenticate and obtain JWT access & refresh tokens | |
/api/auth/refresh/ |
POST |
Refresh access token with activity stamping | |
| Users | /api/users/{email}/public-key/ |
GET |
Retrieve user public key for asymmetric key exchange |
| Workspaces | /api/workspaces/ |
GET, POST |
List and create workspaces |
/api/workspaces/{id}/members/ |
GET, POST |
Manage workspace memberships and role assignments | |
/api/workspaces/{id}/allowlist/ |
GET, POST, DELETE |
Domain allowlists for agent proxy enforcement | |
| Projects | /api/projects/ |
GET, POST |
List, create, and link projects within workspaces |
| Secrets | /api/secrets/ |
POST |
Atomic bulk upsert of client-encrypted secrets |
/api/secrets/{project_id}/ |
GET |
List encrypted secret keys and metadata | |
/api/secrets/{project_id}/{key}/ |
GET, DELETE |
Retrieve ciphertext or delete a secret | |
| Agents | /api/workspaces/{id}/agents/ |
GET, POST |
Register AI agents and issue cryptographic tokens |
| Resolver | /api/internal/agents/verify/ |
POST |
Microsecond agent token verification for the proxy |
| Endpoint | Methods | Auth | Description |
|---|---|---|---|
/telemetry/sync/ |
POST |
Anonymous / JWT | Ingest batched client telemetry snapshots |
/telemetry/metrics/ |
GET |
Public | Comprehensive platform analytics, growth, and adoption metrics |
/telemetry/internal/compute-metrics/ |
GET, POST |
CRON_SECRET |
Scheduled trigger for temporal metrics rollup |
Run the automated test suite across all applications:
python manage.py test apps.common apps.accounts apps.secrets_app apps.workspaces apps.telemetry -v 2Run historical metrics calculation backfills:
python manage.py calculate_metrics --days 30Found a vulnerability or security issue? Please see SECURITY.md for responsible disclosure guidelines. Do not open public issues for security vulnerabilities.
agentsecrets-server is open-source software licensed under the MIT License.