What is TOTP
TOTP stands for time-based one-time password. It is an open standard that turns a shared secret and the current time into a short code, valid for about 30 seconds, used for signing in.
The idea behind the code
TOTP has two ingredients. The first is a secret, a random string agreed once between you and the website, usually by scanning a QR code. The second is time, counted in 30 second steps. Mix the secret with the current step through a standard formula and you get a number. Cut that number to six digits and you have the code.
Because both sides know the secret and both read the clock, both arrive at the same six digits without talking to each other. Nothing travels between the app and the site except the code you type.
TOTP is an open standard, which is why one app can hold codes for many unrelated services. It is the method inside every authenticator app, and the reason those apps can work offline in airplane mode.
A sign-in, second by second
Picture signing in to fetch the code for a 20 euro Google Play card for the Germany store, bought as a present for a nephew in Munich. You open the CryptoGift sign-in page and type your gift name.
- Your app shows 482 913 with a countdown at 12 seconds.
- You type the six digits and submit before it rolls over.
- The site computes the code for the same 30 second step using the stored secret and gets the same number.
- You are in, and the giftbox shows your order.
If you had typed the code just after it changed, the site usually allows a small margin around the current step, so a code from a moment ago may still pass. But a code from five minutes ago will not, which is what makes a stolen code nearly useless.
How TOTP protects a CryptoGift account
Your account has no password and no email. The TOTP code is the proof of who you are, alongside the gift name. On our side, the secret is stored encrypted rather than in plain text.
That setup means nobody can sign in with a list of leaked passwords, because there are none. A phishing page that tricks you into typing a code gets something that expires within the minute.
Recovery is handled by eight one-time spare codes, issued once at sign-up. They are not TOTP codes: each one is a fixed code that works a single time. Keep them offline. If the phone that holds the secret is lost, a spare code gets you in so you can set up the app again. See spare codes and the sign-in questions for those steps.
Misreadings of TOTP
People sometimes think the codes come from the internet. They do not; the phone computes them locally. That is why a code works on a plane but fails if the phone clock is wrong.
Another misreading: that the code is a password you can write down and reuse. It changes every 30 seconds, so writing it down does nothing. The thing worth protecting is the secret, which lives inside the app, and the spare codes on paper.
A third is that TOTP is the same as a text message code. Text codes are sent to a phone number and can be redirected if someone takes over the number. TOTP codes are never sent anywhere.
Last: screenshots of the setup QR code. That image contains the secret itself. Delete it after scanning, or anyone who finds it can generate your codes. The phishing entry covers related tricks.
Questions people ask
Why does my TOTP code fail only on one phone?
That phone's clock is probably out of sync. Turn on automatic date and time, then use a fresh code.
Is TOTP safer than a code by text message for a gift card shop account?
Generally yes, because the code never travels over the phone network. It is made on your device from a secret only you and the site hold.
Can I see my TOTP secret again later?
No, the setup QR code is shown during sign-up. If you need to set up a new app, sign in with a spare code and follow the account steps.