Nostr relay account whitelist — access-tier API + NIP-11 self-description #37

Closed
opened 2026-03-19 18:52:13 +00:00 by replit · 1 comment
Owner

Why

The relay must only accept events from explicitly whitelisted accounts. Trust tier from the existing Nostr identity system maps directly to relay access.

Acceptance criteria

  • relay_accounts DB table: pubkey, trust_tier, access_level (none/read/write/elite), granted_by, granted_at, revoked_at
  • POST /api/admin/relay/accounts — grant access to a pubkey (admin token required)
  • DELETE /api/admin/relay/accounts/:pubkey — revoke access
  • GET /api/admin/relay/accounts — list all accounts with their access level and trust tier
  • POST /api/relay/policy reads relay_accounts to resolve access level; unknown pubkeys always get reject
  • Trust tier sync: when a pubkey crosses a trust tier threshold (in identity.ts), its relay access level is automatically upgraded
  • NIP-11 relay info (GET / with Accept: application/nostr+json): returns relay name, description, pubkey (Timmy's npub), contact, supported_nips

Out of scope

  • Admin UI (separate issue)
  • Event moderation queue (separate issue)

Relevant files

  • artifacts/api-server/src/routes/identity.ts (trust tier thresholds)
  • artifacts/api-server/src/routes/ (new relay routes)
  • lib/db/src/schema/

Delegate

@hermes

## Why The relay must only accept events from explicitly whitelisted accounts. Trust tier from the existing Nostr identity system maps directly to relay access. ## Acceptance criteria - [ ] `relay_accounts` DB table: pubkey, trust_tier, access_level (none/read/write/elite), granted_by, granted_at, revoked_at - [ ] `POST /api/admin/relay/accounts` — grant access to a pubkey (admin token required) - [ ] `DELETE /api/admin/relay/accounts/:pubkey` — revoke access - [ ] `GET /api/admin/relay/accounts` — list all accounts with their access level and trust tier - [ ] `POST /api/relay/policy` reads `relay_accounts` to resolve access level; unknown pubkeys always get `reject` - [ ] Trust tier sync: when a pubkey crosses a trust tier threshold (in identity.ts), its relay access level is automatically upgraded - [ ] NIP-11 relay info (`GET /` with `Accept: application/nostr+json`): returns relay name, description, pubkey (Timmy's npub), contact, supported_nips ## Out of scope - Admin UI (separate issue) - Event moderation queue (separate issue) ## Relevant files - `artifacts/api-server/src/routes/identity.ts` (trust tier thresholds) - `artifacts/api-server/src/routes/` (new relay routes) - `lib/db/src/schema/` ## Delegate `@hermes`
replit added the apiintegrationbackend labels 2026-03-19 18:52:13 +00:00
replit added the hermes label 2026-03-19 19:32:01 +00:00
claude was assigned by Rockachopa 2026-03-23 14:07:53 +00:00
Collaborator

PR created: http://143.198.27.163:3000/replit/token-gated-economy/pulls/65

Implemented:

  • relay_accounts schema: added elite access level + trust_tier column
  • Migration 0007_relay_account_whitelist.sql (idempotent)
  • POST /api/admin/relay/accounts (body: pubkey, level, notes)
  • DELETE /api/admin/relay/accounts/:pubkey
  • Relay policy handles elite access level → direct inject, bypass moderation
  • Trust tier sync stores trust_tier; elite tier maps to elite access level
  • NIP-11: GET / with Accept: application/nostr+json returns relay info doc
PR created: http://143.198.27.163:3000/replit/token-gated-economy/pulls/65 Implemented: - `relay_accounts` schema: added `elite` access level + `trust_tier` column - Migration `0007_relay_account_whitelist.sql` (idempotent) - `POST /api/admin/relay/accounts` (body: pubkey, level, notes) - `DELETE /api/admin/relay/accounts/:pubkey` - Relay policy handles `elite` access level → direct inject, bypass moderation - Trust tier sync stores `trust_tier`; elite tier maps to `elite` access level - NIP-11: `GET /` with `Accept: application/nostr+json` returns relay info doc
This repo is archived. You cannot comment on issues.