Card data never reaches Ducat
Your customers type their card into Stripe's hosted pages (Checkout, and the card step of Ducat's portal). Card numbers go to Stripe and never reach Ducat or your servers. For agents' cards, the agent pays through a payment tool and never sees the number; only the card's person can open a details view, in the issuer's own frame.
API keys
- A key is a machine client of your team in Nod, the identity service Ducat uses, named
<team>.<key>. Only the console's own admin client can make one, and it names it for the team whose member asked. - Keys carry only
payments:readandpayments:writefor Ducat's API (urn:payments:api). Operator and card-issuing scopes are dropped from team keys. - A key's secret is shown once, when it's made. The site doesn't keep it and nobody at Ducat can show it again. Revoke a key in the console the moment you think it leaked.
- You swap the key for a short-lived token (client credentials, with
resource=urn:payments:api) and send only the token to the API; Ducat checks each token's issuer, audience and expiry. - Each plan holds a set number of keys (3 on Starter, 20 on Growth). Going back to Starter never revokes keys already made.
Each team sees only its own
Everything a key makes, customers, prices, sessions, subscriptions, invoices and events, is owned by its team, written by Ducat into Stripe's metadata where callers can't set it. Another team, another product or a generated app asking for one of your objects gets 404, exactly as if it didn't exist. Idempotency keys, meter identifiers and promotion codes are scoped the same way, so one team's can never touch another's.
A person's nod past the limits
A charge, refund, credit note, invoice payment or subscription past the standing limits (today 100.00 a charge or period in USD, EUR and AUD; any amount in a currency with no limit) answers 403 with a challenge naming exactly that action. A person approves it in Nod, and the request is sent again with Nod-Approval. Each approval works once, for that action only, and isn't spent if the request then fails. Checkout needs no nod: the customer pays for themselves.
Webhook signatures
Every event Ducat pushes carries Ducat-Signature: t=<unix>,v1=<hex>, Stripe's own scheme: v1 is the HMAC-SHA256 of "<t>.<raw body>", keyed with your endpoint's whole secret. Check it over the raw body before parsing, refuse timestamps more than five minutes away, and compare in constant time. ducatpay.dev checks its own webhook exactly this way.
TypeScript
const ok = await verify(env.DUCAT_WEBHOOK_SECRET, req.headers.get("ducat-signature") ?? "", await req.text());
if (!ok) return new Response("bad signature", { status: 400 });- The secret is shown once, when you set the endpoint. Setting it again makes a new secret, and the old one stops signing at once.
- Ducat delivers only to public https addresses: loopback, private and link-local addresses are refused when set and at every delivery, and redirects aren't followed.
- Stripe's events reach Ducat signed with Stripe-Signature and checked; an empty signing secret refuses every event.
Secrets and Vault
Ducat's own secrets, Stripe's key, its webhook signing secrets, its database token, and each of its clients' secrets, are never in the code, on a command line or in a chat:
- On Ducat's server each secret is a file only the service can read (
0400, systemd credentials), pointed at by a_FILEsetting. - Client secrets go from the command that prints them straight into a
0600file, then into Vault (one entry per secret) and the Worker's secret store, and the file is shredded. - Ducat refuses any Stripe key that isn't a test-mode key until live payments are a person's decision.
- Your webhook secret is kept as it is (Ducat must sign with it), so access to Ducat's store is what guards it; it's never shown again or logged.
This site
- Sign-in through Nod with code and PKCE, the ID token checked; a sealed, host-only, HttpOnly, Secure session cookie and nothing else. No tracking or advertising cookies.
- A strict Content-Security-Policy (no third-party scripts, no framing), HSTS, nosniff and a strict referrer policy on every page.
- State-changing requests must come from the site's own pages (Origin checked).
- The API at
https://api.ducatpay.devand sign-in athttps://auth.ducatpay.devare HTTPS only.
Reporting a problem
Found a vulnerability? Email support@ducatpay.dev with “Security” in the subject. A person reads it. Please don't include live secrets or card numbers.