Configure activity logs
Learn how to configure activity logging in the MATTR Holder SDKs to record credential and presentation events for display in your wallet application.
The MATTR Holder SDKs include an activity logging system that records user-facing events such as credential additions, removals, and presentations. Unlike SDK logging, which captures internal diagnostic information for developers, activity logs are designed to power end-user features in your wallet application, such as a credential usage history.
How activity logs differ from SDK logs
The activity log and SDK log serve different purposes and audiences, even though they both capture events related to the SDK's operation. The following table summarizes the key differences:
| Feature | Activity logs | SDK logs |
|---|---|---|
| Purpose | User-facing credential usage history | Developer diagnostics and debugging |
| Audience | End users of your wallet application | Developers integrating the SDK |
| Content | Credential and presentation events | Internal SDK operations, errors, and state changes |
| Configuration | activityLogConfiguration | loggerConfiguration |
Privacy considerations
Activity logs are stored only on the user's device. They are never shared with issuers, verifiers, or any external party as part of credential issuance or presentation interactions.
Activity logs are intended to give users visibility into how their credentials have been used. This enables you to build transparency features into your wallet application, such as:
- Showing the user when and where a credential was presented.
- Displaying a history of credential additions and removals.
- Allowing users to review and clear their activity history.
Because this data stays on-device, it supports user sovereignty and trust without creating additional privacy risks.
What events are recorded
The activity log records two types of events:
- Credential events: Recorded when a credential is added to or removed from storage. Each event includes the credential identifier, document type, issuer details, and optional branding information.
- Presentation events: Recorded when a credential is presented to a verifier, or when a presentation request is declined. Each event includes details about what was requested, what was shared, and the type of session (proximity or online). Where available, the SDK also records the identity of the requesting verifier based on a trusted verifier certificate or, for online sessions, the verifier's domain.
Each activity log entry contains a timestamp and one or more events that occurred at that point in time.
Enable activity logging at initialization
Activity logging is configured by passing an ActivityLogConfiguration object to the SDK's
initialize method (this is separate from the loggerConfiguration used for SDK diagnostic logs).
try mobileCredentialHolder.initialize(
activityLogConfiguration: ActivityLogConfiguration(
isEnabled: true
)
)isEnabled: Set totrueto start recording activity log events immediately after initialization. Defaults totrue.
Refer to the
ActivityLogConfiguration
reference documentation for additional details.
mobileCredentialHolder.initialize(
activityLogConfiguration = ActivityLogConfiguration(
isEnabled = true
),
// ...
)isEnabled: Set totrueto start recording activity log events immediately after initialization. Defaults totrue.
Refer to the
ActivityLogConfiguration
reference documentation for additional details.
Coming soon...
Toggle activity logging at runtime
You can enable or disable activity logging after initialization without reinitializing the SDK. This
overrides the value set in activityLogConfiguration during initialization, and is useful for
allowing users to opt in or out of activity tracking from your application's settings.
// Enable activity logging
try mobileCredentialHolder.setActivityLogEnabled(true)
// Disable activity logging
try mobileCredentialHolder.setActivityLogEnabled(false)
// Check if activity logging is currently enabled
let isEnabled = mobileCredentialHolder.isActivityLogRecordingEnabledsetActivityLogEnabled(_:): Enable or disable activity log recording.isActivityLogRecordingEnabled: A Boolean indicating whether activity log recording is currently enabled.
// Enable activity logging
mobileCredentialHolder.setActivityLogEnabled(true)
// Disable activity logging
mobileCredentialHolder.setActivityLogEnabled(false)
// Check if activity logging is currently enabled
val isEnabled = mobileCredentialHolder.isActivityLogRecordingEnabled()setActivityLogEnabled: Enable or disable activity log recording.isActivityLogRecordingEnabled: Returns a Boolean indicating whether activity log recording is currently enabled.
Coming soon...
Retrieve activity log entries
You can retrieve recorded activity log entries. Each entry contains a timestamp and a list of events that occurred at that point in time. Events are either credential events (additions or removals) or presentation events (shares or declines).
// Get the first 50 entries
let entries = try mobileCredentialHolder.getActivityLog(count: 50, offset: 0)
for entry in entries {
print("Entry \(entry.id) at \(entry.dateTime)")
for event in entry.events {
switch event {
case .credential(let credentialEvent):
print(" Credential event: \(credentialEvent.eventType) - \(credentialEvent.docType)")
case .presentation(let presentationEvent):
print(" Presentation event: \(presentationEvent.eventType)")
}
}
}The
getActivityLog(count:offset:)
method returns an array of
ActivityLogEntry
objects. Each entry contains:
id: A unique identifier for the entry.dateTime: The timestamp when the entry was recorded.events: An array ofActivityLogEventvalues, which are eithercredential(representing credential additions or removals) orpresentation(representing presentation events) events.
Parameters:
count: The maximum number of entries to return.offset: The number of entries to skip (for pagination).
// Get the first 50 entries
val entries = mobileCredentialHolder.getActivityLog(count = 50, offset = 0)
entries.forEach { entry ->
Log.d("Test", "Entry ${entry.id} at ${entry.dateTime}")
entry.events.forEach { event ->
when (event) {
is ActivityLogCredentialEvent ->
Log.d("Test", "Credential event: ${event.eventType} - ${event.docType}")
is ActivityLogPresentationEvent ->
Log.d("Test", "Presentation event: ${event.eventType}")
}
}
}The
getActivityLog
method returns a list of
ActivityLogEntry
objects. Each entry contains:
id: A unique identifier for the entry.dateTime: The timestamp when the entry was recorded.events: A list ofActivityLogEventinstances, which are eitherActivityLogCredentialEvent(representing credential additions or removals) orActivityLogPresentationEvent(representing presentation events).
Parameters:
count: The maximum number of entries to return. Defaults to100.offset: The number of entries to skip (for pagination). Defaults to0.
Coming soon.
Clear the activity log
You can clear all activity log entries from the device. This permanently deletes all recorded events and cannot be undone. You might expose this option to users as a way to reset their activity history.
try mobileCredentialHolder.clearActivityLog()The
clearActivityLog()
method removes all activity log entries from the device.
mobileCredentialHolder.clearActivityLog()The
clearActivityLog
method removes all activity log entries from the device.
Coming soon...
How would you rate this page?
Last updated on