After a mailbox takeover at one of our email customers, we had to give the company 26 new passwords at once. Email was the compromised channel. A chat message would keep every password in two phones' history forever. So we built a small thing instead: a link that opens exactly once, only after a WhatsApp code sent to one specific phone, and then erases its contents. It is about 200 lines of code, it has no new dependencies, and it is now how we hand over any secret.
TL;DR
- The secret is sealed with AES-256-GCM on our server. The URL carries a random token; the server stores only its SHA-256 hash.
- Opening the link sends a 6-digit code by WhatsApp to the phone the link was made for, never to a number the visitor types. Only that phone can open it.
- A correct code returns the payload once and deletes the ciphertext in the same write. A second visit says "already opened".
- Viewing the page does nothing. Only the code check burns the link, so chat-app link previews and a curious second tap cannot destroy it.
- Limits: 72-hour expiry, 3 codes per 15 minutes, 5 wrong tries per code, 10-minute code lifetime.
The problem
Every support team eventually has to send someone a password. The usual channels all fail in the same way: they keep a copy.
- Email keeps it in two mailboxes, plus backups. In our case email was the very thing that had just been compromised.
- WhatsApp or SMS messages keep it in both phones' history and in their cloud backups. Whoever unlocks either phone later reads it.
- A shared document keeps it until someone remembers to delete it, which is never.
What we wanted was simple to say: the secret should exist in exactly one place until the right person reads it, and in zero places after.
Why not a password manager or a paste service?
Shared vaults in a password manager are the right answer inside a team that already uses one. Our customers are small companies; the person receiving 26 mailbox passwords is an office manager who does not have, and will not install, a password manager for one handover.
One-time paste services solve the "zero copies after" part, but anyone who gets the link can open it. If the link leaks (forwarded by mistake, or read over a shoulder) the secret leaks with it. We wanted a second factor that the recipient already has, and in Egypt that is WhatsApp. Every business owner has it, and it is tied to a phone number we already have on file.
The design
Creating a link
An operator runs a command on the server with the recipient's phone number, a title and a file of accounts. The command seals the payload and prints the link, and nothing else. The secret file is read, sealed, and never echoed.
function create({ phone, title, recipient, payload, hours = 72 }) {
const id = crypto.randomBytes(6).toString('hex');
const token = crypto.randomBytes(24).toString('base64url'); // goes in the URL only
S.update(d => d.items.push({
id, token_hash: sha(token), phone, title, recipient,
expires_at: new Date(Date.now() + hours * 3600e3).toISOString(),
opened_at: null, payload_enc: seal(id, payload), sends: [], otp: null,
}));
return { id, token };
}
Sealing uses AES-256-GCM with a key that lives only in the service's environment. The link's own id is passed as additional authenticated data, so a ciphertext copied from one link's record into another's will fail to decrypt rather than open under the wrong title.
Opening a link
The page shows the title, the recipient's name and the last four digits of the phone it will text. One button: "Send me the code on WhatsApp". The server generates a 6-digit code, stores only a salted hash of it with a 10-minute expiry, and sends it through a WhatsApp authentication template (the kind with a copy-code button).
async function sendCode(token) {
const it = byToken(token);
if (state(it) !== 'ready') return { ok: false, reason: state(it) };
const recent = it.sends.filter(t => Date.now() - Date.parse(t) < 15 * 60e3);
if (recent.length >= 3) return { ok: false, reason: 'rate' };
const code = String(crypto.randomInt(0, 1e6)).padStart(6, '0');
await sendWhatsApp(it.phone, code); // the link's phone, never a typed one
// store hash(code + id), expiry, tries = 0
}
The verify step checks the code, and on success decrypts, returns the payload and clears the ciphertext in the same write. There is no window where the link is marked opened but the data is still on disk, or the other way round.
const payload = open(it.id, it.payload_enc);
S.update(d => {
const x = d.items.find(y => y.id === it.id);
x.opened_at = nowIso(); x.payload_enc = null; x.otp = null;
});
return { ok: true, payload };
The page
The browser builds the result with textContent only, never innerHTML, so a password containing markup is displayed, not executed. Every value has a copy button. The page ends with a plain warning: this will not open again, save it now. The response is sent with Cache-Control: no-store, so the browser does not keep it in its cache.
What we learned building it
Do not burn on view. The tempting design is "the first GET shows the secret and deletes it". It fails in practice. Our audit log for the first link shows the page was loaded six times before anyone asked for a code: once in the minute it was created, once later that day, and four times the next morning before the recipient pressed the button. We cannot tell which loads were people and which were previews or a second device, and that is the point. If viewing had burned the link, the first of those loads would have destroyed it. Now a GET only shows the "send me the code" screen; only a correct code opens it.
Test without sending real messages. The service can write the code to a local file instead of calling WhatsApp. Our first attempt to run a test copy with that setting passed it on the command line, and the service's own environment file silently overrode it. The fix was to give the test copy its own environment file, with a different port and data folder. If you add a mock switch, check that it actually took effect before the first test send.
An unused code path. The page also listens for an SMS code through the browser's WebOTP API. That only works for SMS, and these codes arrive by WhatsApp, so on this page it never fires. Pasting or the WhatsApp copy-code button does the work. We left it in for the day we add SMS delivery, and noted it here rather than claiming it helps.
Result
- Two links issued so far; both opened once, by the intended phone, and both now hold no ciphertext.
- From "code sent" to "link opened" took 9.5 and 7.4 seconds. The second factor added seconds, not a support call.
- No wrong-code attempts were recorded on either link.
- The passwords never appeared in an email, a chat thread or our own logs. The service logs that an open happened, not what was in it.
The sample is small and we say so. The value is not in the numbers but in what is no longer anywhere: after the open, a stolen server backup or a stolen phone holds nothing.
Checklist for your own version
- Store a hash of the URL token, never the token itself.
- Encrypt the payload with an authenticated cipher and bind it to the record's id.
- Send the second factor to a phone fixed at creation time. Never let the visitor choose where the code goes.
- Rate-limit code sends per link and per IP, cap wrong tries per code, expire codes in minutes and links in days.
- Burn on successful verification, not on view. Clear the ciphertext in the same write that marks it opened.
- Render with
textContent, sendno-store, and tell the user plainly that the page will not open again. - Log events (viewed, code sent, opened), never payloads or codes.
Need this?
This handoff link is part of how GeoTech runs managed email and incident response for small businesses, alongside GeoTech Sentinel, which watches mail servers for password spraying and stolen logins. If you need to move credentials to customers safely, or you have just had an incident and need to rotate everything quickly, talk to GeoTech.