# Configuration

Source: https://keyringauth.com/docs/0.x/go/configuration

## Introduction

You configure Keyring in two places:

- `keyring.Config` holds values: features, timeouts, limits, route options, factors, providers and emails. Change it in the functions you give `keyring.New`.
- The `*Keyring[U]` that `New` returns holds behaviour that runs your code: your actions, the policy, the pipeline, risk signals, and who may sign in, enroll or impersonate. Chain these on it before listing it in `laravel.Options.Packages`.

```go
k := keyring.New[models.User](func(cfg *keyring.Config) {
	cfg.Home = "/home"
	cfg.Sessions.Idle = time.Hour
}).AllowSignInWhen(func(_ context.Context, user *models.User) bool {
	return user.BannedAt == nil
})
```

`BannedAt` is a field of your own user type.

There's no `config/keyring.php` and nothing to publish. `Register` starts from the PHP package's defaults, reads the environment, then runs your functions, so you only set what you change. Keyring reads three environment variables of its own: `KEYRING_HOME`, `KEYRING_SESSION_USER_TYPE` and `KEYRING_WEBAUTHN_RP_ID`. It also reads `APP_URL`, `APP_NAME`, `APP_ENV`, `DB_CONNECTION` and `DATABASE_URL`.

Set nested settings one field at a time (`cfg.Sessions.Levels.AAL2.Idle = ...`). Assigning a whole struct, such as `cfg.Features = keyring.Features{Devices: true}`, leaves its other fields at zero, which turns the security log off or is refused.

A setting Keyring can't work with, such as a password minimum under eight or a TOTP window over one, stops `Register` with an error naming it, rather than failing a request. So does a feature that's on without what it needs.

`k.Config()` returns the settings as `Register` left them.

## Durations

Durations are `time.Duration` values, such as `15 * time.Minute`. There are no strings like `"15m"`. Where the PHP package takes `null` for "no limit", Keyring for Go takes zero, and each setting below says when zero means that.

## Guard and Users

