A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
docs: document sudo email codes and SSO, drop passkey migration
Hampus14ee9939c1b0
diff --git a/fluxer_docs/src/content/docs/http-api/channels.mdx b/fluxer_docs/src/content/docs/http-api/channels.mdxindex 52013c303..68e53cfee 100644--- a/fluxer_docs/src/content/docs/http-api/channels.mdx+++ b/fluxer_docs/src/content/docs/http-api/channels.mdx@@ -425,14 +425,6 @@ Modifies a guild channel or a group direct message and returns the updated [chanThe submitted array becomes the complete overwrite collection of the channel.:::-[Set channel permission overwrite](#set-channel-permission-overwrite) and [Delete channel permission overwrite](#delete-channel-permission-overwrite) each change one overwrite and leave the rest untouched.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel to modify |-### Request headers| Field | Type | Description |@@ -607,12 +599,6 @@ Deletes a guild channel, closes a direct message, or removes the caller from a gDeleting a guild channel destroys the channel record, every message in it, every stored attachment of those messages, its invites, its webhooks, and every thread in it. There is no pending state, no grace period, and no restore.:::-### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| channel_id | snowflake | The ID of the channel to delete, close, or leave |-### Query parameters| Field | Type | Description |@@ -639,16 +625,12 @@ The body is optional. Fluxer reads it only when `delete_messages` is set and no| Field | Type | Description || --- | --- | --- || password?<sup>1</sup> | string | The account password, offered as the sudo proof |-| mfa_method?<sup>2</sup> | string | The verification method, either `totp` or `webauthn` |+| mfa_method?<sup>2</sup> | string | The verification method, one of `totp`, `webauthn` or `email_code` || mfa_code? | string | The authenticator code or an unconsumed backup code (1-32 characters), supplied with the `totp` method || webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | The WebAuthn assertion for sudo verification || webauthn_challenge? | string | The challenge (1-256 characters) bound to the sudo mode assertion |--<sup>1</sup> Accepted only for an account holding no TOTP secret and no registered WebAuthn credential. A rejected password returns 400 `INVALID_FORM_BODY` with the code `INVALID_PASSWORD` on the path `password`--<sup>2</sup> Accepted only for an account holding a TOTP secret or a registered WebAuthn credential. The `totp` method reads `mfa_code` as a backup code alone while the account holds no TOTP secret. A rejected code or assertion returns 400 `INVALID_FORM_BODY` with the code `INVALID_MFA_CODE` on the path `mfa_code`--An account that stores no password, no TOTP secret, and no registered WebAuthn credential is verified without any proof.+| email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) |+| email_code? | string | The 6-digit code from that email |### Responsediff --git a/fluxer_docs/src/content/docs/http-api/guild-members.mdx b/fluxer_docs/src/content/docs/http-api/guild-members.mdxindex 52e084a26..501cc30a8 100644--- a/fluxer_docs/src/content/docs/http-api/guild-members.mdx+++ b/fluxer_docs/src/content/docs/http-api/guild-members.mdx@@ -18,8 +18,6 @@ A request whose target is not a member returns 404 `UNKNOWN_MEMBER` whether or n## Guild member object-Every field except `user` describes state that belongs to the membership.-### Structure| Field | Type | Description |@@ -70,10 +68,6 @@ A client compares `communication_disabled_until` against the current time, becau}```-:::note[List and direct reads can briefly differ]-[Get current guild member](#get-current-guild-member), [Get guild member](#get-guild-member), and both modify operations recompute `mute` against the current time. In [List guild members](#list-guild-members) an expired timeout can leave `mute` true until that membership next changes.-:::-## Guild member profile flagsA guild profile asset has these states. A membership with no flag and no stored hash inherits the account-level asset. A stored hash sets a guild-specific asset. Each flag below blocks inheritance, so the client shows the default asset.@@ -163,8 +157,6 @@ This route checks no permission bit, including [VIEW_CHANNEL_MEMBERS](/http-api/| Status | Body | Condition || --- | --- | --- || 200 | array[[guild member](#guild-member-object) object] | Members were returned |-| 403 | [error response](/http-api/#error-response) | Guild is unavailable, or the caller is not a member |-| 404 | [error response](/http-api/#error-response) | Guild does not exist and the request returns `UNKNOWN_GUILD` |### Rate limit@@ -433,10 +425,12 @@ The operation requires the [sudo verification fields](/http-api/guilds/#sudo-ver| --- | --- | --- || new_owner_id | snowflake | The ID of the member to make the new owner || password? | string | The current owner password, as defined by the [sudo verification fields](/http-api/guilds/#sudo-verification-fields) |-| mfa_method? | string | The second factor to verify, either `totp` or `webauthn` |+| mfa_method? | string | The second factor to verify, one of `totp`, `webauthn` or `email_code` || mfa_code? | string | The authenticator code, required when the method is `totp` (1-32 characters) || webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | The assertion produced when the method is `webauthn` || webauthn_challenge? | string | The challenge bound to the WebAuthn assertion |+| email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) |+| email_code? | string | The 6-digit code from that email |### Responsediff --git a/fluxer_docs/src/content/docs/http-api/messages.mdx b/fluxer_docs/src/content/docs/http-api/messages.mdxindex 3563c67b1..176373b0a 100644--- a/fluxer_docs/src/content/docs/http-api/messages.mdx+++ b/fluxer_docs/src/content/docs/http-api/messages.mdx@@ -22,8 +22,6 @@ The message read, create, modify, and delete routes, [Bulk delete messages](#bul## Message object-A message object is the full stored form of one post in a channel.-### Structure| Field | Type | Description |@@ -161,8 +159,6 @@ A caller other than a bot or a user session that declares the [`channel_threads`## Message attachment object-An attachment is one file stored against a message and served from media delivery.-### Structure| Field | Type | Description |@@ -259,8 +255,6 @@ A client treats a data package URL as never expiring and does not refresh it bef## Emoji object-An emoji is either a custom guild emoji identified by ID or a standard Unicode emoji.-### Structure| Field | Type | Description |@@ -273,8 +267,6 @@ An emoji is either a custom guild emoji identified by ID or a standard Unicode e## Reaction object-A reaction object summarises one emoji group on a message. Fluxer has ordinary reactions only.-### Structure| Field | Type | Description |@@ -305,8 +297,6 @@ Each message has at most the resolved `max_reactions_per_message` distinct group## Message reference object-A message reference names the message that a reply points at, that a forward was taken from, or that a copy was published from. A `THREAD_CREATED` message references its thread, and a `THREAD_STARTER_MESSAGE` references the message its thread started from, as [Thread messages](/http-api/threads/#thread-messages) describes.-### Structure| Field | Type | Description |@@ -316,8 +306,6 @@ A message reference names the message that a reply points at, that a forward was| guild_id? | snowflake | The ID of the referenced guild, present only for a guild message || type | integer | [Message reference type](#message-reference-types) |-<sup>1</sup> Absent on a `CHANNEL_FOLLOW_ADD` and on a `THREAD_CREATED` [system message](#message-types). Each of those references names a channel and no message-## Message reference types| Value | Name | Description |@@ -333,8 +321,6 @@ A message reference names the message that a reply points at, that a forward was## Message reference input object-A message reference input names the source message a create request replies to or forwards.-### Structure| Field | Type | Description |@@ -378,8 +364,6 @@ Every optional field above is omitted entirely.## Message call object-A message call has the participants and end time of the call that a `CALL` message records.-### Structure| Field | Type | Description |@@ -389,8 +373,6 @@ A message call has the participants and end time of the call that a `CALL` messa## Channel mention object-A channel mention names one channel that the message content links by ID.-### Structure| Field | Type | Description |@@ -401,8 +383,6 @@ A channel mention names one channel that the message content links by ID.## Sticker item object-Each sticker item is the trimmed sticker record on a message.-### Structure| Field | Type | Description |@@ -449,7 +429,6 @@ Every optional field above is omitted entirely.{"type": "rich","title": "Release 2.4.0",- "description": "Voice reconnects are now instant.","url": "https://example.com/releases/2.4.0","color": 5793266,"footer": {"text": "example.com"},@@ -526,8 +505,6 @@ Fluxer signs every other embed field that can hold an attachment URL of this ins## Embed provider object-Only an embed the unfurler builds from a link has a provider. A rich embed input cannot set one.-### Structure| Field | Type | Description |@@ -558,8 +535,6 @@ An allowed mentions object selects which mentions written in the message text beSending `allowed_mentions` as `{}` resolves to an empty parse set, so no user mention, role mention, `@everyone`, or `@here` becomes active. Omitting the object does the opposite.:::-`mention_everyone` is forced to false whenever the caller lacks `MENTION_EVERYONE`, without failing the request.-## Allowed mention parse values| Value | Description |@@ -711,8 +686,6 @@ An upload key can be referenced only by a message that the same identity creates### Attachment upload request item object-One declared upload inside a [Request attachment upload URLs](#request-attachment-upload-urls) body.-#### Structure| Field | Type | Description |@@ -768,8 +741,6 @@ Returned when the declared `file_size` exceeds 10 MiB.### Attachment upload part object-One presigned part of a multipart upload plan.-#### Structure| Field | Type | Description |@@ -781,8 +752,6 @@ One presigned part of a multipart upload plan.### Multipart upload completion item object-One planned upload named in a [Complete attachment upload](#complete-attachment-upload) body.-#### Structure| Field | Type | Description |@@ -792,8 +761,6 @@ One planned upload named in a [Complete attachment upload](#complete-attachment-## Refreshed attachment URL object-One result of [Refresh attachment URLs](#refresh-attachment-urls).-### Structure| Field | Type | Description |@@ -814,8 +781,6 @@ To sign a URL, Fluxer removes every `ex`, `is`, `hm`, and `uc` parameter and eve## Channel pin object-A channel pin pairs one pinned message with the time it was pinned.-### Structure| Field | Type | Description |@@ -1668,8 +1633,6 @@ Deletes from 1 through 100 messages in one guild channel. Returns 204 with an em### JSON body-At least one of the fields below must be present. Supplying neither fails with 400 `INVALID_FORM_BODY` on the path `message_ids`, and supplying both uses `message_ids` and ignores `messages`.-| Field | Type | Description || --- | --- | --- || message_ids?<sup>1</sup> | array[snowflake] | Message IDs to delete, at most 100 entries |@@ -1786,10 +1749,12 @@ The deletion runs inside the request despite the 202 status, so every matching m| Field | Type | Description || --- | --- | --- || password?<sup>1</sup> | string | Account password proof |-| mfa_method?<sup>2</sup> | string | MFA method, one of `totp` or `webauthn` |+| mfa_method?<sup>2</sup> | string | MFA method, one of `totp`, `webauthn` or `email_code` || mfa_code? | string | Authenticator code (1-32 characters), supplied with the `totp` method || webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | WebAuthn assertion for sudo verification || webauthn_challenge? | string | Challenge bound to the sudo mode assertion |+| email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) |+| email_code? | string | The 6-digit code from that email |<sup>1</sup> Accepted only when the account has no enrolled authenticator, and an incorrect password fails with the field code `INVALID_PASSWORD`. An account with neither a stored password nor an enrolled authenticator never reaches this check@@ -2405,8 +2370,6 @@ Advances the authenticated user's read state through one message. Returns 204 wi### JSON body-An empty body is read as `{}`, and `{}` is the minimal valid form.-| Field | Type | Description || --- | --- | --- || mention_count?<sup>1</sup> | integer | Mention count to store for the channel (0-2,147,483,647, default `0`) |diff --git a/fluxer_docs/src/content/docs/http-api/users/content.mdx b/fluxer_docs/src/content/docs/http-api/users/content.mdxindex e273e504c..c7ec66de7 100644--- a/fluxer_docs/src/content/docs/http-api/users/content.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/content.mdx@@ -233,14 +233,6 @@ The caller needs access to the channel and to the message.| channel_id<sup>1</sup> | snowflake | The channel containing the message || message_id | snowflake | The ID of the message to save |-<sup>1</sup> The saved entry retains this channel ID verbatim--### Collection limit--An account holds at most the instance-configured `max_bookmarks` [limit](/http-api/instance/#limit-keys) entries. Fluxer resolves the account's effective value on every save, and the default is 50. Reaching the ceiling fails with 400 `MAX_BOOKMARKS`, whose body has `max_bookmarks` reporting the ceiling.--The check runs before Fluxer touches the channel or the message, so re-saving an already stored message is refused at the ceiling too.-### Response| Status | Body | Condition |@@ -316,26 +308,12 @@ The caller proves sudo mode either with the sudo fields below or with an existin| start_date?<sup>4</sup> | ?ISO8601 timestamp | The inclusive lower bound on message time, or null for no lower bound || end_date?<sup>4</sup> | ?ISO8601 timestamp | The exclusive upper bound on message time, or null for no upper bound || password?<sup>5</sup> | string | The account password (8-256 characters) |-| mfa_method?<sup>5</sup> | string | The sudo MFA method, either `totp` or `webauthn` |+| mfa_method?<sup>5</sup> | string | The sudo MFA method, one of `totp`, `webauthn` or `email_code` || mfa_code?<sup>5</sup> | string | The sudo authenticator code, or an unconsumed backup code (1-32 characters) || webauthn_response?<sup>5</sup> | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | The sudo WebAuthn assertion || webauthn_challenge?<sup>5</sup> | string | The sudo WebAuthn challenge (1-256 characters) |--<sup>1</sup> Independent of `include_dms`, so setting `include_dms` false and `include_dms_closed` true targets closed direct messages only--<sup>2</sup> Under the `selected` scope a group DM is eligible only while the caller is still a recipient, and a guild channel only while the caller is still a member--<sup>3</sup> Evaluated only while `include_guilds` is true and `scope` is `selected`--<sup>4</sup> Supplying both bounds requires `start_date` strictly earlier than `end_date`, and an equal pair fails validation on `end_date`--<sup>5</sup> These fields are the [sudo verification object](/http-api/users/mfa/#sudo-verification-object). Which combination is accepted depends on whether the account holds a TOTP secret or a registered WebAuthn credential--The `selected` scope requires at least one of the context toggles to be true, and a request that disables them all fails validation on `include_dms`. The `inaccessible_only` scope ignores the toggles and the guild filter.--Neither scope includes the caller's personal notes channel, so this operation cannot delete a personal note.--[Request filtered data harvest](/http-api/users/data-harvest/#request-filtered-data-harvest) accepts the same filter shape and applies it to the messages an archive contains. That operation requires no sudo mode.+| email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) |+| email_code? | string | The 6-digit code from that email |### Response@@ -420,7 +398,6 @@ No sudo verification applies. An account with no pending deletion still returns| Status | Body | Condition || --- | --- | --- || 200 | response body | The pending deletion, if any, was cancelled |-| 500 | [error response](/http-api/#error-response) | The cancellation could not be applied |### Side effectsdiff --git a/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdx b/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdxindex 160283b52..89b06a84e 100644--- a/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/email-and-password.mdx@@ -12,6 +12,8 @@ Every operation needs a non-bot user session.An instance where members sign in with a username, which reports `account_identity` as `username` in its [instance features](/http-api/instance/#instance-features-object), keeps no email address on any account. There every email change and password change route on this page returns 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`. [Set a new password](#set-a-new-password) changes the password under sudo mode, and the [recovery kit](#recovery-kit-object) routes give the account a way back after a forgotten password. Those three routes exist only on such an instance, and an `email` instance returns 400 `USERNAME_SIGN_IN_ONLY` from each.+While an `email` instance [enforces single sign-on](/authentication/#single-sign-on-enforcement), the provider manages the email address and sign-in of every account linked to it. Every email change and password change route on this page returns 403 `SSO_REQUIRED` for such an account, before any ticket is read, and the account takes the provider's verified email the next time it signs in.+## Ticket and code contractA ticket identifier is a version 4 UUID. Fluxer issues it when the flow starts, and every later step sends it as a plain string of 1 to 256 characters. Each ticket belongs to one account, and a step sent by another account fails with `INVALID_OR_EXPIRED_TICKET`. A completed ticket rejects every further step with `TICKET_ALREADY_COMPLETED`. Starting a flow again issues a fresh ticket and leaves an outstanding one usable.@@ -135,8 +137,6 @@ The state of a ticket with a candidate address bound to it and a code sent to th## Original email verification object-The proof that a ticket has cleared its original address stage.-### Structure| Field | Type | Description |@@ -147,8 +147,6 @@ The proof that a ticket has cleared its original address stage.## New email verification object-The email token a completed email change ticket returns.-### Structure| Field | Type | Description |@@ -173,8 +171,6 @@ The state of a newly created password change ticket.## Password verification object-The proof that the emailed code was accepted.-### Structure| Field | Type | Description |@@ -200,8 +196,6 @@ The replacement session [Complete password change](#complete-password-change) re## Recovery kit status object-Whether the account has a recovery kit. The key itself is never readable after it is issued.-### Structure| Field | Type | Description |@@ -220,8 +214,6 @@ A newly issued recovery kit. [Recover an account](/http-api/authentication/#reco| recovery_key<sup>1</sup> | string | The recovery key, 8 groups of 4 characters joined by `-` || created_at | ISO8601 timestamp | When the kit was created |-<sup>1</sup> The key is 32 characters from the Crockford base32 alphabet, which has the digits and every uppercase letter except `I`, `L`, `O` and `U`. This response is the only way to read it-## Start email change<RouteHeader method="POST" path="/v1/users/@me/email-change/start" />@@ -319,6 +311,7 @@ Fluxer trims the address and then checks it in order.- An empty address fails with `EMAIL_IS_REQUIRED`.- An address equal to the ticket's recorded original fails with `NEW_EMAIL_MUST_BE_DIFFERENT`.+- An address on a domain missing from the instance's allowed email domains fails with `EMAIL_DOMAIN_NOT_ALLOWED`.- A domain that publishes no mail exchange or address records fails with `EMAIL_DOMAIN_CANNOT_RECEIVE_MAIL`.- An address another account already owns fails with `EMAIL_ALREADY_IN_USE`.@@ -441,10 +434,12 @@ The body extends the [sudo verification object](/http-api/users/mfa/#sudo-verifi| --- | --- | --- || email_token | string | The token returned by [Verify new email](#verify-new-email) (1-256 characters) || password?<sup>1</sup> | string | The account password (8-256 characters) |-| mfa_method?<sup>2</sup> | string | The sudo MFA method, either `totp` or `webauthn` |+| mfa_method?<sup>2</sup> | string | The sudo MFA method, one of `totp`, `webauthn` or `email_code` || mfa_code?<sup>3</sup> | string | The sudo authenticator code or an unconsumed backup code (1-32 characters) || webauthn_response?<sup>4</sup> | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | The assertion produced for the supplied challenge || webauthn_challenge?<sup>4</sup> | string | The challenge returned by [create sudo WebAuthn authentication options](/http-api/users/mfa/#create-sudo-webauthn-authentication-options) (1-256 characters) |+| email_code_ticket? | string | The ticket from [send a sudo email code](/http-api/users/mfa/#send-a-sudo-email-code) (1-128 characters) |+| email_code? | string | The 6-digit code from that email |<sup>1</sup> Considered only while the account holds no TOTP secret and no registered WebAuthn credential, and ignored once either exists@@ -684,7 +679,7 @@ The ticket moves to its verified state and stores a verification proof. The accoConsumes a verified ticket and replaces the account password. Returns a [password change completion](#password-change-completion-object) object on success. Emits an [Auth Session Change](/gateway/events/#auth-session-change) Gateway event with the replacement token.-No sudo verification applies. A ticket outside its verified state fails with `INVALID_OR_EXPIRED_TICKET`. A proof that does not match fails with `INVALID_PROOF_TOKEN`. A replacement password in the public breached-password corpus is rejected with `PASSWORD_IS_TOO_COMMON`. The ticket is marked completed once the password is written, so a retry fails with `TICKET_ALREADY_COMPLETED`.+An account with a second factor, meaning the TOTP or WebAuthn [authenticator type](/http-api/users/#authenticator-types), must also prove [sudo mode](/http-api/users/mfa/#sudo-mode) with that factor, because the emailed code alone would let whoever reads the mailbox take the account. Other accounts need no sudo verification. A ticket outside its verified state fails with `INVALID_OR_EXPIRED_TICKET`. A proof that does not match fails with `INVALID_PROOF_TOKEN`. A replacement password in the public breached-password corpus is rejected with `PASSWORD_IS_TOO_COMMON`. The ticket is marked completed once the password is written, so a retry fails with `TICKET_ALREADY_COMPLETED`.### JSON body@@ -693,12 +688,20 @@ No sudo verification applies. A ticket outside its verified state fails with `IN| ticket | string | The identifier returned by [Start password change](#start-password-change) (1-256 characters) || verification_proof | string | The proof issued by [Verify password change code](#verify-password-change-code) (1-256 characters) || new_password | string | The password to write to the account (8-256 characters) |+| password? | string | Unused here, part of the [sudo verification object](/http-api/users/mfa/#sudo-verification-object) (8-256 characters) |+| mfa_method? | string | The sudo verification method, one of `totp`, `webauthn` or `email_code` |+| mfa_code? | string | Authenticator code or unconsumed backup code (1-32 characters) |+| webauthn_response? | [WebAuthn assertion](/http-api/users/mfa/#webauthn-assertion-object) object | Assertion for the sudo challenge |+| webauthn_challenge? | string | The challenge returned by [create sudo WebAuthn authentication options](/http-api/users/mfa/#create-sudo-webauthn-authentication-options) (1-256 characters) |+| email_code_ticket? | string | Unused here, because an account with a second factor cannot use an email code |+| email_code? | string | Unused here, for the same reason |### Response| Status | Body | Condition || --- | --- | --- || 200 | [password change completion](#password-change-completion-object) object | The password was replaced |+| 403 | [error response](/http-api/#error-response) | `SUDO_MODE_REQUIRED`, because the account has a second factor and no proof was sent |:::danger[Every existing session is destroyed]Completing a password change deletes every authentication session for the account, including the one that authenticated the request, and issues the single replacement this operation returns. Switch to the returned `token` immediately.diff --git a/fluxer_docs/src/content/docs/http-api/users/mfa.mdx b/fluxer_docs/src/content/docs/http-api/users/mfa.mdxindex 37eea4002..f2f647dfc 100644--- a/fluxer_docs/src/content/docs/http-api/users/mfa.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/mfa.mdx@@ -1,7 +1,7 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Multi-factor authentication-description: TOTP, backup codes, WebAuthn credentials, passkey updates, and sudo mode.+description: TOTP, backup codes, WebAuthn credentials, and sudo mode.---import RouteHeader from '@/components/RouteHeader.astro';@@ -13,7 +13,7 @@ Registering a WebAuthn credential does not make passkeys a second factor. A regiEvery route here requires a non-bot user session.:::caution[A challenge is one-use and context-bound]-Fluxer consumes a backup code, a WebAuthn registration challenge, and a WebAuthn sudo challenge on first use. A challenge is bound to the user it was issued to and to the operation it was issued for. The operations are registration, sudo, MFA login, discoverable login, the passkey bridge, and the passkey update. It expires after five minutes, so a registration challenge cannot be redeemed as a sudo assertion.+Fluxer consumes a backup code, a WebAuthn registration challenge, and a WebAuthn sudo challenge on first use. A challenge is bound to the user it was issued to and to the operation it was issued for. The operations are registration, sudo, MFA login, and discoverable login. It expires after five minutes, so a registration challenge cannot be redeemed as a sudo assertion.:::## TOTP parameters@@ -83,7 +83,7 @@ Fluxer refuses a resend for 30 seconds after the previous send on the same tickeSudo mode is a short-lived proof that the human in front of the session is still the account holder. An operation that requires it accepts a valid `X-Fluxer-Sudo-Mode-JWT` request header or the [sudo verification object](#sudo-verification-object) fields inside the JSON body.-A sudo token lasts five minutes and works only for the account that obtained it, across that account's sessions. Treat it as opaque. A new token is issued only after an MFA proof from an account holding a TOTP secret or a registered WebAuthn credential.+A sudo token lasts five minutes and works only for the account that obtained it, across that account's sessions. Treat it as opaque. A new token is issued only after an MFA proof from an account holding a TOTP secret or a registered WebAuthn credential, or after an email code.:::caution[The echoed header repeats the request value]When Fluxer issues no fresh token it echoes the request's `X-Fluxer-Sudo-Mode-JWT` value back unchanged and never re-signs it, so the five-minute window never slides. Fluxer echoes the value even when it fails verification.@@ -93,10 +93,13 @@ The accepted proof depends on what the account can present, which is a stored TO| Account state | Accepted proof || --- | --- |-| Neither a TOTP secret nor a registered WebAuthn credential | `password` |-| A TOTP secret or a registered WebAuthn credential | `mfa_method` with its matching fields, because `password` is no longer accepted |+| Neither a TOTP secret nor a registered WebAuthn credential | `password`, when the account has one |+| A TOTP secret or a registered WebAuthn credential | `mfa_method` with its matching fields, because `password` and `email_code` are no longer accepted || A registered WebAuthn credential and no TOTP secret | The same, and `mfa_method` of `totp` then reads `mfa_code` as an unconsumed backup code |-| Neither of those and no password credential | Nothing, and eligible sudo operations pass |+| No password credential and a confirmed email address | `mfa_method` of `email_code` |+| None of those | Nothing, and eligible sudo operations pass |++The `email_code` method needs an instance that sends email. [Send a sudo email code](#send-a-sudo-email-code) returns the `email_code_ticket`, and the person types the emailed code into `email_code`. A wrong code returns 400 `INVALID_SIGN_IN_CODE` and counts toward the account's wrong-code limit in [send an email code](/http-api/authentication/#send-an-email-code), and after 5 wrong tries or 10 minutes the ticket returns 400 `SIGN_IN_CODE_EXPIRED`. A ticket issued to another account returns 400 `UNKNOWN_SIGN_IN_TICKET`.The `totp` method reads `mfa_code` as a current authenticator code or an unconsumed backup code. An account holding no TOTP secret is left with the backup code alone, which is how an account whose only second factor is passkeys proves sudo mode with no passkey at hand. The `webauthn` method reads `webauthn_response` and `webauthn_challenge` together and requires a registered credential.@@ -126,6 +129,8 @@ In a `SUDO_MODE_REQUIRED` error response, `has_mfa` and `methods` are at the top| totp<sup>1</sup> | boolean | Whether the account has a TOTP secret and the TOTP authenticator type || webauthn | boolean | Whether the account has at least one registered WebAuthn credential || backup_codes<sup>2</sup> | boolean | Whether the account holds at least one unconsumed backup code |+| email_code? | boolean | Whether the account can prove sudo mode with an emailed code |+| password? | boolean | Whether the account can prove sudo mode with its password |<sup>1</sup> Both conditions are required, so an account holding a stored secret without the [authenticator type](/http-api/users/#authenticator-types) reports `false`@@ -140,10 +145,12 @@ Operations that require sudo mode merge these fields into their own JSON body. E| Field | Type | Description || --- | --- | --- || password?<sup>1</sup> | string | Account password (8-256 characters) |-| mfa_method?<sup>2</sup> | string | MFA method, either `totp` or `webauthn` |+| mfa_method?<sup>2</sup> | string | MFA method, one of `totp`, `webauthn` or `email_code` || mfa_code?<sup>3</sup> | string | Authenticator code or unconsumed backup code (1-32 characters) || webauthn_response?<sup>4</sup> | [WebAuthn assertion](#webauthn-assertion-object) object | Assertion produced for the supplied challenge || webauthn_challenge?<sup>4</sup> | string | Challenge returned by [create sudo WebAuthn authentication options](#create-sudo-webauthn-authentication-options) (1-256 characters) |+| email_code_ticket?<sup>5</sup> | string | Ticket returned by [send a sudo email code](#send-a-sudo-email-code) (1-128 characters) |+| email_code?<sup>5</sup> | string | The 6-digit code from the email |<sup>1</sup> Considered only while the account holds no TOTP secret and no registered WebAuthn credential, and ignored once either exists@@ -153,6 +160,8 @@ Operations that require sudo mode merge these fields into their own JSON body. E<sup>4</sup> Both fields are required together when `mfa_method` is `webauthn`+<sup>5</sup> Both fields are required together when `mfa_method` is `email_code`+## MFA backup codes object### Structure@@ -174,8 +183,6 @@ Operations that require sudo mode merge these fields into their own JSON body. E## MFA backup code object-A backup code is two four-character groups separated by a hyphen. Each group is drawn from the lowercase Latin alphabet and the decimal digits.-### Structure| Field | Type | Description |@@ -185,8 +192,6 @@ A backup code is two four-character groups separated by a hyphen. Each group is## MFA backup codes challenge object-The state of a newly created backup codes challenge ticket.-### Structure| Field | Type | Description |@@ -197,8 +202,6 @@ The state of a newly created backup codes challenge ticket.## MFA backup codes verification object-The backup codes and the proof a verified challenge returns.-### Structure| Field | Type | Description |@@ -210,9 +213,9 @@ The backup codes and the proof a verified challenge returns.## WebAuthn credential object-An account holds at most 10 WebAuthn credentials, not counting [replaced passkeys](#replaced-passkeys). Both [Create WebAuthn registration options](#create-webauthn-registration-options) and [Register WebAuthn credential](#register-webauthn-credential) enforce this limit.+An account holds at most 10 WebAuthn credentials. Both [Create WebAuthn registration options](#create-webauthn-registration-options) and [Register WebAuthn credential](#register-webauthn-credential) enforce this limit.-Fluxer verifies every assertion against the domain its challenge was issued for, chosen by [passkey domain selection](#passkey-domain-selection), and against the allowed origins configured for the instance. A passkey bridge assertion and a passkey update registration accept only the origin the ceremony runs on. Fluxer rejects an assertion whose reported signature counter is not greater than the stored counter. The exception is a stored and a reported counter of zero, which is how an authenticator without a counter appears.+Fluxer verifies every assertion against the instance's `FLUXER_PASSKEY_RP_ID` and against the allowed origins configured for the instance. Fluxer rejects an assertion whose reported signature counter is not greater than the stored counter. The exception is a stored and a reported counter of zero, which is how an authenticator without a counter appears.### Structure@@ -222,74 +225,12 @@ Fluxer verifies every assertion against the domain its challenge was issued for,| name | string | User-assigned credential name (1-100 characters) || created_at | ISO8601 timestamp | The time [Register WebAuthn credential](#register-webauthn-credential) stored the credential || last_used_at<sup>1</sup> | ?ISO8601 timestamp | Most recent successful authentication |-| rp_id<sup>2</sup> | string | The domain the passkey was created for |+| rp_id | string | The domain the passkey was created for, the instance's `FLUXER_PASSKEY_RP_ID` |<sup>1</sup> Null until the credential completes a login, MFA, or sudo assertion for the first time-<sup>2</sup> The instance's `FLUXER_PASSKEY_RP_ID` for every passkey except one created on a new origin of the official instance, which reports `fluxer.com`. See [passkey domain selection](#passkey-domain-selection)-Fluxer never returns the credential's public key, signature counter, or reported transports.-## Passkey domain selection--A passkey works only under the domain it was created for, its relying party identifier. Most instances have one, `FLUXER_PASSKEY_RP_ID`, and every passkey uses it. The official instance has two while its web client moves from `web.fluxer.app` to `fluxer.com`, as the [passkey bridge](/http-api/authentication/#passkey-bridge) describes. There, a request whose `Origin` is `https://fluxer.com` or `https://canary.fluxer.com` is a new-origin request, and the domain follows the table below. A request with any other `Origin`, or with none as from the mobile apps, keeps `fluxer.app` wherever the account can use it.--| Operation | New-origin request | Any other request |-| --- | --- | --- |-| [Create WebAuthn registration options](#create-webauthn-registration-options) | A new `fluxer.com` passkey | A new `fluxer.app` passkey |-| [Get discoverable WebAuthn options](/http-api/authentication/#get-discoverable-webauthn-options) | Any `fluxer.com` passkey | Any `fluxer.app` passkey, replaced ones included |-| [Get WebAuthn MFA options](/http-api/authentication/#get-webauthn-mfa-options) | The `fluxer.com` passkeys, else the `fluxer.app` ones | The `fluxer.app` passkeys with replaced ones, else the `fluxer.com` ones |-| [Create sudo WebAuthn authentication options](#create-sudo-webauthn-authentication-options) | The `fluxer.com` passkeys, else the `fluxer.app` ones | The `fluxer.app` passkeys with replaced ones, else the `fluxer.com` ones |--The options name the chosen domain in `rpId` and list only the chosen passkeys. An assertion from any other credential returns 401 `PASSKEY_AUTHENTICATION_FAILED`. A page on a new origin cannot run options for `fluxer.app` itself, so the official web client runs them through the passkey bridge.--## Replaced passkeys--A [passkey update](#passkey-updates) keeps the old `fluxer.app` credential as a replaced passkey, so the mobile apps and `web.fluxer.app` still accept it. A replaced passkey appears in no list, no [Ready](/gateway/events/#ready) payload, and no [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update), and it does not count towards the 10-credential limit.--A replaced passkey works only on requests that are not new-origin requests. It never works on a new origin or through the passkey bridge. Renaming or deleting it by ID returns 404 `UNKNOWN_WEBAUTHN_CREDENTIAL`. Deleting the passkey that replaced it deletes it too, and deleting the account's last listed passkey deletes every replaced one.--## Passkey updates--A passkey update swaps one `fluxer.app` passkey for a `fluxer.com` passkey with the same name. Fluxer opens one only when a [passkey bridge](/http-api/authentication/#passkey-bridge) redemption completes from a new origin while the instance-wide [domain migration switch](/http-api/instance/#domain-migration-object) is on. Nothing else opens one.--An open update belongs to one session and names the passkey the ceremony used. It lasts five minutes, and a later redemption on the same session replaces it.--The open update stands in for sudo mode on the update routes, because it exists only after this session used the old passkey within the last five minutes. It allows one action. [Complete passkey update](#complete-passkey-update) registers the new passkey. When the authenticator already holds a `fluxer.com` passkey for the account, registration fails on `excludeCredentials` and the old passkey stays listed, so the person can remove it themselves.--## Passkey update object--### Structure--| Field | Type | Description |-| --- | --- | --- |-| pending<sup>1</sup> | ?[pending passkey update](#pending-passkey-update-object) object | The passkey this session can update |--<sup>1</sup> Null when the session has no open update, and when the passkey it names was deleted or replaced since--## Pending passkey update object--### Structure--| Field | Type | Description |-| --- | --- | --- |-| credential_id | string | Base64url ID of the passkey to update |-| name | string | The passkey's name, which the new passkey takes |-| cross_device | boolean | Whether the ceremony used a phone or security key rather than the device itself |--## Passkey bridge sudo redemption object--The result of one redeemed `sudo` [passkey bridge](/http-api/authentication/#passkey-bridge) ceremony.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| status | string | The ceremony state, either `completed` or `cancelled` |-| sudo_token?<sup>1</sup> | string | A sudo mode token, sent later in the `X-Fluxer-Sudo-Mode-JWT` request header |--<sup>1</sup> Present only when the status is `completed`-## WebAuthn credential descriptor object### Structure@@ -372,8 +313,6 @@ Malformed fields return `INVALID_FORM_BODY`. An attestation that fails verificat| publicKeyAlgorithm? | integer | COSE public key algorithm identifier || publicKey? | string | Base64url credential public key |-<sup>1</sup> Retained with the credential and returned later in `allowCredentials` and `excludeCredentials`-## WebAuthn client extension results object### Structure@@ -384,8 +323,6 @@ Malformed fields return `INVALID_FORM_BODY`. An attestation that fails verificat| credProps? | [WebAuthn credential properties](#webauthn-credential-properties-object) object | Credential properties output || hmacCreateSecret? | boolean | Whether the authenticator created an HMAC secret |-Fluxer accepts additional extension result fields.-## WebAuthn credential properties object### Structure@@ -394,8 +331,6 @@ Fluxer accepts additional extension result fields.| --- | --- | --- || rk? | boolean | Whether the created credential is discoverable |-Fluxer accepts additional credential property fields.-## WebAuthn authentication options objectEvery operation that issues a WebAuthn authentication challenge returns this object: sudo verification here, and the login option operations on [HTTP authentication](/http-api/authentication/).@@ -406,7 +341,7 @@ Every operation that issues a WebAuthn authentication challenge returns this obj| --- | --- | --- || challenge<sup>1</sup> | string | Base64url one-use challenge || timeout<sup>2</sup> | integer | Authenticator operation timeout in milliseconds |-| rpId | string | Relying party identifier chosen by [passkey domain selection](#passkey-domain-selection) |+| rpId | string | Relying party identifier, the instance's `FLUXER_PASSKEY_RP_ID` || allowCredentials?<sup>3</sup> | array[[WebAuthn credential descriptor](#webauthn-credential-descriptor-object) object] | Credentials accepted for this operation || userVerification<sup>4</sup> | string | User verification requirement, one of `discouraged`, `preferred`, or `required` |@@ -414,9 +349,9 @@ Every operation that issues a WebAuthn authentication challenge returns this obj<sup>2</sup> Every operation emits the fixed value `60000`, a standard PublicKeyCredential request option-<sup>3</sup> Sudo and MFA login options list the passkeys [passkey domain selection](#passkey-domain-selection) chooses, and passkey bridge options list the account's `fluxer.app` passkeys. The field is absent on the discoverable login route and on passkey bridge options for sign-in+<sup>3</sup> Sudo and MFA login options list the account's passkeys. The field is absent on the discoverable login route-<sup>4</sup> Sudo options, MFA login completion, and passkey bridge options for two-factor sign-in and sudo request `discouraged`. Discoverable login and passkey bridge options for sign-in request and verify `required`+<sup>4</sup> Sudo options and MFA login completion request `discouraged`. Discoverable login requests and verifies `required`Fluxer emits no other PublicKeyCredential request options member, so `hints` and `extensions` never appear on this object.@@ -441,7 +376,7 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and<sup>2</sup> Every registration emits the fixed value `60000`-<sup>3</sup> Holds every credential already stored for the account, replaced passkeys included, so an authenticator cannot enrol the same credential twice. It is an empty array when the account holds none. Passkey update options hold only the account's listed `fluxer.com` passkeys+<sup>3</sup> Holds every credential already stored for the account, so an authenticator cannot enrol the same credential twice. It is an empty array when the account holds none<sup>4</sup> Fluxer requests a preferred discoverable credential and preferred user verification, and requires neither, so `requireResidentKey` is `false`@@ -449,7 +384,7 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and<sup>6</sup> Always present with `credProps` set to `true`, the only extension Fluxer requests-<sup>7</sup> An empty array, except on [passkey update](#passkey-updates) options for a passkey last used from a phone or security key, where it is `hybrid` then `security-key`+<sup>7</sup> Always an empty array## WebAuthn relying party object@@ -458,7 +393,7 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| Field | Type | Description || --- | --- | --- || name | string | Relying party display name configured for the instance |-| id | string | Relying party identifier chosen by [passkey domain selection](#passkey-domain-selection) |+| id | string | Relying party identifier, the instance's `FLUXER_PASSKEY_RP_ID` |## WebAuthn registration user object@@ -503,23 +438,18 @@ Fluxer emits no other PublicKeyCredential request options member, so `hints` and| hmacCreateSecret? | boolean | Whether HMAC secret creation is requested || minPinLength? | boolean | Whether minimum PIN length is requested |-<sup>1</sup> The only member Fluxer ever sets, always `true` on [WebAuthn registration options](#webauthn-registration-options-object)--## Sudo MFA methods object+## Sudo email code object### Structure| Field | Type | Description || --- | --- | --- |-| totp | boolean | Whether the account has a TOTP secret and the TOTP authenticator type, as in the [sudo mode method availability](#sudo-mode-method-availability-object) object |-| webauthn | boolean | Whether the account has at least one registered WebAuthn credential |-| backup_codes | boolean | Whether the account holds at least one unconsumed backup code, as in the [sudo mode method availability](#sudo-mode-method-availability-object) object |-| has_mfa | boolean | Whether the account can satisfy a sudo mode challenge, as in the [sudo mode methods](#sudo-mode-methods-object) object |+| ticket | string | The value to send back as `email_code_ticket` |+| code_expires_at | ISO8601 timestamp | When the emailed code stops working, 10 minutes after sending |+| resend_available_at | ISO8601 timestamp | When another code can be requested, 30 seconds after sending |## WebAuthn two-factor object-The account as it stands after [Set WebAuthn two-factor authentication](#set-webauthn-two-factor-authentication), together with any backup codes that operation minted.-### Structure| Field | Type | Description |@@ -789,7 +719,7 @@ The previous set is replaced with 10 new codes. A failure can leave the old code<RouteHeader method="GET" path="/v1/users/@me/mfa/webauthn/credentials" />-Returns an array of [WebAuthn credential](#webauthn-credential-object) objects registered to the current account, or an empty array when none exist. [Replaced passkeys](#replaced-passkeys) are left out. Sudo mode is not required.+Returns an array of [WebAuthn credential](#webauthn-credential-object) objects registered to the current account, or an empty array when none exist. Sudo mode is not required.### Response@@ -805,7 +735,7 @@ Returns an array of [WebAuthn credential](#webauthn-credential-object) objects r<RouteHeader method="POST" path="/v1/users/@me/mfa/webauthn/credentials/registration-options" mfa />-Creates a one-use registration challenge and returns a [WebAuthn registration options](#webauthn-registration-options-object) object for the domain [passkey domain selection](#passkey-domain-selection) chooses. [Sudo mode](#sudo-mode) is required.+Creates a one-use registration challenge and returns a [WebAuthn registration options](#webauthn-registration-options-object) object. [Sudo mode](#sudo-mode) is required.This operation sets no `X-Fluxer-Sudo-Mode-JWT` response header.@@ -902,7 +832,7 @@ The body extends the [sudo verification object](#sudo-verification-object) with| --- | --- | --- || 204 | empty | Credential was renamed || 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |-| 404 | [error response](/http-api/#error-response) | The credential is not registered to the current account or is a [replaced passkey](#replaced-passkeys), returning `UNKNOWN_WEBAUTHN_CREDENTIAL` |+| 404 | [error response](/http-api/#error-response) | The credential is not registered to the current account, returning `UNKNOWN_WEBAUTHN_CREDENTIAL` |### Side effects@@ -940,11 +870,11 @@ Deleting the account's last WebAuthn credential removes the WebAuthn authenticat| --- | --- | --- || 204 | empty | Credential was deleted || 403 | [error response](/http-api/#error-response) | Sudo mode was not proven and the request returns `SUDO_MODE_REQUIRED` |-| 404 | [error response](/http-api/#error-response) | The credential is not registered to the current account or is a [replaced passkey](#replaced-passkeys), returning `UNKNOWN_WEBAUTHN_CREDENTIAL` |+| 404 | [error response](/http-api/#error-response) | The credential is not registered to the current account, returning `UNKNOWN_WEBAUTHN_CREDENTIAL` |### Side effects-The credential is deleted, together with the [replaced passkeys](#replaced-passkeys) it took over from. When no listed credential remains, every replaced passkey the account still holds is deleted as well. When it was the final one and the account had passkeys enabled as a second factor, the WebAuthn authenticator type is removed from the account and from every bot account owned by the user.+The credential is deleted. When it was the final one and the account had passkeys enabled as a second factor, the WebAuthn authenticator type is removed from the account and from every bot account owned by the user.[WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) reaches the user's sessions with the remaining credential summaries. When the authenticator types changed, [User Update](/gateway/events/#user-update) also reaches the user and each affected owned bot.@@ -952,86 +882,6 @@ The credential is deleted, together with the [replaced passkeys](#replaced-passk10 requests per minute for each authenticated user, on the `mfa:webauthn:delete` bucket.-## Get passkey update--<RouteHeader method="GET" path="/v1/users/@me/mfa/webauthn/migration" />--Returns a [passkey update](#passkey-update-object) object for the current session. Sudo mode is not required, and any `Origin` is accepted.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [passkey update](#passkey-update-object) object | The session's update state was returned |--### Side effects--An open update whose passkey was deleted or replaced since is discarded. No Gateway Dispatch is emitted.--### Rate limit--20 requests per minute for each authenticated user, on the `mfa:webauthn:migration` bucket, shared with the other passkey update routes.--## Create passkey update registration options--<RouteHeader method="POST" path="/v1/users/@me/mfa/webauthn/migration/registration-options" />--Creates a one-use registration challenge for the `fluxer.com` passkey that replaces the session's open [passkey update](#passkey-updates). Returns a [WebAuthn registration options](#webauthn-registration-options-object) object.--The request has no body. It needs a new-origin request and an open update on this session, and otherwise returns 404 `UNKNOWN_PASSKEY_MIGRATION`. Sudo mode, a verified email, and room under the credential limit are not required.--`excludeCredentials` lists the account's `fluxer.com` passkeys. When the update's `cross_device` is true, `hints` is `hybrid` then `security-key`, so the browser offers the phone or key used a moment ago.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [WebAuthn registration options](#webauthn-registration-options-object) object | Challenge and registration options were issued |-| 404 | [error response](/http-api/#error-response) | The request is not from a new origin or the session has no open update, returning `UNKNOWN_PASSKEY_MIGRATION` |--### Side effects--Fluxer issues a registration challenge for the current user, bound to the passkey update. It expires after five minutes, can be redeemed once, and no other WebAuthn route accepts it. The update stays open.--### Rate limit--20 requests per minute for each authenticated user, on the shared `mfa:webauthn:migration` bucket.--## Complete passkey update--<RouteHeader method="POST" path="/v1/users/@me/mfa/webauthn/migration" />--Registers the `fluxer.com` passkey that replaces the session's open [passkey update](#passkey-updates) and returns 204 with an empty body. Emits a [WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) Gateway event.--### JSON body--| Field | Type | Description |-| --- | --- | --- |-| response | [WebAuthn registration response](#webauthn-registration-response-object) object | Authenticator response for the update challenge |-| challenge | string | The challenge from [create passkey update registration options](#create-passkey-update-registration-options) (1-1024 characters) |--The request needs a new-origin request and an open update on this session, and otherwise returns 404 `UNKNOWN_PASSKEY_MIGRATION`. Fluxer verifies the attestation for `fluxer.com` and accepts only the request's own `Origin` in its client data.--A failed verification returns the codes of [register WebAuthn credential](#register-webauthn-credential) and leaves the update open. It consumes the challenge, so fetch new options before trying again. An update that another request settled first, and a passkey that was deleted or replaced since, return 404 `UNKNOWN_PASSKEY_MIGRATION`.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | The passkey was updated |-| 400 | [error response](/http-api/#error-response) | Verification failed, with a code from [register WebAuthn credential](#register-webauthn-credential) |-| 404 | [error response](/http-api/#error-response) | No open update applies, returning `UNKNOWN_PASSKEY_MIGRATION` |--### Side effects--Fluxer closes the update, adds the new passkey under the old one's name, and makes the old one a [replaced passkey](#replaced-passkeys). No authenticator type changes.--[WebAuthn Credentials Update](/gateway/events/#webauthn-credentials-update) reaches the user's sessions with the complete current credential summaries.--### Rate limit--20 requests per minute for each authenticated user, on the shared `mfa:webauthn:migration` bucket.-## Set WebAuthn two-factor authentication<RouteHeader method="PUT" path="/v1/users/@me/mfa/webauthn/two-factor" mfa />@@ -1099,96 +949,49 @@ Returns a [sudo MFA methods](#sudo-mfa-methods-object) object describing which s20 requests per minute for each authenticated user, on the `sudo:mfa:methods` bucket.-## Create sudo WebAuthn authentication options--<RouteHeader method="POST" path="/v1/users/@me/sudo/webauthn/authentication-options" />--Creates a one-use sudo challenge and returns a [WebAuthn authentication options](#webauthn-authentication-options-object) object listing the passkeys [passkey domain selection](#passkey-domain-selection) chooses.--The account needs at least one credential in the chosen group. Sudo mode is not required to obtain the challenge.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [WebAuthn authentication options](#webauthn-authentication-options-object) object | Challenge and options were issued |-| 400 | [error response](/http-api/#error-response) | No WebAuthn credential is registered and the request returns `NO_PASSKEYS_REGISTERED` |--### Side effects--Fluxer issues a sudo challenge for the current user. It expires after five minutes and can be redeemed once by submitting it as `webauthn_challenge` alongside `webauthn_response` in a [sudo verification object](#sudo-verification-object).--### Rate limit--10 requests per minute for each authenticated user, on the `sudo:webauthn:options` bucket.--## Start passkey bridge sudo verification--<RouteHeader method="POST" path="/v1/users/@me/passkey-bridge" />+## Send a sudo email code-Starts a `sudo` [passkey bridge](/http-api/authentication/#passkey-bridge) ceremony for the current account. Sudo mode is not required. Returns a [passkey bridge start](/http-api/authentication/#passkey-bridge-start-object) object.+<RouteHeader method="POST" path="/v1/users/@me/sudo/email-code" />-### JSON body--| Field | Type | Description |-| --- | --- | --- |-| runner | string | Where the ceremony runs, either `page` or `native` |-| nonce_hash | string | The SHA-256 digest of the nonce the new origin keeps, as 64 lowercase hex characters |+Emails a 6-digit code to the confirmed address of the current account, for [sudo mode](#sudo-mode). Sudo mode is not required. Returns a [sudo email code](#sudo-email-code-object) object.-The request MUST send an `Origin` header of `https://fluxer.com` or `https://canary.fluxer.com`. Any other `Origin`, none, or a self-hosted instance returns 403 `INVALID_API_ORIGIN`. An account with no passkey listed for `fluxer.app` returns 400 `NO_PASSKEYS_REGISTERED`.+An account with a TOTP secret or a registered WebAuthn credential gets 400 `SUDO_SECOND_FACTOR_REQUIRED` and confirms with that factor instead. An account that has a password, an account without a confirmed email address, and any account on an instance that sends no email get 400 `EMAIL_CODES_UNAVAILABLE`.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [passkey bridge start](/http-api/authentication/#passkey-bridge-start-object) object | The ceremony was started |-| 400 | [error response](/http-api/#error-response) | The body is invalid, or the account has no passkey for `fluxer.app` |-| 403 | [error response](/http-api/#error-response) | The `Origin` is refused, returning `INVALID_API_ORIGIN` |+| 200 | [sudo email code](#sudo-email-code-object) object | The code was sent |+| 400 | [error response](/http-api/#error-response) | Email codes are unavailable for the account |+| 429 | [rate limit response](/topics/rate-limits/#rate-limit-response-object) | A route, global, address, IP or wrong-code limit denies the request, or the resend cooldown is running |### Side effects-Fluxer stores the ceremony for 10 minutes. It changes no account state. No Gateway Dispatch is emitted.+The operation stores the code for 10 minutes and emails it. After 5 codes to one address in an hour each further code waits longer, and the account's wrong-code limit stops codes, as in [send an email code](/http-api/authentication/#send-an-email-code).### Rate limit-10 requests per minute for each authenticated user, on the `mfa:passkey_bridge:start` bucket.+5 requests per 15 minutes for each authenticated user, on the `sudo:email_code` bucket.-## Redeem passkey bridge sudo verification--<RouteHeader method="POST" path="/v1/users/@me/passkey-bridge/{ceremony_id}/redeem" />--Redeems a finished `sudo` [passkey bridge](/http-api/authentication/#passkey-bridge) ceremony once for a sudo mode token. Returns a [passkey bridge sudo redemption](#passkey-bridge-sudo-redemption-object) object.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| ceremony_id | string | The identifier from the start response, 43 base64url characters |--### JSON body+## Create sudo WebAuthn authentication options-| Field | Type | Description |-| --- | --- | --- |-| nonce | string | The nonce whose digest started the ceremony, as base64url, 16 to 256 characters |-| completion_code | string | The completion code from the return fragment or the finish response, 43 base64url characters |+<RouteHeader method="POST" path="/v1/users/@me/sudo/webauthn/authentication-options" />-The `Origin` MUST be the new origin that started the ceremony, or the request returns 403 `INVALID_API_ORIGIN`. A pending ceremony, a sign-in ceremony, and a ceremony another account started return 404 `UNKNOWN_PASSKEY_BRIDGE` and stay in place, as does an unknown or expired identifier. A wrong nonce or completion code deletes the ceremony and returns 400 `INVALID_PASSKEY_BRIDGE_NONCE`.+Creates a one-use sudo challenge and returns a [WebAuthn authentication options](#webauthn-authentication-options-object) object listing the account's passkeys.-A cancelled ceremony returns `cancelled`. A completed one returns a token that works like one [sudo mode](#sudo-mode) issues, for five minutes and for this account. The response sets no `X-Fluxer-Sudo-Mode-JWT` header, so the client sends the token in that header itself.+The account needs at least one credential in the chosen group. Sudo mode is not required to obtain the challenge.### Response| Status | Body | Condition || --- | --- | --- |-| 200 | [passkey bridge sudo redemption](#passkey-bridge-sudo-redemption-object) object | The ceremony was redeemed |-| 400 | [error response](/http-api/#error-response) | The body or ceremony ID is invalid, or a secret does not match, returning `INVALID_PASSKEY_BRIDGE_NONCE` |-| 403 | [error response](/http-api/#error-response) | The `Origin` is refused, returning `INVALID_API_ORIGIN` |-| 404 | [error response](/http-api/#error-response) | No redeemable sudo ceremony of this account has this identifier, returning `UNKNOWN_PASSKEY_BRIDGE` |+| 200 | [WebAuthn authentication options](#webauthn-authentication-options-object) object | Challenge and options were issued |+| 400 | [error response](/http-api/#error-response) | No WebAuthn credential is registered and the request returns `NO_PASSKEYS_REGISTERED` |### Side effects-A redemption that gets past the secret check deletes the ceremony. When the request comes from a new origin and the domain migration switch is on, Fluxer opens a [passkey update](#passkey-updates) for the calling session. No Gateway Dispatch is emitted.+Fluxer issues a sudo challenge for the current user. It expires after five minutes and can be redeemed once by submitting it as `webauthn_challenge` alongside `webauthn_response` in a [sudo verification object](#sudo-verification-object).### Rate limit-60 requests per minute for each authenticated user, on the `mfa:passkey_bridge:redeem` bucket.+10 requests per minute for each authenticated user, on the `sudo:webauthn:options` bucket.