light-mode-image
Learn
Guides

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:

FeatureActivity logsSDK logs
PurposeUser-facing credential usage historyDeveloper diagnostics and debugging
AudienceEnd users of your wallet applicationDevelopers integrating the SDK
ContentCredential and presentation eventsInternal SDK operations, errors, and state changes
ConfigurationactivityLogConfigurationloggerConfiguration

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).

Enable activity logging during initialization
try mobileCredentialHolder.initialize(
    activityLogConfiguration: ActivityLogConfiguration( 
        isEnabled: true
    ) 
)
  • isEnabled: Set to true to start recording activity log events immediately after initialization. Defaults to true.

Refer to the ActivityLogConfiguration reference documentation for additional details.

Enable activity logging during initialization
mobileCredentialHolder.initialize(
    activityLogConfiguration = ActivityLogConfiguration(
        isEnabled = true
    ),
    // ...
)
  • isEnabled: Set to true to start recording activity log events immediately after initialization. Defaults to true.

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.

Toggle activity logging
// Enable activity logging
try mobileCredentialHolder.setActivityLogEnabled(true)

// Disable activity logging
try mobileCredentialHolder.setActivityLogEnabled(false)

// Check if activity logging is currently enabled
let isEnabled = mobileCredentialHolder.isActivityLogRecordingEnabled
Toggle activity logging
// Enable activity logging
mobileCredentialHolder.setActivityLogEnabled(true)

// Disable activity logging
mobileCredentialHolder.setActivityLogEnabled(false)

// Check if activity logging is currently enabled
val isEnabled = mobileCredentialHolder.isActivityLogRecordingEnabled()

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).

Retrieve activity log entries
// 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 of ActivityLogEvent values, which are either credential (representing credential additions or removals) or presentation (representing presentation events) events.

Parameters:

  • count: The maximum number of entries to return.
  • offset: The number of entries to skip (for pagination).
Retrieve activity log entries
// 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:

Parameters:

  • count: The maximum number of entries to return. Defaults to 100.
  • offset: The number of entries to skip (for pagination). Defaults to 0.

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.

Clear all activity log entries
try mobileCredentialHolder.clearActivityLog()

The clearActivityLog() method removes all activity log entries from the device.

Clear all activity log entries
mobileCredentialHolder.clearActivityLog()

The clearActivityLog method removes all activity log entries from the device.

Coming soon...

How would you rate this page?

Last updated on

On this page