# Sign-in modules

> The name of every sign-in module, the settings object each one reads, and every setting with its default.

Each [sign-in method](../sign-in-methods/) is a **module**: one check in a [sign-in chain](../sign-in-chains/). This
page lists each module's names and every setting it reads, for when you write a chain or tune a method.

## Before you begin

- **Who can do it:** a realm administrator, in a group that holds `RealmOwner`
  ([Delegated administration](/platform/realms/delegated-administration/)). `RealmViewer` can read the settings.
- **Where:** `authSettings` in the dashboard, under **Authentication → Settings**, or through the API; each module's
  settings and `webauthnSettings`, today through the API ([Call the API](/develop/api/) shows how to get
  `$CVYUH_SESSION`).

## Module names

A chain and `authSettings.authenticators` name each method by its module; each module's settings live on an
instance of its own type.

| Method | Module | Instance | Settings type |
|---|---|---|---|
| Passkey | `webauthnauth` | `webauthnAuth` | `webauthnAuthModule` |
| Password | `NativeStore` | `nativeStore` | `nativeStoreModule` |
| Authenticator app | `totp` | `totp` | `totpModule` |
| Add a passkey | `webauthnreg` | `webauthnReg` | `webauthnRegModule` |
| Confirm identity | `confirmidentity` | `confirmIdentity` | `confirmIdentityModule` |

Adding a passkey runs in the chain `webauthnRegChain`.

## Tune a module

Change one module's settings on its instance, for example the authenticator app's:

```sh
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/totpModule/totp \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
  -H "Content-Type: application/json" \
  -d '{ "digits": 6, "period": 30 }'
```

An authenticator app keeps the settings it was set up with: changing the algorithm, digits or period affects new
apps only.

## Settings

| Where | Setting | What it does |
|---|---|---|
| `authSettings` | `authenticators` | Which modules the realm may run. The list you send replaces the realm's |
| `authSettings` | `twoFactorMandatory` (`true` in a new realm), `twoFactorSkipDays` (`30`) | Whether a second step is required, and how long a skip lasts (`0` is for good) |
| `webauthnSettings` | `rpId` | The domain passkeys are bound to: the realm's host when it was created with one, otherwise empty, and no passkeys |
| `webauthnSettings` | `rpName`, `origins`, `relatedOrigins` | The name users see (the realm's name when empty), other exact origins under the `rpId`, and origins on other domains allowed to use it |
| `webauthnSettings` | `algorithms`, `userVerification` (`preferred`), `residentKey` (`required`), `attestation` (`none`), `hints`, `timeoutSeconds` (`300`) | What a passkey ceremony asks for |
| `webauthnAuthModule` | `authLevel`, `authLevelVerified`, `attemptsPerLogin` (`3`), `maxFailuresBeforeDisable` (`20`), `counterPolicy` (`warn`) | Passkey sign-in |
| `webauthnRegModule` | `authenticatorAttachment`, `recoveryCodeCount` (`10`) | Which authenticators may hold a new passkey, and how many recovery codes come with a first factor |
| `nativeStoreModule` | `authLevel`, `invalidChars` | The level a password sign-in gives, and characters a username can't hold |
| `totpModule` | `algorithm` (`SHA256`), `digits` (`6`), `period` (`30`), `issuer` | What a new app is set up with |
| `totpModule` | `stepsInWindow` (`1`), `maxDriftSteps` (`5`), `allowSha1Fallback` (`true`) | How much clock difference is tolerated, and whether an app that ignored the algorithm is accepted |
| `totpModule` | `attemptsPerLogin` (`3`), `maxFailuresBeforeDisable` (`20`), `recoveryCodeCount` (`10`) | How guessing is bounded, and how many recovery codes |
| `confirmIdentityModule` | `app`, `passkey` | The app and passkey instances it answers with; one left out isn't offered |

Values in brackets are the defaults.

## Limits and defaults

Every default is in the Settings table above, in brackets. The limits a user meets, such as tries per sign-in and
when a factor is disabled, are summed up on [Sign-in methods](../sign-in-methods/#limits-and-defaults).

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| Deleting a module instance answers `400` | A chain still names it | Take it out of every chain first |
| A chain naming a module is refused | The instance doesn't exist | Create it, or name an existing one |
| A method never runs | It isn't in `authenticators` | Read `authSettings`, and send the list back with it added |

## Audit record

A change to a module's settings is recorded as `UPDATED` or `PATCHED` in **Audit → Config**
([Change history](/audit-reports/audit-trail/change-history/)). Each time a module runs in a sign-in, it writes a
`MODULE_COMPLETED` record with how it went (**Audit → Authentication**).

## Related

- [Sign-in methods](../sign-in-methods/): what each method checks and what the user sees.
- [Sign-in chains](../sign-in-chains/): how modules are put in order.