| Setting | Default | Notes |
|---|---|---|
| `Guard` | `web` | Recorded with each session. Laravel for Go has one session guard, so it only names it. |
| `Username` | `email` | The field the login form sends the username in, and the column `auth.ModelUsers` finds it in. Can't be empty. |
| `Email` | `email` | The field registration reads the address from, and the users table's column it's kept in, as the PHP package's `keyring.email`. |
| `AuthenticatableType`, `SessionUserType` (`KEYRING_SESSION_USER_TYPE`) | `App\Models\User`, `DB_CONNECTION:users` | How a user's type is written in Keyring's tables. See [The Two User Types](https://keyringauth.com/docs/0.x/go/installation#the-two-user-types). |

Keyring finds users with `auth.ModelUsers[U]` unless you give it your own `auth.Users[U]` with `FindUsersWith`. It lowercases and trims input before it looks users up, as the PHP package does. See [Finding the User](https://keyringauth.com/docs/0.x/go/sign-in-flow#finding-the-user).

## Features

```go
cfg.Features.Registration = true
cfg.Features.ResetPasswords = true
cfg.Features.EmailVerification = true
cfg.Features.UpdatePasswords = true
cfg.Features.ManageAuthenticators = true
cfg.Features.Devices = true
cfg.Features.EmailChanges = true
cfg.Features.Impersonation = true
```

Signing in and out, challenges and step-up are always on. Everything else is a `bool` in `Features`, which adds its routes only once it's on. **Registration, resets, email verification, password changes and email changes start off**, unlike the PHP package, whose config turns them on, since each runs code of yours. `SecurityLog` starts on. Turn one on and give Keyring what it needs:

| Feature | Needs |
|---|---|
| `Registration` | `CreateUsersWith()`, a `CreatesNewUsers`. And `EmailVerification` unless `Registration.RevealTaken` is on. |
| `ResetPasswords` | `ResetPasswordsWith()`, a `ResetsUserPasswords`. |
| `UpdatePasswords` | `UpdatePasswordsWith()`, an `UpdatesUserPasswords`. |
| `EmailVerification` | A user type with an `EmailVerifiedAt` field or `EmailVerified bool`, found by an `auth.EmailVerifier` (`auth.ModelUsers` is one). |
| `EmailChanges` | `ValidateEmailChangesWith()`, a `ValidatesEmailChanges`. |
| `ManageAuthenticators` | With `Registration` on, `EmailVerification` too, or `AllowEnrollmentWhen()`. |
| `Impersonation` | `AllowImpersonationWhen()`. Until then nobody may. |
| `SecurityLog` | Nothing. Off, entries go to the application's log instead. |

Single sign-on is a factor rather than a feature: `Factors.SingleSignOn`, with providers in `SSO.Providers`. See [Single Sign-On](https://keyringauth.com/docs/0.x/go/configuration#single-sign-on).

## Registration

| Setting | Default | Notes |
|---|---|---|
| `Registration.RevealTaken` | `false` | Say when an address is taken, and sign new users in straight away. |

There's no switch to hold back unverified users with registration off, as the Rust crate's `verified_before_sign_in` is. As in the PHP package, unverified users are held back while registration is on and `RevealTaken` is off. A Go application sharing users with a PHP application that registers should turn registration on too. See [Registration](https://keyringauth.com/docs/0.x/go/sign-in-flow#registration).

## Redirects

| Setting | Default | Notes |
|---|---|---|
| `Home` (`KEYRING_HOME`) | `/dashboard` | Where users go after signing in, confirming or verifying their address, when there's no intended URL on this site. |

A signed-in browser at a guest page goes where Laravel's `RedirectIfAuthenticated` sends it: the route named `dashboard`, else the route named `home`, else the site's root. Laravel for Go has no `redirectUsersTo()`, so a Go application sharing users with a PHP application that calls it should name the route it points to `dashboard`. See [Where They Go Next](https://keyringauth.com/docs/0.x/go/sign-in-flow#where-they-go-next).

## Routes

| Setting | Default | Notes |
|---|---|---|
| `Routes` | `true` | Whether Keyring adds its routes to the `web` group. |
| `Prefix` | Empty | A path Keyring's routes are under, such as `/account` for `/account/login`. |

There's no `domain` setting and no `middleware` setting. Keyring's routes carry the PHP package's names, and every URL Keyring makes to its own routes (redirects, JSON and emailed links) goes by those names, so they follow `Prefix` and wherever you place them.

Keyring's responses get the PHP package's security headers from `SecurityHeaders`, which Keyring puts on its own routes: `Cache-Control: no-store, private`, `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY` and `Cross-Origin-Opener-Policy: same-origin-allow-popups`, with `Referrer-Policy: same-origin`, or `no-referrer` on pages that emailed links open.

To add nothing and place the routes yourself, set `Routes` to `false` and call `Routes` on the `*Keyring` in your own `web` routes:

```go
k := keyring.New[models.User](func(cfg *keyring.Config) {
	cfg.Routes = false
})

return laravel.Options{
	Packages: []laravel.Package{k},
	Routes: laravel.Routes{
		Web: func(route *routing.Router, cfg *config.Config) {
			routes.Web(route, cfg)
			route.Middleware(AuditTrail{}).Group(func(route *routing.Router) {
				k.Routes(route)
			})
		},
	},
}
```

`AuditTrail` is a middleware of your own. `Routes` adds the routes under `Prefix` itself, so set that in the config rather than wrapping them in a group with a prefix of your own. Keep them in the `web` group: the routes that take the session lock need it. See [Routes](https://keyringauth.com/docs/0.x/go/differences#routes) for what else differs.

## Pages

| Setting | Default | Notes |
|---|---|---|
| `Pages` | `true` | Render Keyring's pages for a request that doesn't want JSON. Off, those are a `404`, and JSON requests still get the page's name and props. |

Keyring renders its [pages](https://keyringauth.com/docs/0.x/go/sign-in-flow#pages) as the Inertia components `auth/{page}`. There are no views, and no way to rename a page or answer one your own way, as `Keyring::page()` does. Turn `Pages` off when every page lives in a frontend Laravel for Go doesn't serve. See [Headless Frontends](https://keyringauth.com/docs/0.x/go/headless).

## WebAuthn

| Setting | Default | Notes |
|---|---|---|
| `Factors.Passkeys` | `true` | Whether the application has passkeys. Off, their routes are a `404`, and a user who has one can't sign in until it's back. |
| `WebAuthn.RelyingPartyID` (`KEYRING_WEBAUTHN_RP_ID`) | `APP_URL`'s host | `localhost` when there's no `APP_URL`. |
| `WebAuthn.Origins` | `APP_URL`'s origin | An origin that isn't a full URL, or a relying party ID that isn't each origin's host or a parent of it, stops `Register`. |
| `WebAuthn.Timeout` | 60 seconds | |
| `WebAuthn.LoginOptionsFor` | 5 minutes | How long the options for a passkey sign in are kept for the answer, never less than the timeout. |
| `WebAuthn.RequireUserVerification` | `true` | Whether a passkey on the challenge page has to verify the user. Signing in with a passkey alone always asks for it. |
| `WebAuthn.Algorithms` | `ES256`, `EdDSA` | The signatures keys may use, in order. `RS256` is taken when listed. Any other name stops `Register`. |
| `WebAuthn.MinimumRSABits` | 2048 | The shortest RSA key `RS256` takes, never under 2048. |

Attestation, security keys, more key factors, `attestation_roots` and your own `TrustsAuthenticators` aren't ported yet. Keyring takes `none` attestation alone. See [Passkeys & Security Keys](https://keyringauth.com/docs/0.x/go/passkeys) and [Differences From PHP](https://keyringauth.com/docs/0.x/go/differences#passkeys-and-attestation).

## Single Sign-On

| Setting | Default | Notes |
|---|---|---|
| `Factors.SingleSignOn` | `false` | Whether users can sign in with, link and confirm through identity providers. |
| `SSO.Providers` | Empty | The identity providers, as `SSOProvider` values (`keyring.OIDCProvider()`, `GoogleProvider()`, `MicrosoftProvider()`, `GitHubProvider()`), in the order the login page lists them. A name given twice stops `Register`. |
| `SSO.RequestFor` | 10 minutes | How long a user sent to a provider has to come back. |
| `SSO.CacheFor`, `SSO.Store` | One hour, the default store | How long providers' discovery documents and keys are cached, and in which cache store. |
| `SSO.ResolveHosts` | `nil` | Every address a host has, for telling whether an endpoint points inside your network. `nil` asks DNS. For tests. |
| `cfg.SSO.Extend(driver, resolve)` | | Adds a driver of your own. |

See [Single Sign-On](https://keyringauth.com/docs/0.x/go/sso).

## Account Changes and Enrollment

| Setting | Default | Notes |
|---|---|---|
| `ChangesMiddleware` | `RequireFreshVerification[U]{}`, 15 minutes | What Keyring's routes that change how the user signs in run (sessions, devices, authenticators, the password and the email address), the PHP package's `changes_middleware`. `nil` lets those routes through on any signed-in session. List others in its place, such as `RequireFreshVerification[models.User]{Within: 5 * time.Minute}`. It doesn't change `RequireFreshVerification` on your routes. |
| `EstablishedAfter` | 7 days | How long before a new authenticator raises what's asked, and how long the freeze lasts. Zero turns the freeze off. |
| `SkipFreezeWithTotp` | `false` | Whether an established authenticator app can prove a change to a frozen account. |
| `EnrollmentsFor` | 15 minutes | How long an enrollment can be confirmed for. |
| `EnrollmentURL` | Empty | Where a user who has to set up another sign-in method first is sent: the `redirect` of the `403` `enroll-first`. |
| `EnrollmentExcept` | Empty | Route names of your own a user who still has to enroll may reach past `RequireEnrollment`. A `*` matches anything. |
| `AuthenticatorsURL` | Empty | Your page for sign-in methods, for the emails that link to it. A path goes after `APP_URL` (or the root `LinkRoot` gives), never the request's host, and a full URL is used as it is. |
| `Factors.TotpWindow` | 1 | How many 30 second steps either side of now an authenticator app's code may be from. Only 0 or 1. |
| `Factors.TotpIssuer` | `APP_NAME` | The name an authenticator app shows beside a new account's codes. |
| `Factors.TotpAlgorithm` | `totp.SHA1` | The digest a new authenticator app makes its codes with. |
| `Factors.RecoveryCodes` | 8 | How many codes a new set has. |
| `Factors.EmailCodes` | `nil` | Emailed codes, as `keyring.EmailCodesAsExtraStep()`. See [Email Codes](https://keyringauth.com/docs/0.x/go/factors#email-codes). |
| `Factors.EmailCodes.Link` | `false` | A "Sign in" button beside the code in the sign-in email, as `keyring.EmailCodesAsExtraStep().WithLink()`. See [Signing In From the Email](https://keyringauth.com/docs/0.x/go/factors#signing-in-from-the-email). |

`AllowEnrollmentWhen()` on the `*Keyring` decides who may add a sign-in method. See [Managing Authenticators](https://keyringauth.com/docs/0.x/go/authenticators).

## Devices

| Setting | Default | Notes |
|---|---|---|
| `Devices.Cookie` | Empty | The device cookie's name. Empty gives `known_device`, with the `__Host-` or `__Secure-` prefix over HTTPS. |
| `Devices.CookieLifetime` | 400 days | |
| `Devices.Limit` | 50 | Devices per account. A new one takes the place of the one seen longest ago, and that device's sessions are signed out. Zero is no limit. |
| `Devices.TrustFor` | 30 days | How long "don't ask again on this device" trusts a device. Zero never offers it. |
| `Devices.ReportLinkFor` | 7 days | How long a "this wasn't me" link works. |
| `Devices.KeepRevokedFor`, `KeepUnseenFor` | 30 days, 365 days | How long `keyring:prune` keeps a signed-out device, and one nobody has signed in from. Zero is the default, so a `Devices` set whole doesn't delete every device. A negative one stops `Register`. |
| `Devices.Locator` | `nil` | Works out where a request comes from: a `LocatesIPs`, such as `keyring.CloudflareLocator()` or a `HeaderLocator` of your own. |
| `Devices.Describe` | Keyring's own | Names a browser from its user agent your own way, a `func(userAgent string) string`. |

See [Devices & Sessions](https://keyringauth.com/docs/0.x/go/devices-and-sessions#devices).

## Sessions

| Setting | Default | Notes |
|---|---|---|
| `Sessions.Idle`, `Absolute` | 2 hours, 30 days | The idle and absolute timeouts. Zero `Idle` is no limit. `Absolute` can't be turned off. |
| `Sessions.Levels` | AAL2 1 hour idle and 24 hours absolute, AAL3 15 minutes and 12 hours | Each level's own clock, as `Levels.AAL2` and `Levels.AAL3`, each a `LevelLimits` with `Idle` and `Absolute`. Zero is the session's own. |
| `Sessions.EndOnLapse` | `false` | Whether a session ends once the level it signed in at lapses. |
| `Sessions.RememberIdle` | 14 days | How long a session that ticked "remember me" may go unused, in place of the idle timeout. |
| `Sessions.RememberCookie` | Empty | The name of the cookie that ties "remember me" to its session. Empty gives `remembered_session`, prefixed over HTTPS like the device cookie. |
| `Sessions.RememberGrace` | 10 seconds | How long after "remember me" brings a session back the browser's other requests sent alongside join it. |
| `Sessions.Max` | 100 | How many sessions an account has at once. Zero is no limit. |
| `Sessions.Middleware` | `true` | Whether Keyring adds `AuthenticateSession` and `RequirePasswordChange` to the `web` group. |
| `Sessions.OverlappingRequests` | `true` | Keeps a request sent before a sign in, step-up or sign-out from undoing it, as the PHP package's `sessions.overlapping_requests`. It covers the `web` group's `StartSession`. |
| `Sessions.ContinueAsGuest` | Empty | Route names of your own pages that also serve guests, as `web.Request.RouteIs` takes them (`docs.*`, say). |
| `Sessions.SweepEvery` | Zero | How often `keyring:sweep` runs. Zero leaves it off, as the PHP package's `null`. Under a minute is a minute, and over 12 hours is 12 hours. A negative one stops `Register`. |
| `Sessions.SweepLimit` | 1000 | How many sessions one sweep ends, and how many it announces again, at most 10,000 of each. Zero is 1000. A negative one stops `Register`. |
| `PruneAt` | `03:00` | When `keyring:prune` runs each day, in UTC. Empty leaves scheduling it to you. Anything but a 24-hour time stops `Register`. |

Keyring keeps the session registry in `keyring_sessions` on the application's database. There's no driver, connection, table or store setting, and no `sessions.block`: list `BlockSession` on a route of your own to take the session lock. See [Devices & Sessions](https://keyringauth.com/docs/0.x/go/devices-and-sessions).

## Impersonation

| Setting | Default | Notes |
|---|---|---|
| `Impersonation.Lifetime` | One hour | How long an impersonation lasts. `Sessions.Absolute` caps it, and `Register` refuses one under a second while `Features.Impersonation` is on. |
| `Impersonation.ShowInSessions`, `ShowInActivity` | `nil`, `nil` (on) | Whether the user's sessions list shows the impersonated session, and the activity its start and end. There's no activity feed yet, so nothing reads `ShowInActivity`. |
| `Impersonation.Middleware` | `RequireAssurance[U]{Level: keyring.AAL2}`, `RequireFreshVerification[U]{Within: 15 * time.Minute}` | What starting asks of the impersonator's session, the PHP package's `impersonation.middleware`. `Register` fills it in when it's `nil`. An empty list asks for nothing more. |
| `Impersonation.RedirectURL`, `ReturnURL` | Empty | Where starting goes, and where going back goes. Empty is `Home`. |

Who may impersonate whom is `AllowImpersonationWhen()`. Set the fields one at a time: assigning `cfg.Impersonation` whole leaves `Lifetime` at zero, which `Register` refuses. See [Impersonation](https://keyringauth.com/docs/0.x/go/impersonation).

## Protected Attributes and Email Changes

| Setting | Default | Notes |
|---|---|---|
| `Protected` | Empty | Attributes of your own besides the password and the address that only Keyring's flows may change, for `GuardChanges`. |
| `GuardChangesManually` | `false` | Your application calls `GuardChanges` itself before every write of a user, for users that aren't Laravel Go models. Without it, `Register` refuses a user type with no `Updating` hook while anything is protected. |
| `EmailChanges.ConfirmableFor` | 24 hours | How long a change can be confirmed from its emailed links. |
| `EmailChanges.RevertableFor` | 7 days | How long the old address can undo a change, and stays reserved. |
| `EmailChanges.EstablishedAfter` | 7 days | How long a second factor has to be held before the session that proved it skips confirming from the current address. |
| `EmailChanges.SignOutOthers` | `true` | Whether applying a change signs out every other session. |
| `EmailChanges.KeepEndedFor` | 30 days | How long `keyring:prune` keeps a change that ended. Zero is 30 days, so an `EmailChanges` set whole doesn't delete every change. A negative one stops `Register`. |

`WithoutProtection()` on the `*Keyring` runs a change of trusted admin tooling past `GuardChanges`. See [Protected Changes](https://keyringauth.com/docs/0.x/go/protected-changes).

## Passwords

| Setting | Default | Notes |
|---|---|---|
| `Passwords.MinWithoutMFA` | 15 | The shortest new password `PasswordRules` takes at registration and from a user without a second factor. Under eight stops `Register`. |
| `Passwords.MinWithMFA` | 8 | The shortest new password `PasswordRules` takes from a user with a second factor. Under eight stops `Register`. |
| `Passwords.Max` | 128 | The longest new password `PasswordRules` takes. Zero is no limit, though bcrypt's 72 bytes still come first. |
| `Passwords.Uncompromised`, `RefuseUnchecked` | `nil`, `false` | Whether `PasswordRules` asks Have I Been Pwned about a new password (`nil` asks in production), and whether one it couldn't ask about is refused. |
| `Passwords.Context` | Empty | Words of your app's own, besides `APP_NAME`, that a new password mustn't be made of. |
| `Passwords.ResetLinkFor`, `ResetThrottle` | One hour, one minute | How long a reset link works, and how soon another can be sent, as Laravel's broker. |
| `VerificationLinkFor` | One hour | How long a verification link works, as `auth.verification.expire`. |
| `PasswordChangeURL` | Empty | Where a held user changes their password: the `redirect` of the `403` `change-password`. |
| `PasswordChangeExcept` | Empty | Route names of your own a held user may still reach. A `*` matches anything. |

See [Password Rules](https://keyringauth.com/docs/0.x/go/protected-changes#password-rules).

## Risk

| Setting | Default | Notes |
|---|---|---|
| `Risk.Levels` | 30, 60, 90 | The scores at which risk is medium, high and critical (`Medium`, `High`, `Critical`). They must go up, with a medium of at least 1. |
| `Risk.RecentChange` | 7 days | How recently an email change counts for `RecentlyChangedRecovery`. |
| `Risk.Store` | The default store | The cache store risk locks are kept in, by name. One that isn't configured fails the first request that looks for a lock. |

The signals and the response are code: `RiskSignals()` adds signals, as `Keyring::risk()->push()`, and `RespondToRisk()` replaces Keyring's own response, as `Keyring::risk()->respond()`. See [Risk](https://keyringauth.com/docs/0.x/go/risk).

## Security Log

| Setting | Default | Notes |
|---|---|---|
| `Features.SecurityLog` | `true` | Whether entries go to `keyring_events`. Off, each goes to the application's log (`slog.Default()`) under a `keyring` group. |
| `SecurityLog.ContextKey` | `trace_id` | Where your application keeps a request's ID in its log context (`log.With`). Without one, Keyring makes a UUID per request. Empty writes no request IDs. |
| `SecurityLog.Refusals`, `RefusalsPer` | 20, one hour | How many entries of one refused kind are written per account or address. Zero `Refusals` is no limit. |
| `SecurityLog.Alerts` | As the PHP package | The entry types a sign in answers as `alerts`. |
| `SecurityLog.KeepFor` | 180 days | How long `keyring:prune` keeps an entry. Zero is 180 days, so a `SecurityLog` set whole doesn't delete the log. A negative one stops `Register`. |
| `Notifications.Off` | Empty | The security emails not to send, by type, such as `new_device`. A type Keyring doesn't send stops `Register`. |
| `Notifications.Mail`, `Notifications.AccountMail` | `nil` | Your own security emails, and your own registration, verification and reset emails. See [Security Emails](https://keyringauth.com/docs/0.x/go/security-log-and-emails#security-emails). |
| `SupportContact` | Empty | Where to get help, which every security email ends with. |
| `LinkRoot` | `APP_URL` | Where the links in Keyring's emails start, as `Keyring::linkRootUsing()`: a `func(ctx context.Context) string`. |

There's no `security_log.channel`, `security_log.unlisted` or `recordIpsUsing` yet. See [Security Log & Emails](https://keyringauth.com/docs/0.x/go/security-log-and-emails).

## Pending Logins, Timebox and Rate Limits

| Setting | Default | Notes |
|---|---|---|
| `PendingLogins` | 10 minutes | How long a password can wait for its second factor. |
| `Timebox` | 500 ms | The least time a refused sign in takes, so the response doesn't reveal whether an account exists. |
| `Limits.PerAccount`, `PerIP` | 5, 20 | Sign-in attempts a minute for an account and from an address. `PerAccount` can't be zero. |
| `Limits.Consecutive`, `ConsecutiveElsewhere` | 100, 80 | Failures in a row before a method is refused until cleared, and how many of them browsers the account hasn't signed in from may make. `ConsecutiveElsewhere` needs `Features.Devices`. |
| `Limits.LongestLock`, `LongestIPLock` | One day, 15 minutes | The longest a doubling lock lasts, for an account and for an address. |
| `Limits.LockAfter` | 0 | Locks in a day after which an account is held as if its failures in a row were used up. Zero never does. |
| `Limits.RememberNamesFor` | 30 days | How long the failures under a name as it was typed are kept. |
| `Limits.LoginOptions` | 60 | The `keyring-login-options` limiter: passkey options, a primary factor's of your own and single sign-on redirects a minute from an address. |
| `Limits.SessionChanges`, `SessionChangesPerUser` | 6, 30 | The `keyring-session-changes` limiter: a minute from one session, and from all the user's together. |
| `Limits.Codes`, `CodesPer` | 3, ten minutes | How many codes an account is sent for one factor in each of three buckets. |
| `Limits.Notices`, `NoticesPer` | 5, one hour | How many security emails of one kind an account gets. |
| `Limits.Forms`, `GuestForms`, `Pages` | 6, 6, 60 | The `keyring` limiter on the form routes, a minute per signed-in user and per address, and `keyring-pages` on the pages emailed links open. |

Zero is no limit for each count but `PerAccount` and `Codes`. The limiters are the PHP package's, under the same names in the security log and `RateLimited`, but they're settings rather than limiters you redefine, as Laravel for Go's `rate` is a token bucket rather than Laravel's fixed-window `RateLimiter`. Rate limits are counted in the default cache store. See [Rate Limiting](https://keyringauth.com/docs/0.x/go/security#rate-limiting).

## Messages and Translations

Laravel for Go has no translator or locale, so there are no translation files. Every message is the PHP package's English one, and `keyring.StatusMessage(slug)` gives a status's. Email wording lives in your own functions on `Notifications`. See [Your Own Templates](https://keyringauth.com/docs/0.x/go/security-log-and-emails#your-own-templates).

## The Keyring Facade

There's no facade. What you set in code goes on the `*Keyring` or in the config, and `keyring.From[models.User](ctx)` gives the `*Keyring` back for the rest:

| PHP | Go |
|---|---|
| `Keyring::factors([...])` | `Factors` and `WebAuthn` in the config. See [Factors](https://keyringauth.com/docs/0.x/go/factors). |
| `Keyring::extend($key, $resolver)` | `AddCodeFactor()` for a code factor, `AddPrimaryFactor()` for a primary factor. See [Factors](https://keyringauth.com/docs/0.x/go/factors#writing-a-code-factor) and [Primary Factors](https://keyringauth.com/docs/0.x/go/factors#primary-factors). |
| `Keyring::attempt($request, $factor)`, `SignIn::as()` | `Attempt()`, `AttemptSSO()` and `SignInAs()`. See [Starting a Sign In Yourself](https://keyringauth.com/docs/0.x/go/sign-in-flow#starting-a-sign-in-yourself). |
| `Keyring::require($requirement)` | `Require()`, a function returning a `Requirement`. See [Policies](https://keyringauth.com/docs/0.x/go/policies). |
| `Keyring::pipeline($callback)` | `Pipeline()`. See [The Verification Pipeline](https://keyringauth.com/docs/0.x/go/sign-in-flow#the-verification-pipeline). |
| `Keyring::respondWith(...)` | Not available. See [Responses](https://keyringauth.com/docs/0.x/go/sign-in-flow#responses). |
| `Keyring::page($name, $component)` | Not available: pages are always `auth/{page}`. |
| `Keyring::risk()->signals([...])->respond(...)` | `RiskSignals()` and `RespondToRisk()`. See [Risk](https://keyringauth.com/docs/0.x/go/risk). |
| `Keyring::notifications([...])` | `Notifications` in the config: `Off`, `Mail` and `AccountMail`. |
| `Keyring::createUsersUsing()`, `resetUserPasswordsUsing()`, `updateUserPasswordsUsing()`, `validateEmailChangesUsing()` | `CreateUsersWith()`, `ResetPasswordsWith()`, `UpdatePasswordsWith()` and `ValidateEmailChangesWith()`. |
| `Keyring::routes()` | `Routes()`, with `Config.Routes` off. |
| `Keyring::useAuthenticatorModel()` and the rest | Not available: there are no models. |
| `Keyring::requirePasswordChange()`, `requiresPasswordChange()`, `cancelPasswordChange()` | `RequirePasswordChange()`, `RequiresPasswordChange()`, `PasswordChangeReason()` and `CancelPasswordChange()`. |
| `Keyring::unlock($user)` | `Unlock()`. `ClearAccount()` starts the account's sign-in limits over. A second factor's limits can't be cleared alone yet. |
| `Keyring::allowSignInWhen()`, `allowEnrollmentWhen()`, `allowImpersonationWhen()` | `AllowSignInWhen()`, `AllowEnrollmentWhen()` and `AllowImpersonationWhen()`. |
| `Keyring::impersonate()`, `stopImpersonating()` | `Impersonate()` and `StopImpersonating()`. |
| `Keyring::linkRootUsing()` | `LinkRoot` in the config. |
| `Keyring::sso()` | `cfg.SSO.Extend()`, and `StartSSO()`, `CompleteSSO()`, `LinkedSSO()` and `LinkNewAccount()`. |
| `Keyring::recordIpsUsing()` | Not available yet. |
| `Keyring::describeDevicesUsing()` | `Devices.Describe` in the config. |
| `Keyring::findUsersUsing()` | `FindUsersWith()`. |
| `Keyring::normalizeUsernamesUsing()` | Not available: usernames are trimmed and lowercased. |
| `Keyring::signInAfterRegistering()` | `Registration.RevealTaken` in the config. |
| `Keyring::withoutProtection()` | `WithoutProtection()`. |
| `Keyring::fake()` | `keyringtest.New[U](t, client).Fake()`. See [Faking Factors](https://keyringauth.com/docs/0.x/go/testing#faking-factors). |
| `Keyring::activity()`, `unlistedActivityTypes()` | Not available yet. `PullAlerts()`, `CountEntries()` and `AccountsFrom()` read the log. |
| `Keyring::for($user)` | `SignInMethods()` for what a settings page shows. `UserHandle()` gives the handle a new passkey of the user's knows them by, and `GenerateRecoveryCodes()` makes a set of codes. |

These answer questions about your setup:

| PHP | Go |
|---|---|
| `Keyring::registered()`, `hasFactor()`, `factor()` | Not available: read `Config()`. |
| `Keyring::normalizeUsername()` | Not available. |
| `Keyring::requirementFor()` | `RequirementFor()`. |
| `Keyring::policy()` | `Policy()`. |
| `Keyring::statusMessage()`, `result()` | `keyring.StatusMessage()` and `keyring.FlashedResult()`. See [Flash Messages and Alerts](https://keyringauth.com/docs/0.x/go/frontend#flash-messages-and-alerts). |
| `Keyring::render()` | Not available. |
| `Keyring::protectedAttributes()` | `ProtectedAttributes()`. |
| `Keyring::describeDevice()` | `Devices.Describe`, and `useragent.Describe()` for Keyring's own reading. |
| `Keyring::linkRoot()` | Not available. |
| `Keyring::steps()`, `dangerouslyChangedSteps()` | `StepNames()` and `DangerouslyChangedSteps()`. |
| `Keyring::hidesRegisteredAddresses()`, `signsInAfterRegistering()` | Not available: read `Registration.RevealTaken` and `Features.Registration`. |
| `Keyring::allowsSignIn()`, `allowsEnrollment()` | `AllowsSignIn()` and `AllowsEnrollment()`. |
| `Keyring::allowsImpersonation()`, `impersonationRefusal()` | `AllowsImpersonation()` and `ImpersonationRefusal()`. |
| `Keyring::impersonating()`, `impersonator()`, `impersonation()` | `Impersonating()`, `Impersonator()` and `Impersonation()`. |
| `Keyring::guard()`, `provider()`, `username()`, `email()`, `user()` | `Guard`, `Username` and `Email` in `Config()`, and Laravel for Go's `auth.User[U](r)`. |
| `Keyring::response()`, `notification()`, `hasNotification()`, `findUser()`, `belongsToGuard()` and the model getters | Not available. |
