pub async fn enroll_user(
store: &dyn UserStore,
secrets_dir: &Path,
username: &str,
source: EnrollKeySource,
policy: CryptoPolicy,
) -> Result<EnrollOutcome>Expand description
The one shared enrollment routine.
- Register the user record if it does not already exist (
registeroverwrites pubkeys on an existing record, so it is only called when the profile is absent). - Store the resolved signing key as the client’s actual
credentials/user-signing-key(backing up any prior key on the adopt paths), so the CLI signs with this key. - Bind the derived public key(s) to the user, idempotently and
collision-safely (see [
bind_user_signing_key_material]).
Returns the bound fingerprint and algorithm so callers can verify + print
enrollment actually took (user create shows it equals
ssh-keygen -l -E sha256 of the key).
policy selects the crypto suite (see [resolve_and_store_identity]). Under
CryptoPolicy::Hybrid (the node default) enrollment mints an Ed25519
anchor plus a bound ML-DSA-65 key and writes a hybrid store record; a
missing/unpersistable PQ component is a hard error (fail closed). Under
The test-only [CryptoPolicy::Classical] variant writes a classical-only
identity with a loud notice — never a silent downgrade.