Field sign-in: enrolment optional, badges, impersonation
Status
Section titled “Status”Accepted. Where this ADR and the original field-worker design disagree, this one wins.
2026-11-06.
Context
Section titled “Context”The first field-worker release required every sign-in to come from an enrolled device. Rolling it out showed three needs. A worker code and PIN must work from any device, including one nobody enrolled. Workers wanted to sign in with a printed badge, and the platform had to resist a photocopied badge. Supervisors, administrators and testers needed to act as a worker, without sharing a PIN, and with a record of who did what.
Decision
Section titled “Decision”Enrolment is opt-in. An unenrolled request is one whose proof key is not an enrolled device’s key. The proof is still required on every /field/* call: the library generates a key on any device, and tokens stay bound to it, so a stolen token remains useless without the key. What an unenrolled device cannot do:
| Capability | Unenrolled |
|---|---|
| PIN or badge plus PIN sign-in | works, unless the client’s policy sets requireEnrolledDevice |
| Badge only, no PIN | never |
| Biometric local unlock | never |
| Device revoke, per-device budgets, device-wide logout, per-device app restriction | not available (there is no device row) |
Unenrolled sessions get the shared-device rules (policy field unenrolledIdleSecs, default 900, and the absolute shift limit). Tokens omit device_id and carry device_mode: "UNENROLLED".
Badges. A badge is a token FWB1 plus 26 Crockford base32 characters (130 random bits), upper case so it fits QR alphanumeric mode and types correctly through a scanner. It is stored only as a SHA-256 hash and shown once, at issue; a reprint is a reissue. One active badge per worker (issuing revokes earlier ones). A PIN is required unless the client’s policy sets badgeOnlyLogin and the device is enrolled, so a photocopied badge does not work from any phone. Unknown or revoked badges are counted as failures and answered like any invalid credential.
Impersonation, in three kinds, one model. A supervisor on a device (a can_impersonate flag), an administrator from the console (sign-in codes), and test identities. All impersonated sessions record actor_type and actor_id, carry an RFC 8693-shaped act claim and an amr ending in imp, never force the worker’s pending PIN change on the actor, and have an absolute limit capped by impersonation_max_secs (and, for a supervisor, by the supervisor’s own session). The token’s sub, worker code and client claims are the worker’s: applications see the worker and read act to know someone else is acting.
Consequences
Section titled “Consequences”Good:
- Any worker can sign in anywhere the policy allows, which removes an adoption blocker.
- Badge loss is a revoke, and database access alone cannot forge badges.
- Support and supervision no longer need shared PINs, and every action is attributable.
Bad:
- Unenrolled devices lose per-device controls, so sites that need them must set
requireEnrolledDevice. - Applications must read
act; one that ignores it cannot tell impersonation apart. - More authentication methods mean more attempt reasons and more policy flags to understand.
Alternatives considered
Section titled “Alternatives considered”| Alternative | Why not |
|---|---|
| Keep enrolment mandatory | Blocks rollout on unmanaged devices. |
| Allow badge-only login on any device | A photocopied badge would work from any phone. |
| Share a worker’s PIN for support | No attribution. |
| Store badge tokens in plaintext | Anyone with database access could mint badges. |