Introduce Credential Activity History Store - #481
Conversation
a003298 to
c53e3ff
Compare
c53e3ff to
57a7ff5
Compare
e2490d0 to
d44b0b2
Compare
d44b0b2 to
4806cbd
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4806cbd. Configure here.
4d4fc15 to
1514bd0
Compare
Introduces a sharable on-device store for Android and iOS to retain credential activity. We're re-using some components from the Wallet storage here, while maintaining a separate database for the local activity as it is a separate concern and should never be backed up with the existing systems. I've modeled the changes after how I typically use rust; mod.rs is mainly imports with most of the code in dedicated files, and tests in their related files. This system is expected to evolve over time so i've prioritized a sensible migration strategy as part of these changes. Tested integration on iOS. Will do Android later and follow up with any PRs that might be necessary for their integration. No runtime differences until the host apps are updated to use the new system.
1514bd0 to
055b38d
Compare
| fn on_vault_changed(&self); | ||
| } | ||
|
|
||
| /// Listener notified when credential-activity history changes. |
There was a problem hiding this comment.
@Dzejkop let's keep this in the backlog for how to overall improve the listener experience, the risk of deadlocking here or other nasty stuff crossing the boundaries often is high
| /// callback is delivered on a dedicated background thread to avoid re-entering | ||
| /// the `UniFFI` call stack (see `logger.rs` for rationale). | ||
| /// | ||
| /// This is only called when an activity entry is recorded. |
There was a problem hiding this comment.
this is confusing, can we overall revise the doc comment here? it's hard to parse
| .collect()) | ||
| } | ||
|
|
||
| fn map_entry(row: &Row<'_, '_>) -> StorageResult<ActivityEntry> { |
There was a problem hiding this comment.
high impact. not a blocker for this PR, but I strongly suggest that when parsing fails for corrupted entries, you delete the corrupted entry instead of erroring on the whole thing. with the current version, a single corrupted entry makes the history useless.

Introduces a sharable on-device store for Android and iOS to retain credential activity. We're re-using some components from the Wallet storage here, while maintaining a separate database for the local activity as it is a separate concern and should never be backed up with the existing systems.
I've modeled the changes after how I typically use rust; mod.rs is mainly imports with most of the code in dedicated files, and tests in their related files.
This system is expected to evolve over time so i've prioritized a sensible migration strategy as part of these changes.
Tested integration on iOS. Will do Android later and follow up with any PRs that might be necessary for their integration. No runtime differences until the host apps are updated to use the new system.
Note
Medium Risk
Touches encrypted cache schema/migration and new persisted user-activity data; incorrect migration or reset behavior could drop or leak history, but changes are well-tested and isolated from the credential vault.
Overview
Adds persistent credential activity history in the encrypted cache database so host apps can record proof-share outcomes (protocol, RP, client id, issuer schemas, terminal outcome, and optional failure reason).
CredentialStoregainsrecord_activity, paginatedlist_activities,activity_metadata, andclear_activities, plus a UniFFIActivityChangedListener(background thread, same pattern as vault changes) fired only on successful record/clear. NewActivityEntry/ outcome types are exported for bindings.Cache schema now creates an
activity_entriestable (indexed bycreated_at) viaensure_activity_schema, applied on every open—including after a disposablecache_entrieswipe on schema version mismatch—so activity history is intended to outlive TTL cache resets while session seeds and similar rows are cleared.Inserts enforce
failure_reasononly whenoutcomeisFailed.ActivityQueryis a stub for future filtering. Smallwalletkit-sqliteaddition:Transaction::query_row_optional.Reviewed by Cursor Bugbot for commit 055b38d. Bugbot is set up for automated code reviews on this repo. Configure here.