GeezerVison is showing adk.dev — ToolContextCredentialStore | ADK for TypeScript: API Reference - v2.5.0
- ToolContextCredentialStore
Class ToolContextCredentialStore
Stores and retrieves exchanged credentials in the session state carried by a
Context.
Constructors
constructor
-
new ToolContextCredentialStore(context: Context): ToolContextCredentialStore
Returns ToolContextCredentialStore
Methods
getCredential
-
Returns the credential stored for this scheme and credential pair, or
undefined when there is none.
Throws
Error if the state entry under the key is not an
AuthCredential, which means something else wrote to the key.
getCredentialKey
-
Returns the state key that holds the credential exchanged for this scheme
and credential pair.
Both operands are hashed into the key, so two tools configured with
different schemes, or with different credentials under one scheme, never
share a slot.
The key deliberately carries no temp: prefix. Session state is a copy and
only the delta is persisted, and temp: is cleared at the end of a run,
while an exchanged token has to stay readable across runs.
Returns string
removeCredential
-
removeCredential(key: string): void
Makes the credential under key unreadable again.
adk-python deletes the state entry. State has no delete, so this writes
undefined, which State.get returns for a missing key as well, and
getCredential therefore misses exactly as a delete would make it.
Returns void