No Passwords, No Browser OAuth, No Problem: How Tollbooth-DPYC™ offers security with Nostr Primitives
Share
A discussion on achieving confidentiality, integrity, and availability for API monetization — without a single username, password, or login screen.
Updated October 19, 2026 to reflect the current identity-proof and Secure Courier algorithms in tollbooth-dpyc. The full specification is in Identity Proofs.
Problems in API Security, Today
Almost all API monetization platforms use the same tactics: email signup, password hash, OAuth2 authorization code flow, bearer tokens, refresh tokens, token revocation endpoints, and a prayer that nobody leaks the .env file into git.
Tollbooth-DPYC is the welcome exception.
Tollbooth-DPYC offers an innovative, low-friction, approach. Identity is simply a cryptographic keypair. Authentication is a simple Schnorr signature. Credential exchange occurs with end-to-end bidirectional encryption over a decentralized relay network
There are no usernames, no passwords, no login screens, and no plaintext secrets on disk.
(Now, Tollbooth-DPYC MCPs do support REST APIs that require OAuth2 protocols - it is just that Tollbooth-DPYC itself never uses OAuth to establish who you are. With Tollbooth-DPYC, entrepreneurs absolutely can and do wrap legacy REST APIs that use JWT bearer auth or OAuth2 authorization code grants.)
I. Confidentiality
“No one sees what isn’t theirs to see.”
1. Identity Without Disclosure
In Tollbooth, you (a patron) need only supply your chosen keypair — nsec (private) and npub (public) on secp256k1. No email, no username, no phone number. Identity by possession, not assertion. Use as many as you like.
2. Secure Courier: Credential Exchange Without Plaintext
Credentials flow through NIP-44v2 encrypted Nostr DMs (ECDH + HKDF + ChaCha20-Poly1305 + HMAC-SHA256). The relay sees only ciphertext. The Operator signs each request with an attestation that binds its delivery key, the recipient and a one-time nonce, and pins one rendezvous relay for the reply. A reply carrying any other nonce is refused, and every DM is NIP-09 deleted after pickup. The human stays in the loop — the patron must consciously reply — and each receive_* call drains the pinned relay, so it is called once, after the patron has replied.
The courier exchange and the grant it produces are told at length, and without a line of cryptography, in The Secure Courier: How an AI Agent Proves It May Act for You. Read that one first if you want the shape of the protocol before its primitives.
3. Vault Encryption at Rest (AES-256-GCM with AAD)
Credentials, patron balances, tranche details, usage history are encrypted with AES-256-GCM, keyed via HKDF from the operator’s nsec. Vault encryption supports Associated Authenticated Data (AAD) — ciphertext is bound to its vault key, preventing cross-entry substitution.
4. Per-Operator Neon Schema Isolation
Each operator’s data lives in unique namespace op_{SHA256(npub)[:16]}, owned by a per-operator LOGIN role. Authority DML revoked. public schema is empty — every actor has its own namespace. Three layers: role isolation, VaultCipher, and forklift retention.
II. Integrity
“No one changes what isn’t theirs to change.”
1. Schnorr Signatures (BIP-340)
Every identity proof ends in a Schnorr signature: a kind-27235 signature over one HTTP request (NIP-98) for a caller holding the key, or the patron's own signed reply for a caller holding none. No Certificate Authority, no CRL, no OCSP — just math.
2. Authority Certificates (kind-30079)
Operators prove Authority permission via Schnorr-signed certificates. JTI anti-replay (10-minute TTL) + NIP-40 expiration tags.
3. Demonstrated Proof of Possession (DPoP)
A request proves the npub it acts for on the connection, never in the tool arguments, so nothing that proves an npub ever enters a model's transcript. Tool calls carry only the npub, and each request acts for exactly one. The HTTP Authorization header carries one of two proofs:
- Signed request (NIP-98). A caller holding the nsec signs each HTTP request as a kind-27235 event naming the URL, the method, the SHA-256 of the body and a random nonce. The service checks the Schnorr signature and accepts the event once, within 60 seconds. Nothing is stored.
- Holder connection (OAuth 2.1). A caller holding no key, such as an AI assistant or a web page, connects with Authorization Code and PKCE. The service is its own authorization server and shows no consent screen, because a new connection proves nothing. The patron then answers one Secure Courier DM, and the service mints an Operator-signed kind-30080 grant binding the npub, the patron's verified reply signature, the hash of the one-time nonce and an expiry. The grant is stored encrypted in that connection's wallet and never leaves the service.
The patron chooses the grant's lifetime with cache_duration in the reply (2h default, 30-day cap), and parse_duration() accepts natural language. Access tokens last an hour and refresh tokens are single use, so a leaked token is short-lived and a replayed refresh forgets the connection. forget_credentials revokes every grant a patron ever issued, on every connection. Bech32 checksum validation on resolve_npub().
What a DPoP grant is, why a stolen one is worth so little, and why a messenger holding its own key needs no grant at all are all worked through in plain language in The Secure Courier. The rule it turns on: the code word picks out a reply, and never unlocks anything.
4. OAuth2 Collector Encryption
Access codes for OAuth2 access token requests are encrypted with AES-256-GCM (random IV, key = SHA-256(state)). Cached access codes have a 10-minute TTL, single-use delete-on-retrieval. A utility web-service tollbooth-oauth2-collector bridges the HTTP GET of standard OAuth2 redirect_uri callbacks to the HTTP POST-only nature of MCP services.
III. Availability
“The system works when you need it.”
1. No Central Identity Provider
Decentralized Nostr relay network with rotation. There is no single, shared authorization server: each service authorizes only its own connections.
2. Vault-First Credential Restore
Cold-starting MCPs check encrypted Neon vault before relay I/O. Bounded by Neon SLA, not by relay uptime.
3. Cold Start Inline Retry
Pricing resolver: 3 attempts, 2s backoff. First paid call takes seconds but succeeds. Free tools are always available during warm-up.
4. Lightning Micropayments
Bitcoin Lightning — no Stripe, no PayPal, no KYC, no chargebacks. The payment processor in Tollbooth-DPYC is, today, the very effective open-source BTCPay Server. However, the choice of "cashier" is a modular option and other payment processors could be chosen by specific Operators (you, the entrepreneur).
IV. The Constraint Pipeline
Composable pricing rules evaluated at billing time in debit_or_deny.Built-in: Happy Hour (with recurrence: never/weekly/biweekly/monthly/annually), Free Trial, Surge, Temporal Window, Loyalty Discount, Coupon, Patron Proof. Scoping: per-tool (tool_ids) and per-patron (patron_npubs, max 10). TrancheLifetime: credit expiration as a property of money. Usage tracking: free calls record stats.
A modern iPadOS Tollbooth Pricing Studio guides the economic analyst in constructing, saving, and deploying various tool-pricing Campaigns.
V. Tollbooth Don't Pester Your Customer tactics
- No OAuth identity — a keyless connection uses OAuth 2.1 plumbing, but it proves nothing until the patron's own key signs a reply (OAuth2 is otherwise used only for secondary REST providers that require it for their APIs)
-
No
.envsecrets — onlyTOLLBOOTH_NOSTR_OPERATOR_NSEC; everything else via Secure Courier - No bearer token is an identity — a connection's token lasts an hour and proves nothing by itself; signed requests are accepted once, within 60 seconds
- No ambient authority — proof requires conscious human action
- No KYC — identity is only a Nostr keypair and there is no PII exchanged with banks
VI. Trade-offs
Key management is the patron’s responsibility. Relay availability is probabilistic. Proof duration is a knob (2h default, 30-day cap). These are features, not bugs.
VII. References
For more wisdom, consult the prior art that makes Tollbooth-DPYC secure.
- Schneier, Applied Cryptography, 2nd ed. Wiley, 1996.
- BIP-340: Schnorr Signatures for secp256k1.
- NIP-04/44/17: Nostr encryption specifications. NIP-98: HTTP Auth.
- RFC 9449: OAuth 2.0 DPoP. OAuth 2.1 (draft-ietf-oauth-v2-1). RFC 7636: PKCE. RFC 7539: ChaCha20-Poly1305. RFC 5869: HKDF.
- NIST SP 800-38D: AES-GCM.
- Saltzer & Schroeder, 1975: Protection of Information in Computer Systems.
- Schnorr, 1991: Efficient Signature Generation by Smart Cards.
Tollbooth-DPYC™ is open source under Apache 2.0. tollbooth-dpyc · dpyc-community








