Skip to main content

Module identities

Module identities 

Source
Expand description

Identity subsystem — accounts and the direct junction that ties them to agents.

Layered model:

  • IdentityAccount (db_accounts): a single credential pointer (provider + kind + secret_ref).
  • AgentIdentityLink (db_agent_identity_links): the sole credential-resolution path — binds an agent (definition) to an account directly, per provider.

The Identity bundle layer (Identity/IdentityBinding, db_identity_bundles/db_identity_bindings) was retired in Phase 4c of SPEC_PRESET_TO_BUNDLE_REFACTOR_2026_07_02.md — direct links had already fully superseded it as the credential-resolution path (see identity/resolver/inject.rs::resolve_bindings_for_instance).

Extracted from store.rs in Phase R.2 of the storage modularization plan (docs/specs/SPEC_STORE_MODULARIZATION_2026_05_27.md). The method surface is unchanged — Store::identity_* and agent_identity_* still live on Store via this impl block; existing imports of the structs from storage::store::* keep working thanks to re-exports.

Structs§

AgentIdentityLink
Junction row: which identity an agent uses for a given provider.
IdentityAccount
An identity account (reusable credential, linked to agents via the db_agent_identity_links junction). Replaces the browser localStorage identity store.
IdentityDeleteOutcome
What Store::identity_delete removed — the account row plus the cascaded db_agent_identity_links junction rows. Consumed by the deleteidentityaccount handler for identity.delete: logging and the layer-2/4 affected-agent disclosure (SPEC_ACCOUNT_DELETE_DEAUTH_LAYERS_2_4_2026_07_14.md §3/§4).

Enums§

SecretRef
Provider-specific credential reference. Stored as JSON in db_accounts.secret_ref. backend is the discriminator. The actual secret value is NEVER stored in the DB — only how to look it up at launch time (env var, secrets-manager path, etc.). PlaintextDev exists for local dev convenience and must never be the default path in production builds.

Functions§

default_context_json 🔒
default_identity_status 🔒
repair_bare_backslashes 🔒
Escape every backslash in raw unconditionally. Targets exactly the one corruption shape seen in production — a raw Windows path (C:\Users\...) pasted into a JSON string with NO escaping at all — so every backslash in a still-unparseable row is a literal path separator, never an intentional JSON escape (a document containing even one real \n/\t/\\ escape alongside bare backslashes would imply two different corruption mechanisms touched the same row, which has no evidence and isn’t something this targeted repair needs to handle).