Status: second factor built (2026-10-05), by text message and by WhatsApp. Tests: packages/credentials/tests/phone.test.ts, packages/kit/tests/sms.test.ts, apps/auth-broker/tests/password-mfa.test.ts (a phone number as the second factor; WhatsApp), apps/id/tests/phone.test.ts.
A person can add a phone number to their Passkin ID and, when they sign in — to Passkin ID or to any product that uses Passkin — ask for a six-digit code by text message as their second factor. It is the weakest second factor Passkin offers, and it is built that way on purpose:
- A SIM can be swapped. Someone who talks a carrier into moving a number gets its messages. So a text is never the only thing Passkin suggests (Passkin ID's overview tells a person whose only second factor is a text to add a passkey or an authenticator app),
it is never a way to recover an account or to sign in on its own, and the token says what it was:
amr["password","sms","mfa"]— nototp, which an authenticator app earns — so a product that wants a stronger factor for a sensitive action can see the difference. - It costs money and can be abused. A flood of "text me a code" requests to numbers nobody owns (SMS pumping) is a known way to run up a bill. Every text is limited — see below — and only a number the person already confirmed is ever texted at sign-in.
What it is not: phone-number sign-in (a number as the first factor, with no email) — Passkin's accounts are email-centric today; a text for passwordless sign-in. See Not built.
WhatsApp is the same factor on another channel, for the countries where it is how people receive codes (the Middle East, South Asia, Latin America, Africa). Everything below applies to both; what differs: WhatsApp sends a one-time code only through a template Meta has approved
(the authentication category), with the code as its one variable, from a registered WhatsApp Business sender; and it is closed everywhere by default (the legal policy's whatsapp feature) until an operator records a clearance for a country.
The token says ["…","whatsapp","mfa"] — its own value, since RFC 8176 has none for it — and a session remembers it (password+wa).
What a person sees
Passkin ID → Security → Phone number (the three languages): type the number with its country code (+1 415 555 0123; 0044… works, a number without a + is refused — a guess at a country is a guess at who is texted), get a code,
type it to confirm. The first confirmed second factor comes with recovery codes, shown once. Up to three numbers. The page shows ••• 0123 · US, never the number; removing one needs a recent sign-in, like every change to how a person gets in,
and leaves a notice in their inbox and a line on their activity (Phone number added / removed).
At sign-in, after the password or the emailed code (not after a passkey), the second-factor page shows Text a code to ••• 0123. The person presses it; the code arrives; they type it. The site's name is in the message ("123456 is your Acme code. It works for 10 minutes. Never share it: nobody will ask you for it."), in the person's language. A person who also has an authenticator app, or recovery codes, can use those instead, on the same page.
The end-user API says it too: GET /v1/me → security.has_phone; the profile components show a row for it (@passkin/react, @passkin/elements).
How a code is kept and checked
- The number is encrypted at rest (AES-GCM, like every stored secret); a keyed hash of it exists for limits and for not adding the same number twice; only the last four digits and the country are stored in the clear, for screens.
- A code is six digits from a cryptographic source, stored only as a keyed hash, good for ten minutes, for one use, with five wrong guesses (then it is void and a new one must be asked for). Two requests carrying the same right code: one wins.
- A new code cannot be asked for within thirty seconds of the last (unless that one was used, or never left). Wrong guesses count against every code outstanding.
- A code is checked among the other second factors (
verifySecondFactor): an authenticator code, a recovery code, or a texted code. - It leaves with the account: export lists the last four digits and the country, never the number; deleting the account deletes the rows.
What limits it
| Limit | Where |
|---|---|
| 10 texts a day to one person | per passport |
| 20 an hour from one address | per IP |
| 5 an hour to one number (when adding) | per number, by keyed hash |
SMS_MAX_PER_HOUR (default 300) in the whole service |
a ceiling on what a flood can cost; reaching it is logged (sms_hourly_limit_reached) |
| the country | the legal policy — below |
Where messages may go: the legal policy
Whether a text may be sent depends on where it lands (sender registration, opt-in, carrier rules — legal/REGISTER.md §4). The sms feature of the legal policy engine (VERIFIED.md describes the engine) is asked about
the number's own country, read from its calling code — and, in the +1 plan (the US, Canada and a dozen Caribbean countries with very different rules and prices), from its area code. It is asked every time: a number confirmed while a
country was open stops being texted when the policy closes it.
- Texts, allowed by default: the US, Canada, the UK and the EEA (a one-time code is a transactional message; the developer's sign-up flow gives the opt-in).
- Texts, closed by default: everywhere else, and any number whose country Passkin does not know (the Caribbean +1 numbers, an unlisted calling code) — no sender registration is in place.
- WhatsApp, closed by default everywhere (
feature: "whatsapp"): no compliant messaging route is set up. An operator opens a country once the WhatsApp Business account and the authentication template are approved there, with a clearance. The two features are independent: a country can be open for texts and closed for WhatsApp, or the reverse. A button is shown only for the channels that are configured here and open for that number's country. - An operator opens a country with a row and a reason (Operator → Legal policy in the dashboard, or
POST /v1/manage/operator/legal/overrides):feature: "sms", scope: "SA", effect: "allowed", reason, clearance— a clearance (counsel's reference, or the sender-ID registration) is needed to loosen a default, none to tighten. History is kept.
Switching it on (an operator, once)
SMS is off until a transport is configured — nothing is texted by accident in development. In the broker and in Passkin ID (the same variables):
| Variable | |
|---|---|
SMS_TRANSPORT |
twilio, webhook or console (development only; refused in production). Unset: whichever of Twilio or the webhook is configured |
TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN |
Twilio's Messages API, as the account |
TWILIO_MESSAGING_SERVICE_SID |
recommended: the messaging service holds your registered sender (US A2P 10DLC brand and campaign, alphanumeric sender IDs where a country wants them) |
TWILIO_FROM |
a plain sender number, when there is no messaging service |
TWILIO_WHATSAPP_FROM, TWILIO_WHATSAPP_CONTENT_SID |
WhatsApp through Twilio: your registered sender (+14155238886 or whatsapp:+14155238886) and the approved authentication template's Content SID (its one variable, {{1}}, is the code). Both, or neither. WhatsApp can be configured without texts (no TWILIO_FROM/messaging service), or beside them |
SMS_WEBHOOK_URL, SMS_WEBHOOK_SECRET |
any other provider: a signed POST (Passkin-Signature, the same scheme as the mail webhook; { "type": "one_time_code", "channel": "sms" | "whatsapp", "to", "country", "text", "code"? } — code is the bare code, sent for WhatsApp), https in production, a secret of at least 32 characters |
SMS_WEBHOOK_WHATSAPP |
true when your webhook also handles channel: "whatsapp" (otherwise only texts are offered) |
SMS_MAX_PER_HOUR |
the whole-service ceiling (default 300) |
The service refuses to start in production with a transport that is half set up, and says which variable is missing. With no transport, the second-factor page does not offer texting and Passkin ID says Text messages are not available right now — a person whose only second factor is a number then uses a recovery code, which is why recovery codes come with the first factor.
Before the first text in a country: register the sender (US: A2P 10DLC brand and campaign, STOP/HELP handled by the messaging service), and have counsel sign off on the opt-in wording your terms give (legal/REGISTER.md §4).
Not built
Phone-number sign-in (a number as the first factor; the passport model is email-centric, and a phone-only account needs a different recovery story), WhatsApp through a provider other than Twilio's API or your own webhook (Meta's Cloud API directly), WhatsApp when the person does not use it (a number that is not on WhatsApp simply never receives the code: they use the text, or a recovery code), voice calls, per-project
phone settings (every project with a second-factor-capable sign-in method gets it; a project cannot yet require a phone), SIM-swap signals from a carrier (Twilio Lookup, GSMA Mobile Connect) to refuse a number swapped in the last days, number-reputation checks (line type, VoIP/prepaid risk) before
the first text, toll-fraud pricing guard per destination (the whole-service cap is the floor), Android SMS Retriever / iOS one-time-code hints beyond the browser's autocomplete="one-time-code".