Nobody rotates secrets until something makes them. A contractor leaves, a key ends up in a screenshot in a support ticket, a laptop goes missing, and suddenly you're working out which credential lives where and what breaks when you change it.
It's much calmer to work that out on a quiet Tuesday. So here's the full list for Coldtill, the self-hosted crypto payment gateway I work on: every secret an install has, how to swap each one without dropping a payment, and the one that isn't really a rotation candidate at all.
Most of this applies to any self-hosted payment stack. The details are Coldtill's.
The inventory
Before changing anything, know what you have. An install has these:
| Secret | Where it lives | What it guards |
|---|---|---|
API keys (ct_…) | Your shop's environment, hashed in Coldtill's database | Creating and reading payments; full-access keys can also send payouts |
| Webhook signing secrets | Your receiver, and sealed in Coldtill's database | Proving a webhook really came from your server |
| Hot wallet keys | Encrypted in the database | The small float that pays gas for sweeps and sends payouts you approve |
| Hot-wallet passphrase | secrets/ on the server by default, or typed at start-up | Unlocking the identity those keys are encrypted to |
COLDTILL_SECRET | .env on the server | Sessions, sealed two-factor and webhook secrets, payout approval codes |
Install token (cti_…, Standard and Pro) | Your coldtill.com account, and updater.env on the server | Downloading releases for your edition |
What's not on the list matters too: the cold wallet. Coldtill only ever knows its address. Nothing below touches the place your swept money actually sits, which is why a rotation here is an inconvenience rather than an emergency.
API keys: overlap, then revoke
Keys are shown once and stored hashed, so there's no "reveal" button and no way to edit one in place. That includes the scope: a key is either payments only or full access, chosen at creation and fixed. If you want a different scope, you make a new key.
The safe order is the boring one:
- Create the new key.
- Deploy it everywhere the old one is used.
- Watch real traffic succeed with it.
- Revoke the old key.
Step 3 is the one people skip. Revoke first and you find out about the forgotten cron job on a second server when it starts throwing 401s.
While you're there, check the scope. A shop backend that only creates invoices and reads their status should hold a payments-only key. If that key leaks, whoever has it can create and read payments, but asking for a payout gets a 403:
{"error": "this API key can only create and read payments", "code": "api_key_scope"} Keys created before scopes existed are full access, and the dashboard shows each key's scope. If an old full key is only taking payments, a rotation is a good excuse to replace it with a payments-only one.
If you're on WooCommerce
The Coldtill plugin for WooCommerce keeps the key in its settings, under WooCommerce → Settings → Payments → Coldtill. Rotation there is: create a payments-only key in Coldtill, paste it over the old one, save, place a small test order, then revoke the old key. There's no reason a WordPress install should ever hold a full-access key.
Webhook secrets: new endpoint, both secrets, delete the old
Each webhook endpoint gets its own signing secret, shown once. You don't edit a secret; you create a new endpoint and delete the old one. To do that without rejecting real events in between, let your receiver accept either secret for a short window.
Here's a small Node receiver that does that, checking the v2 signature (an HMAC-SHA256 of <timestamp>.<raw body>) against a list:
import crypto from "node:crypto"; import express from "express"; // During a rotation, set both. Afterwards, remove the old one. const SECRETS = [process.env.COLDTILL_WEBHOOK_SECRET, process.env.COLDTILL_WEBHOOK_SECRET_OLD] .filter(Boolean); const app = express(); app.post("/coldtill/webhook", express.raw({ type: "application/json" }), (req, res) => { const ts = req.get("X-Coldtill-Timestamp") ?? ""; const sig = req.get("X-Coldtill-Signature-V2") ?? ""; if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return res.sendStatus(400); const ok = SECRETS.some((secret) => { const expected = "sha256=" + crypto .createHmac("sha256", secret) .update(ts + "." + req.body.toString("utf8")) .digest("hex"); return expected.length === sig.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(sig)); }); if (!ok) return res.sendStatus(401); const event = JSON.parse(req.body.toString("utf8")); // Act on event.status and event.reference_id, idempotently. res.sendStatus(200); }); Two details matter here. First, express.raw, not express.json: the HMAC is over the exact bytes, and a parser that re-serialises the body will break every signature. Second, the handler has to be idempotent anyway, because final events are retried and ordering isn't guaranteed. That same property is what makes the overlap safe: while both endpoints exist, you should expect events to arrive at both, and a receiver that already ignores duplicates won't care.
The sequence:
- Add a new endpoint for your receiver and copy its secret.
- Deploy the receiver with both secrets set.
- Use Send test on the new endpoint and confirm it passes.
- Delete the old endpoint.
- Remove the old secret from your environment and redeploy.
The WooCommerce plugin has a single secret field, so the overlap trick isn't available there. Do it at a quiet time, then look at Webhooks → Deliveries for anything that failed in the gap and retry it by hand. The plugin also re-checks a payment's status when the customer lands back on the order-received page, which covers most of what a missed webhook would have done.
Hot wallets: add, move, delete
Hot wallets hold gas money and the float for approved payouts. If you think a hot key is exposed, the docs' order is:
- Add a new hot wallet.
- Assign it to the project.
- Move whatever is left out of the old one, using your own wallet.
- Delete the old one.
The worst case for a leaked hot key is losing the float, which is the whole argument for keeping it small. Top it up often in small amounts rather than rarely in large ones.
The passphrase: plan a window
The hot keys are encrypted with age to an identity that's itself locked by your passphrase. Only the sweeper and payouts processes can unlock it. The web-facing api process can encrypt newly imported keys, but never decrypt them.
Changing the passphrase means creating a new identity (coldtill init --force in a scratch directory) and re-importing the hot keys under it. That's not a five-minute job, and the docs say to plan it as a maintenance window. While it's in progress, sweeps and payouts wait. Payments are still detected and webhooks still go out, because neither of those needs a key.
The install token: replace, then re-run the installer
Standard and Pro installs download releases with an install token. Each account has one, and clicking Replace token stops the old one working immediately. The one-click updater keeps its copy in updater.env, written by install.sh, so after replacing the token, re-run the install command on the server with the new one. Otherwise the next Update click fails to download.
The one to leave alone: COLDTILL_SECRET
This is the server secret in .env. It signs sessions, seals two-factor secrets and webhook secrets in the database, and keys the payout approval codes. Change it and:
- everyone is signed out;
- stored two-factor secrets become unreadable, so every user re-enrols;
- stored webhook secrets become unreadable, so every endpoint has to be recreated and every receiver updated.
So it isn't a calendar item. The docs' advice is to rotate it only after a suspected compromise, and I agree. What you should do routinely is the opposite of rotating it: keep a copy of .env and secrets/ in encrypted offline storage, because losing .env has the same effect as changing it, without the choice.
A schedule that's actually followable
| Secret | Rotate when | Cost |
|---|---|---|
| API keys | Someone with access leaves, a key is seen anywhere it shouldn't be, or yearly | Minutes |
| Webhook secrets | Same triggers as API keys | Minutes, plus a check of failed deliveries |
| Hot wallets | Suspected exposure | An hour, mostly moving the float |
| Passphrase | Suspected exposure of the server or its backups | A maintenance window |
| Install token | It was pasted anywhere it shouldn't be | Minutes, plus re-running the installer |
COLDTILL_SECRET | Only after a suspected compromise | Re-enrolling everyone, rebuilding every webhook |
The pattern under all of it is the same: create the new thing, run both for a moment, prove the new one works, then remove the old one. The only secret that doesn't allow an overlap is the one you should almost never touch.
If you want the full detail, the install and operations docs have the rotation steps, and the webhook page covers verification in PHP, Go and Python as well as Node.

