A visitor with no account
How dansabin.com keeps a chat yours with no login, through an anonymous signed identity, a key the browser can use but can't carry away, and data you can delete yourself.
Key points
A visitor gives no name, email or password to start chatting.
Passing the human check gives the visitor an anonymous signed token.
That token is bound to a key held in the browser, so a stolen token isn't enough on its own.
A chat belongs to that browser and doesn't follow the visitor to another device.
The problem
I don't want the barrier of entry to be so high. After all, it's a product I want people to use. I don't need their personal information, and it's a challenge to myself to design a solution that works without it. So visitors come in with no login, and the site generates a session for them. That leaves a question I had to ask of my own design: without some kind of user and password, how do we stop people stealing or hijacking each other's chats?
How a visitor gets an identity
- The visitor passes the WAF CAPTCHA, the one-time human check.
- The browser makes a key pair with Web Crypto, and the API issues a signed token bound to its public key.
- Every later request carries the token and a proof signed by the device key over that request, within 2 minutes of the system's clock.
A request with a token but no valid proof is rejected as if it had no token at all.
The device key
I want visitors to feel safe enough to use the project, and to know that only they and I can see their chats. The device key is what protects a visitor's chats from being hijacked.
The private key is created as non-extractable and kept in IndexedDB. A script on the page can use it but can never carry it away. So stealing the token gets an attacker nothing without the browser that holds the key.
This does lean on the visitor's device being the authentication and authorization layer. If I wanted more security, I'd need more information from them, and that's where the line is drawn.
Some private windows refuse IndexedDB. The key is then held in memory, the identity works until the visitor leaves or reloads the page, and the page says so.
Signing keys that rotate
The keys that sign tokens live in Secrets Manager and rotate every 14 days. The rule was that current, pending and past keys all work, so that authentication is never dropped by a rotation. Retired keys are kept for verification for 370 days, so a visitor returning within the retention period can renew the same identity. Signing keys replicate to the second region, so a token issued in one region is accepted in the other.
What a visitor can lose
| What happens | What the visitor gets |
|---|---|
| The token expires, and the browser still holds the key | Pass the check again, and the same identity is renewed, with its chats and allowance |
| The browser loses the key | Pass the check again, and get a new identity. Earlier chats can't be opened again |
| A private window closes | Its chats end |
A visitor who loses their chat when they switch devices is OK. It's proof of where the boundary is. A cross-device link is possible if that turns out to be important, but as it stands, this shows exactly how much information I don't keep. The site says so near the chat and in the privacy notice.
Sharing and keeping
Chats are saved per visitor in DynamoDB and S3. The API can make a read-only link to a chat, but the site has no control for it yet, so a visitor can't share a chat today. A visitor's whole set of chats is deleted after 1 year without a visit.
Deleting your data
A visitor who wants their data gone can't be asked for an ID they don't know, and I wouldn't know it either. So the privacy notice has a "Delete my data" control, which works from the browser that holds the identity. It deletes every chat, any share links to them and the contact details left in those chats.
A person asking by email is a different case, because I have to verify they own the address they want deleted. The privacy notice promises that within 30 days.
No IP addresses are stored with conversations.
Design decisions and trade-offs
| Decision | Chosen over | Why | Trade-off |
|---|---|---|---|
| Anonymous identity | Accounts | A visitor can start with nothing, and I don't need their personal information | A chat can't follow a person to a second device |
| A device key bound to the token | A token alone | A stolen token isn't enough | Losing the key loses the identity |
| Non-extractable key in IndexedDB | A secret a script can read | A script can use the key but not take it | Private windows may hold it only in memory |
| Current, pending and past signing keys | One key at a time | A rotation never ends a live identity | Old keys stay valid for verification for a long time |
Want the details?
Ask the window anything this page skips.