OZCredential Manager
Manages the lifecycle of smart account credentials.
OZCredentialManager provides operations for creating, querying, updating, and deleting stored credentials. It handles credential deployment state transitions and ensures data integrity through validation and error handling.
Credential State Machine:
pending --[deploy success]--> credential DELETED from storage
pending --[deploy failure]--> failed (deploymentError set)
pending --[sync discovers contract on-chain]--> credential DELETED from storage
failed --[deleteCredential]--> credential DELETED from storageAfter successful deployment (or sync discovery), credentials are deleted from storage. Reconnection works via sessions or the indexer. Failed deployments can be retried by deleting the credential and creating a new one.
Thread Safety: All operations delegate to the StorageAdapter, which is responsible for thread-safety.
Example usage:
val manager = kit.credentialManager
// Get all credentials
val all = manager.getAllCredentials()
// Get pending and failed credentials
val pending = manager.getPendingCredentials()
// Sync a credential with on-chain state (deletes if deployed)
val isDeployed = manager.sync(credentialId = "base64url-id")
// Delete a pending credential
manager.deleteCredential(credentialId = "base64url-id")Functions
Creates a new pending credential in storage.
Deletes a pending credential from storage.
Retrieves all stored credentials.
Retrieves a credential by its ID.
Retrieves all credentials associated with a specific contract.
Retrieves credentials for the currently connected wallet.
Retrieves credentials that are pending deployment or have failed deployment.
Saves a credential to storage.
Syncs all stored credentials with on-chain state.
Updates the nickname of a credential.