LanguageValues and typesStandard typesSecurity
OneTimeCode
On this page
A code a person types from an app, a text or an email: six to eight digits.
Use it for what arrives on a form. Check it when it arrives and don't keep it. For the secret behind an app, use TotpSecret.
Shape
One secret value, with no parts.
Example
OneTimeCode("287082")In a real app it arrives from outside, such as in a request, rather than as text you write in your code.
text.parse(raw, as: OneTimeCode) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 28708, 942870820 or 287 082.
Good to know
- It is text, so a leading zero is kept.
==tells you whether two are the same.<andlist.sort_bydon't take it.
In JSON
A string when it arrives, and written redacted when it leaves, in a request, a response or json.write:
"<redacted OneTimeCode>"Details
Text form, storage, how it is shown, and operations
OneTimeCode is in the group Security, and has been in Jadpo since 0.1.0.
Text form
text.parse reads one from its text as it is typed. text.from and text.format don't take it, so nothing writes it.
How it is stored
It is never stored.
How it is shown to people
text.format doesn't take it: a OneTimeCode is never shown.
Operations
It also takes text.parse, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-one-time-code.md.Built from Jadpo main at aee2e8f.