Skip to main content

Module identity

Module identity 

Source

Structs§

IdentityAccountUpsertReq
identity.account.upsert: an account for the agent’s own use, created or updated, and linked.
IdentityAccountUpsertResult
identity.account.upsert: the account as stored, and the validation result when one was asked for.
IdentityAccountValidateReq
identity.account.validate: a stored account to probe, or a provider and secret to probe ad hoc.
IdentityAccountValidateResult
identity.account.validate: whether the provider accepted the key.
IdentitySelfAccount
One linked account in IdentitySelfAccountsResult.
IdentitySelfAccountsReq
identity.self.accounts and identity.self.unlink: the agent asking.
IdentitySelfAccountsResult
identity.self.accounts: the provider accounts linked to the agent, with no secrets.
IdentitySelfUnlinkReq
identity.self.unlink: the provider whose account to unlink from the agent.
IdentitySelfUnlinkResult
identity.self.unlink: whether a link was removed.

Functions§

account_to_store 🔒
The account row to write: a new one, or the existing one with its creation time and context kept.
announce_account 🔒
Tell the UI and the watchers that the agent’s account changed.
delete_secret 🔒
identity_account_upsert 🔒
identity.account.upsert: store the secret, optionally probe it, record the account and point the agent’s provider link at it.
identity_account_validate 🔒
identity.account.validate: probe a stored account, or a provider and secret the caller supplies.
identity_account_validate_stored_impl 🔒
Validate one of the agent’s own linked accounts by probing the provider with the stored keychain secret. Ownership is verified (the account must be linked to agent_id) before the secret is read.
identity_self_accounts_impl 🔒
identity_self_unlink 🔒
identity.self.unlink: drop the agent’s link to its account for one provider.
link_account 🔒
Step 2/4: (re)point the agent’s provider link at this account. agent_identity_link’s own ON CONFLICT(agent_id, provider) DO UPDATE already overwrites whatever account_id was linked before, so no separate unlink is needed for the success path: an unlink that succeeds followed by a link that fails would permanently drop the agent’s existing provider link with no compensation (the failure branch below only cleans up for is_new accounts).
owned_account_id 🔒
Ownership check: the supplied account_id must already be linked to the calling agent, so callers can’t overwrite another agent’s credentials by guessing a UUID.
proven 🔒
A validate that passed proves the account works, so its agents stop being signed out (#2237).
register
register_identity_account_upsert 🔒
register_identity_account_validate 🔒
register_identity_self_accounts 🔒
register_identity_self_unlink 🔒
store_account 🔒
Step 3 (upsert DB). Compensate on failure for new accounts. identity_upsert_with_mirror, not plain identity_upsert: without the mirror write, an account created/updated after the fix shipped still had no fallback entry and reproduced the reported bug on its own next channel switch.