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 Digital Credentials API presentations are recorded as online sessions). 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.
When a presentation event is recorded
A presentation event is recorded at the point the SDK generates the credential response, not at the point the verifier confirms that it received the response. An activity log entry can therefore exist for a presentation that never reached the verifier, for example when the device loses network connectivity after the holder has approved the request and authenticated. This is deliberate. The entry records what the holder consented to share, not whether the verifier successfully received it.
Nothing is recorded when a presentation fails before the response is generated. Declining a request records a declined event, and canceling authentication records no event at all.
The exact point at which the entry is written currently differs by SDK and by presentation type:
| Presentation type | Android | iOS |
|---|---|---|
| Proximity | Before the response is sent. A failed send still produces an entry. | After the response is sent. A failed send produces no entry. |
| Online (OID4VP) | Before the response is sent. A failed send still produces an entry. | After the response is sent. A failed send produces no entry. |
| Digital Credentials API | Before the response is delivered. A failed delivery still produces an entry. | Before the response is delivered. A failed delivery still produces an entry. |
If your application shows activity history to holders, avoid presenting an entry as confirmation that a verifier received the data. Treat it as a record of what the holder agreed to share.
Digital Credentials API presentations
Credential presentations made through the Digital Credentials API are also recorded in the activity log, as online presentations. This lets holders see DC API activity alongside their other remote presentations.
Activity logging for DC API presentations is available from the following SDK versions:
- iOS Holder SDK: 6.1.0
- Android Holder SDK: 7.1.0
The following behavior applies to DC API presentations on both platforms:
- Declining at the consent screen records a declined event.
- Canceling during authentication records no event.
- When the request is unsigned or comes from an untrusted verifier, the request origin is recorded in place of the verifier's common name.
On iOS, DC API presentations are handled by an app extension rather than by your main application, so
the resulting entries are persisted the next time your application calls getActivityLog. Refresh
the list when your activity history screen appears rather than relying on a previously cached result.
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 await 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.
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.
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).
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.
How would you rate this page?
Last updated on