Expand description
Client-side device-cohort emission and the devices-grouping view model (SSoT: Authentication — Device Cohorts).
This module owns the client half of the cohort story whose server half
(advisory storage + the {devices, cohorts} listing) lives in the server,
and whose pure hash lives in capsule_core::cohort. Three cohesive pieces:
PrimaryIdentifierReader— the per-platform seam. Each platform reads its single primary identifier (Keychain seed / SSAID / IOPlatformUUID / MachineGuid / hashedmachine-id) behind this trait; the SDK never bakes in a platform’s identifier source.compute_cohort_hashturns a reader plus the accountuser_idinto the advisory hash thatcrate::auth::AuthClientrides.devices— the devices-grouping view model that consumes the server’sGET /devices{devices, cohorts}body into groups the UI renders, carrying the assert-don’t-litigate copy aslocales/catalog keys.devices::SupportBundle— the one-tap dispute payload (cohort_hash+ the device/session map), serializable and round-trippable.
§Why the hash needs the user_id
The cohort hash folds the account user_id in so the same physical device under
two accounts yields unlinkable hashes (the cross-account correlation surface is
removed at the source — see the owner doc). A client therefore emits a cohort
only once it knows which account it is authenticating: on a returning device the
app has the cached user_id; on a first-ever registration it does not, so it
simply emits nothing (absent stays legal) and starts emitting on the next
login. This module never guesses a user_id.
§Never log the raw identifier
A PrimaryIdentifierReader handles a stable device fingerprint. Implementations
and this module must never emit the raw identifier to logs, errors, or the
Debug surface — only the derived hash (already one-way) ever leaves. The
adapters here uphold that: the Linux reader returns a hashed value, never the
raw machine-id, and no error variant embeds the identifier.
Modules§
- devices
- The devices-grouping view model and the one-tap support bundle.
Structs§
- Linux
Machine IdReader - Linux primary-identifier reader: the systemd
machine-id, hashed before use.
Enums§
- Identifier
Error - Everything a
PrimaryIdentifierReadercan fail with. No variant embeds the raw identifier — the whole point of the reader is that the fingerprint never leaks, so the errors carry only the reason, never the value. - Platform
Tag - Closed platform tag (wire value is the lowercase name; a new platform is an additive protocol change).
Traits§
- Primary
Identifier Reader - The per-platform seam: read this platform’s single primary identifier.
Functions§
- compute_
cohort_ hash - Compute the advisory cohort hash (lowercase-hex SHA-256) for an account on this
device: read the platform’s primary identifier and fold it with
user_idthroughcapsule_core::cohort::cohort_hash.