# `OneTimeCode`

The code a person types from an authenticator app, a text message or an email (RFC 4226 and RFC 6238): six to eight digits, a leading zero kept. A secret value, checked when it arrives and never kept.

[Security](types.md#security); not ordered; since Jadpo 0.1.0.

## Make one

It comes from outside your code, a secret value that never appears in it.

`text.parse(raw, as: OneTimeCode)` reads one from its text; text that isn't one at all fails `malformed`, such as `28708`, `942870820` or `287 082`.

## Text, JSON and storage

`text.parse` reads one from its text, as it is typed. Nothing writes it: `text.from` and `text.format` don't take it, JSON writes it as `"<redacted OneTimeCode>"`, and it is never stored.

## Shown to people

`text.format` doesn't take it: a `OneTimeCode` is never shown.

## Operations

It has the contract's own operations: `text.parse`, `json.read`, `json.write` and `==`. It isn't ordered, so `<` and sorting don't take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
