# Managing Authenticators

Source: https://keyringauth.com/docs/0.x/authenticators

## Introduction

A [factor](https://keyringauth.com/docs/0.x/factors) is a kind of sign-in method, such as an authenticator app or a passkey. An authenticator is one a user has set up. One set of routes adds, renames and removes authenticators for every factor. To turn them on, enable `Features::manageAuthenticators()`:

```php
'features' => [
    Features::manageAuthenticators(),
],
```

Without it, users can't set up a sign-in method beyond their password. `keyring:install` turns it on when you choose a sign-in method.

## Email Verification

A user whose model implements `MustVerifyEmail` must verify their address before beginning or confirming an enrollment. Until they do, they get a 403 with "Please verify your email address before adding a sign-in method."

With `Features::registration()` on, anyone can type any address. So your user model must implement `MustVerifyEmail`, and `Features::emailVerification()` must be on. Otherwise, enrolling throws `Keyring\Exceptions\EmailVerificationRequired`, which says what to change. Until the address is verified, the account might belong to whoever typed it first, and any factors they added would survive the real owner's password reset.

Without registration, you don't have to implement `MustVerifyEmail`. Accounts come from you, so verification isn't required. `keyring:install` turns on email verification when you choose registration.

### Who May Enroll

If you prove addresses another way, such as at sign-up, through single sign-on, or by an admin approving accounts, decide who may enroll yourself:

```php
Keyring::allowEnrollmentWhen(fn (User $user) => $user->approved_at !== null);
```

Your callback replaces the verified-email rule, so `EmailVerificationRequired` is no longer thrown. A user it refuses gets the same 403. Return `true` only when you know the account belongs to its owner.

## Adding an Authenticator

Adding an authenticator takes two steps. Nothing is saved until the second one succeeds.

### Beginning

`POST /user/authenticators/{factor}` starts an enrollment. Its secret stays in the session for `enrollments.keep_for` (15 minutes by default). Starting again replaces the earlier enrollment. Only the account that started it can confirm, and signing in forgets it. Beginning a factor that sends a code counts toward the account's `limits.codes` (three every 10 minutes). Every enrollment and step-up of the account shares one count, whichever browser it comes from, apart from the codes sign-ins are sent (see [Rate Limiting](https://keyringauth.com/docs/0.x/security#rate-limiting)).

The `enrollment` in the response holds what to show the user:

| Factor | Request Fields | `enrollment` |
|---|---|---|
| `totp` | `name` (optional) | `secret`, `algorithm` (`SHA1` unless the factor is [set up with another](https://keyringauth.com/docs/0.x/factors#authenticator-apps-totp)), `url` (an `otpauth://` URI), `qr` (an SVG string) |
| `email-code` | `name` (optional) | `length`, and `sent: true`. The code goes to the current address. |
| `recovery` | none | `codes`: the new codes, shown once |
| `passkey`, `security-key` | none | `options`: WebAuthn creation options for the browser |
| `sso` | `provider`, a name from `sso.providers`, and `password` when needed | `provider`, and `url`: where to send the browser. See [linking](https://keyringauth.com/docs/0.x/sso#linking-and-unlinking). |

```json
{
  "status": "enrollment-started",
  "factor": "totp",
  "enrollment": {
    "secret": "JBSWY3DPEHPK3PXP...",
    "algorithm": "SHA1",
    "url": "otpauth://totp/Example:taylor%40example.com?secret=...",
    "qr": "<svg ...>...</svg>"
  }
}
```

Beginning also takes `password` (see below) and `proof` (see [Making a Change With an Established Key](https://keyringauth.com/docs/0.x/authenticators#making-a-change-with-an-established-key)). Neither is accepted when confirming. Both are checked before anything is shown, so the user never sees a QR code or codes that can't be saved.

Authenticator apps and email codes take an optional `name`, when beginning or confirming, and the name sent when confirming wins. Passkeys and security keys take it when confirming. Without one, the name is "Authenticator app", "Email", "Passkey" or "Security key". A name longer than 64 characters is cut when beginning, and refused with a `422` on `name` when confirming.

### The Password for a First Second Factor

Adding a second factor (an authenticator app, a passkey, a security key or one of your own) needs the user's current password while the account has no [established](https://keyringauth.com/docs/0.x/authenticators#established-authenticators) second factor. So does a sign-in step sent to an address of its own, such as a code by text message to a number given at enrollment, though it isn't a factor: whoever adds it chooses where its codes go (see [Writing a Code Factor](https://keyringauth.com/docs/0.x/factors#writing-a-code-factor)). Recovery codes and email codes never need it.

Signing in counts as a fresh verification. Without this check, a copy of a session that has just signed in could add a second factor to a password-only account, and the owner would be asked for a factor they don't have.

Send the password as `password` when beginning. A recent sign-in or step-up doesn't count in its place. Linking an identity provider takes it on the same terms.

- A missing password gets a `422` on `password`, with the `password_to_add_factor` message.
- A wrong one gets a `422` on `password`, with the usual `validation.current_password` message. It counts against the password's [rate limits](https://keyringauth.com/docs/0.x/security#rate-limiting), so too many get a `429`. At the cap, the password is locked and `AccountLocked` is dispatched.

Either way, `EnrollmentRefused` is dispatched with the reason `password`.

The confirm checks again. If the account lost its established second factor in between, the confirm fails on `password` and the enrollment is spent.

A password set from a session, with no current one to type, doesn't count until it's [established](https://keyringauth.com/docs/0.x/authenticators#established-authenticators). See [Changing the Password](https://keyringauth.com/docs/0.x/protected-changes#changing-the-password).

Your own code can pass `passwordConfirmed: true` to `AuthenticatorChanges::add()` once it has checked who the factor is for. Without it, adding a second factor or a step sent to an address of its own to such an account throws `PasswordRequired` and saves nothing. `$changes->needsPassword($user, $factor)` says whether the routes would ask.

> [!NOTE]
> An account with no password, such as one that only uses passkeys, adds a factor on fresh verification alone. A copied session can add one there too. See [Other Limits](https://keyringauth.com/docs/0.x/security#other-limits).

### Confirming

`POST /user/authenticators/{factor}/confirm` proves the enrollment works:

| Factor | Fields |
|---|---|
| `totp`, `email-code` | `code`, `name` (optional) |
| `recovery` | none. Confirming means "I've saved these." |
| `passkey`, `security-key` | `credential` (the browser's response), `name` (optional) |
| `sso` | none. The provider's callback confirms it. |

The errors:

- A wrong code or proof gets `keyring::keyring.invalid` on the factor's field: `code`, or `credential` for keys.
- An expired or missing enrollment, one that's already confirmed, or one another account started, gets `keyring::keyring.enrollment_expired` on the same field.
- A confirm refused because the account was frozen since the enrollment began fails on `authenticator`. A confirm refused because the account lost its established second factor fails on `password`.

A confirm refused on `authenticator` or `password` spends the enrollment, so the user begins again. Email codes keep their guess count between tries.

On success, the response holds the new authenticator, as its factor's `present` method gives it:

```json
{
  "status": "authenticator-added",
  "authenticator": { "factor": "totp", "id": "01JC4...", "name": "Authenticator app", "createdAt": "2026-11-08T14:05:00+00:00", "lastUsedAt": null },
  "recoveryCodes": ["jbsw-y3dp-ehpk-3pxp-jbsw-y3dp-eh", "..."]
}
```

`createdAt` is when the authenticator was added, and `lastUsedAt` is when it last signed the user in or confirmed a change. Show both on your settings page, so the owner can spot one they didn't add. `recoveryCodes` appears only when Keyring made recovery codes with this authenticator.

The first authenticator a user saves becomes their default. Recovery codes and [single sign-on](https://keyringauth.com/docs/0.x/sso) links never do. A passkey or security key that's already registered, to anyone, can't be registered again. Confirming a factor that allows one per user (`email-code` or `recovery`) replaces the one they have.

Confirming also proves the factor, so the session counts it as verified, as at a sign-in. A user who signed in with a password and then adds an authenticator app reaches [AAL2](https://keyringauth.com/docs/0.x/policies#assurance-levels) with that response. The session ID changes, so a copy of the session from before is signed out.

## Recovery Codes

When a user adds a factor and has no recovery codes left, Keyring makes eight and returns them as `recoveryCodes`. Show them once. This needs the `recovery` factor to be registered. Email codes and identity provider links don't count as second factors, so they don't trigger a set.

To give the user a new set, enroll `recovery`. Confirming replaces the old set, and a user has one set at a time. A new set can be refused while the account is [frozen](https://keyringauth.com/docs/0.x/authenticators#frozen-sign-in-methods). Recovery codes back up another second factor, so confirming them alone fails with `keyring::keyring.recovery_needs_second_factor` on `authenticator`.

Each code works once. The challenge page shows how many are left as `remaining`, and `RecoveryCodeUsed` carries the same count.

Keyring doesn't issue a new code by itself, since the user has to see and save it. Instead it marks the set:

- `$user->keyring->shouldReplaceRecoveryCodes()` is `true` from the moment a code is used until the set is replaced.
- The set's [presentation](https://keyringauth.com/docs/0.x/sign-in-flow#page-props) includes the same answer as `replace`, next to `remaining`.

To show a banner, share the value through your `HandleInertiaRequests` middleware. Keep it lazy, since it loads the user's authenticators:

```php
// app/Http/Middleware/HandleInertiaRequests.php
'replaceRecoveryCodes' => fn () => (bool) $request->user()?->keyring->shouldReplaceRecoveryCodes(),
```

Until the user makes a new set, a used code is spent and nothing replaces it. A session that signed in a moment ago with a recovery code and its password is fresh enough to make the new set straight away.

## Renaming and Choosing the Default

`PATCH /user/authenticators/{authenticator}` takes these fields:

| Field | Description |
|---|---|
| `name` | Optional, up to 64 characters of valid UTF-8. |
| `default` | Optional boolean. `true` makes this the default and clears the flag on the user's others. |

Recovery codes can't be the default, since they're only a fallback. Nor can a factor whose `answersChallenges()` is `false`, such as an identity provider link. Sending `default` for one is an error on `default`.

Renaming an [established](https://keyringauth.com/docs/0.x/authenticators#established-authenticators) authenticator is refused while the account is [frozen](https://keyringauth.com/docs/0.x/authenticators#frozen-sign-in-methods), unless the request [proves an established key](https://keyringauth.com/docs/0.x/authenticators#making-a-change-with-an-established-key). Renaming a newer one, and choosing the default, always work.

## Removing Authenticators

`DELETE /user/authenticators/{authenticator}` removes an authenticator. If what's left wouldn't let the user sign in, or meet the policy (for a policy without `ifEnrolled()`), the request fails with `keyring::keyring.last_factor` on `authenticator`.

Removing the last extra factor also removes the recovery codes, since they're only useful while there's a factor to recover. Removing an authenticator stops trusting all of the user's devices. See [Trusted Devices](https://keyringauth.com/docs/0.x/devices-and-sessions#trusted-devices).

Removing the last second factor (beyond recovery codes, email codes and [identity provider](https://keyringauth.com/docs/0.x/sso) links) also needs the current password, sent as `password`:

- A missing or wrong password gets an error on `password` with `keyring::keyring.password_to_remove_last_factor`.
- A password too short to stand alone, which is below `min_without_mfa` characters, gets `keyring::keyring.password_too_short_alone`. The password may have been as short as `min_with_mfa` while the second factor was there. The user must change it first.
- A wrong password counts against the password's [rate limits](https://keyringauth.com/docs/0.x/security#rate-limiting), as at a step-up. Too many get a `429` on `password`.
- A user with no password has none to type, so the removal goes ahead on the other checks.

An authenticator that failed too many times in a row is refused until it's set up again (see [At the Cap](https://keyringauth.com/docs/0.x/security#at-the-cap)). Removing it clears those failures. The password isn't an authenticator, so it can't be removed this way.

Removing an [established](https://keyringauth.com/docs/0.x/authenticators#established-authenticators) authenticator is refused while the account is [frozen](https://keyringauth.com/docs/0.x/authenticators#frozen-sign-in-methods), unless the request proves an established key for it.

## Frozen Sign-In Methods

Signing in counts as a fresh verification, so a stolen copy of a session that has just signed in could add a sign-in method, then remove the owner's authenticator app or replace their recovery codes. A password reset doesn't change second factors, so the owner could be locked out.

So Keyring freezes an account's sign-in methods for a while. The account is frozen while either of these is true:

- It has an authenticator that isn't [established](https://keyringauth.com/docs/0.x/authenticators#established-authenticators). That's one added in the last 7 days (an emailed code never counts), a newly linked [identity provider](https://keyringauth.com/docs/0.x/sso#linking-and-unlinking), or a first password set from a session in the last 7 days.
- In the last 7 days, it removed or replaced an established authenticator, or replaced recovery codes that still had codes left.

While it's frozen, these are refused:

- Removing an established authenticator, including unlinking an established identity provider or removing an established sign-in step sent to an address of its own. An emailed code is never held back.
- Renaming an established authenticator.
- Replacing an established authenticator, or a set of recovery codes with codes left. Beginning is refused too, so the user isn't shown codes that can't be saved.

Everything else still works. The user can add sign-in methods, rename newer ones, choose the default, and remove or replace anything that isn't established. Removing a passkey someone else added is allowed. A refused change ends no sessions. New recovery codes don't freeze the account on their own.

A change that goes through and takes something established freezes the account for 7 days from then. Undoing an email change ([Reverting](https://keyringauth.com/docs/0.x/protected-changes#reverting)) isn't subject to the freeze, and neither is the unlinking a [password reset](https://keyringauth.com/docs/0.x/sso#password-resets-and-email-changes) does.

A refusal is a validation error on `authenticator`, saying how long is left. JSON gets a `422` with the usual `errors`, and `frozen`, which holds the `reason` (`new-authenticator` or `recent-change`), the `until` time as ISO 8601, and `skip`. `skip` lists the factors, by key, that could make this change now. It's empty when none can:

```json
{
    "message": "A sign-in method was added recently. To keep your account safe, your other sign-in methods and your recovery codes can't be removed, replaced or renamed for another 1 week. The new one can still be removed.",
    "errors": {
        "authenticator": ["A sign-in method was added recently. To keep your account safe, your other sign-in methods and your recovery codes can't be removed, replaced or renamed for another 1 week. The new one can still be removed."]
    },
    "frozen": {
        "reason": "new-authenticator",
        "until": "2026-12-04T14:32:45+00:00",
        "skip": ["passkey"]
    }
}
```

Keyring throws this as `Keyring\Exceptions\SignInChangesFrozen`, a `ValidationException` with `freeze` and `skip`. Refused removals dispatch `AuthenticatorRemovalRefused` with the reason `frozen`, and refused enrollments dispatch `EnrollmentRefused` with the reason `frozen`.

To show the freeze before the user tries, ask `AuthenticatorChanges::frozen()`. It returns a `Keyring\Changes\Freeze`, with `until` and `message()`, or `null`:

```php
use Keyring\Changes\AuthenticatorChanges;

$freeze = app(AuthenticatorChanges::class)->frozen($user);

$freeze?->until;      // a CarbonImmutable
$freeze?->message();  // what the user is told
```

The 7 days come from `authenticator_changes.established_after`. Setting it to `0` turns the freeze off, and with it the protection. Keyring keeps when each account last lost something established, and when it got a first password from a session, in `keyring_sign_in_changes`, one row per user. `keyring:prune` deletes a row once it holds nothing back.

### Established Authenticators

An authenticator is established once the account has had it for `authenticator_changes.established_after` (7 days by default), counted from when it was added. Recovery codes count from when the set was made. An emailed code is always established. So is the password, except a first one set from a session, which is established 7 days after it was set, or once a password reset proves the address. Any other sign-in step sent to an address, such as a code by text message to a number given at enrollment, counts from when it was added, as a factor does: whoever added it chose where its codes go (see [Writing a Code Factor](https://keyringauth.com/docs/0.x/factors#writing-a-code-factor)).

An authenticator that isn't established still signs the user in, and it can be used for a fresh verification. It just doesn't raise the bar yet:

- [`noDowngrade()`](https://keyringauth.com/docs/0.x/policies#no-downgrade) only asks for a passkey or security key once the account has an established one.
- Under a policy with [`ifEnrolled()`](https://keyringauth.com/docs/0.x/policies#only-when-enrolled), only established authenticators decide what's asked. A newer one counts when it's used, but it never counts as phishing resistant, device bound or attested.
- A requirement your app sets outright, such as a policy without `ifEnrolled()`, is met by any key that qualifies, new or not.

The exception is an account with an established password and no established second factor. A factor added there took the password, so it's asked for straight away, as a factor and nothing more. One saved by `add()` without `passwordConfirmed` isn't, until it's established.

The owner's own new key follows the same rules for its first 7 days. Keyring can't tell it from a key a copied session added.

`$user->keyring->isEstablished($authenticator)` says whether one is. `$user->keyring->established()` returns the keyring without the ones that aren't. `keyring:import` keeps when an imported authenticator app or passkey was first confirmed, so older ones are established from the start. See [Importing Two Factor Data](https://keyringauth.com/docs/0.x/upgrading-from-fortify#importing-two-factor-data).

### Making a Change With an Established Key

While frozen, the owner can still make one change by proving a passkey or security key in the same request. The key must be established, and added before this session signed in. A key added in this session never counts. The proof answers for that change alone. A recent sign-in or step-up doesn't count, even with the same key, so a copy of the session cookie can't make the change.

It takes two requests. First, ask for the options:

1. `POST /user/authenticators/{factor}/proof-options`, where `{factor}` is the key's factor, such as `passkey`. Send `action` (`remove`, `rename` or `replace`) and `target`: the authenticator's ID for `remove` and `rename`, or the factor's key for `replace` (`recovery` for new recovery codes). A `rename` also sends the new `name`, and the proof works only for that name.

The answer is `{ "options": {...} }`, WebAuthn request options that list only the keys that can make the change. With none, it's a `422` on `proof`.

Then run the ceremony, and send the change's own request again with `proof`:

2. The proof is `{ "factor": "passkey", "credential": {...} }`. That's the `DELETE` for a removal, the `PATCH` with the same `name` for a rename, and the `POST` that begins them for new recovery codes.

The challenge lasts `webauthn.login_options_for` (5 minutes) and works once. A wrong answer is a `422` on `proof`, and it counts against the factor's rate limits.

An authenticator app can do the same when `authenticator_changes.skip_with_totp` is `true`. Its six-digit codes can be phished as they're typed, so it's off by default. When it's on, `skip` lists `totp` too. Send `{ "factor": "totp", "code": "123456" }` as `proof`, with no options request. With more than one app, add `authenticator` with the ID of the one the code is from.

Recovery codes, email codes and the password can never make the change, since whoever holds the session may have them. A factor of your own can, when its `phishingResistant()` returns `true`. Its `challenge()` and `verify()` do the work, and its challenge must bind the answer to the change.

The change still freezes the account afterwards, and the key that proved it may remove itself in the same request.

### Getting Past the Freeze

Your own code, such as a support tool, may need to change an authenticator while the account is frozen. After checking who you're talking to, pass `ignoreFreeze: true`:

```php
use Keyring\Changes\AuthenticatorChanges;

app(AuthenticatorChanges::class)->remove($user, $authenticatorId, ignoreFreeze: true);
app(AuthenticatorChanges::class)->add($user, $factor, $authenticator, ignoreFreeze: true, passwordConfirmed: true);
app(AuthenticatorChanges::class)->update($authenticator, ['name' => 'Work phone'], ignoreFreeze: true);
```

Only use this from code the user can't reach on their own. It skips the freeze and nothing else. Every other check still applies, and `remove()` still demands the password for the last second factor. `add()` also needs `passwordConfirmed: true` while the account has no established second factor, for a second factor or a step sent to an address of its own, and throws `PasswordRequired` without it where the account has a password to ask for. Where it doesn't, the factor is marked, so an `ifEnrolled()` policy doesn't ask for it until it's [established](https://keyringauth.com/docs/0.x/authenticators#established-authenticators). The change still freezes the account afterwards.

## Signing Out Other Sessions

Someone else may be signed in while a user adds or removes a sign-in method. Confirming an enrollment (including one that makes new recovery codes) and removing an authenticator both accept `sign_out_others`. When it's `true` and the change goes through, Keyring signs the user out everywhere except here, as [`DELETE /user/sessions`](https://keyringauth.com/docs/0.x/devices-and-sessions#listing-and-ending-sessions) does. This session carries on under a new ID.

```ts
// confirmEnrollment sends its fields as they are
await confirmEnrollment('totp', enrollment, { code, sign_out_others: true })

// removeAuthenticator takes an option, and sends it as sign_out_others
await removeAuthenticator(id, undefined, { signOutOthers: true })
```

It's off unless the request asks for it, so you can offer it as a checkbox. A value that isn't a boolean is an error on `sign_out_others`, before the enrollment is spent.

## From JavaScript

```ts
import { beginEnrollment, confirmEnrollment, enroll, makeDefault, proveWithKey, removeAuthenticator, renameAuthenticator } from '@keyringjs/keyring'

// Passkeys and security keys need no input in between. The password goes with
// the beginning, for an account with no established second factor.
const { authenticator, recoveryCodes } = await enroll('passkey', { name: 'Laptop', password })

// Authenticator apps: show the QR code, then ask for a code.
const { enrollment } = await beginEnrollment('totp', { password })
// ...render enrollment.qr...
await confirmEnrollment('totp', enrollment, { code })

await renameAuthenticator(id, 'Work phone')
await makeDefault(id)
await removeAuthenticator(id)

// While frozen, with the owner's established passkey.
const proof = await proveWithKey('passkey', { action: 'remove', target: id })
await removeAuthenticator(id, undefined, { proof })
```

`confirmEnrollment()` runs the browser's WebAuthn ceremony for any WebAuthn enrollment, such as a passkey or a security key. A failed helper throws a `KeyringRequestError`, including the `423` from a step-up. See [Frontend](https://keyringauth.com/docs/0.x/frontend#managing-authenticators).

## From PHP

`$user->keyring`, or `Keyring::for($user)`, gives you a `Keyring\UserKeyring`:

```php
use Keyring\Enums\Category;

$user->keyring->all();                         // every confirmed authenticator, default first
$user->keyring->default();                     // the default, or the first one a challenge can ask for
$user->keyring->of('security-key');            // one factor's authenticators
$user->keyring->find($id);
$user->keyring->has(Category::Possession);
$user->keyring->canMeet($requirement);
$user->keyring->canConfirm($requirement);      // could the confirm page meet it, building on what's proved?
$user->keyring->freshlyProvable();             // what could count as fresh
$user->keyring->canSignIn();                   // can anything start a login?
$user->keyring->isEstablished($authenticator);
```

Keyring caches the result on the model. After changing authenticators in the same request, call `$user->keyring->refresh()`.

`$user->authenticators()` is an ordinary Eloquent relationship. Secrets, public keys and credential IDs are hidden when the model is serialised, and `secret` is encrypted at rest.

## Routes

| Method | URI | Name | Does |
|---|---|---|---|
| `POST` | `/user/authenticators/{factor}` | `keyring.authenticators.store` | Begins an enrollment. May check the [password](https://keyringauth.com/docs/0.x/authenticators#the-password-for-a-first-second-factor). |
| `POST` | `/user/authenticators/{factor}/confirm` | `keyring.authenticators.confirm` | Finishes the enrollment. Rate limited by the `keyring` limiter. |
| `POST` | `/user/authenticators/{factor}/proof-options` | `keyring.authenticators.proof-options` | Returns the challenge for one change to a [frozen](https://keyringauth.com/docs/0.x/authenticators#making-a-change-with-an-established-key) account. Rate limited by the `keyring` limiter. |
| `PATCH` | `/user/authenticators/{authenticator}` | `keyring.authenticators.update` | Renames the authenticator, or makes it the default. |
| `DELETE` | `/user/authenticators/{authenticator}` | `keyring.authenticators.destroy` | Removes the authenticator. Rate limited by the `keyring` limiter. |

Every route needs a signed-in user who passes `changes_middleware`, which defaults to `['keyring.fresh:15m']`. That means a recent verification with the strongest combination the account offers. Impersonating users are refused. See [Fresh Verification](https://keyringauth.com/docs/0.x/step-up#fresh-verification).

The `{factor}` must be a registered factor that implements `Enrollable`, or the route returns a 404. Users can only see and change their own authenticators, and another user's ID is a 404 too.

## Responses

Each route answers with a [status response](https://keyringauth.com/docs/0.x/sign-in-flow#status-responses). JSON requests get `status`, `message` and the extra data:

| Action | `status` | Also |
|---|---|---|
| Begin | `enrollment-started` | `factor`, `enrollment` |
| Confirm | `authenticator-added` | `authenticator`, `recoveryCodes` (when made), `continue` (when set) |
| Update | `authenticator-updated` | `authenticator` |
| Remove | `authenticator-removed` | |

`proof-options` always answers with JSON. For a key, that's `{ "options": {...} }`.

Other requests are redirected back with the `status` flashed to the session. The extra data is flashed too, encrypted, for the next request. Read it with `Keyring::result()`, or one key with `Keyring::result('enrollment')`. The [browser package](https://keyringauth.com/docs/0.x/frontend#managing-authenticators) uses the JSON form.

## Events

These are in `Keyring\Events`:

| Event | Properties |
|---|---|
| `AuthenticatorAdded` | `user`, `authenticator` |
| `AuthenticatorRemoved` | `user`, `authenticator` |
| `RecoveryCodesGenerated` | `user`, `authenticator`. Confirming `recovery` dispatches this instead of `AuthenticatorAdded`. |
| `RecoveryCodeUsed` | `authenticator`, `remaining` |
| `EnrollmentRefused` | `user`, `factor`, `reason` (`invalid`, `not_allowed`, `frozen` or `password`) |
| `AuthenticatorRemovalRefused` | `user`, `authenticator`, `reason` (`last_factor` or `frozen`) |
| `AccessRefused` | `user`, `resource`, `id` |

The last three record what was turned away. Each still gets its usual 422, 403 or 404, and each is written to the [security log](https://keyringauth.com/docs/0.x/security-log-and-emails#entry-types).
