Credential update
Keep the credentials in your wallet current by checking for and applying updates from the issuer with the MATTR Holder SDKs.
Credential update is offered as a closed preview feature and is not generally available yet. Its behavior may change in a way that breaks existing integrations before it becomes generally available. It must be enabled on the issuer's MATTR VII tenant. To enable it, contact us.
Overview
Credential update lets your wallet obtain a newer version of a credential the user already holds, without the user authenticating again or claiming a new credential offer. The new version replaces the stored credential in place, so the user keeps a single, current credential.
For example, Alex holds a mobile driver's license (mDL) in your wallet app. When Alex moves house and updates their address with the licensing authority, the authority requests an update for Alex's license. The next time your wallet checks for an update, it receives a license with the new address, and replaces the old one. Alex does not sign in again, and still has one driver's license in the wallet.
Credential update is available in the iOS Holder SDK v7.0.0 and later, and the Android Holder SDK v8.0.0 and later. Credentials claimed with an earlier SDK version are not updatable. The user needs to claim them again to make them eligible.
What this enables
- Keep credential data current: When the issuer has new data for a credential, your wallet receives the new version the next time it checks.
- Changes without a new credential: A credential with a new address or a corrected claim replaces the old one, keeping its ID in your wallet, so your app does not need to handle a second copy.
- No repeated enrollment: The user does not repeat the authentication or identity check they completed when they first claimed the credential.
How it works
The issuer decides which credentials can be updated and when an update is due. Your wallet decides when to check. The Holder SDK handles the protocol in between.
At first issuance
When your wallet claims a credential, the issuer can return a refresh token alongside it. The SDK stores the refresh token in its encrypted storage, together with the credential and its credential version (credentialDataSetId). The version identifies the data the credential was issued with.
The SDK marks the credential as updatable when all of the following were true when it was claimed:
- The issuer returned a refresh token. This depends on the issuer's credential configuration. See Update via refresh token.
- The SDK bound the issuance to a key it holds, using either Wallet Attestation or a DPoP key. The SDK does this automatically when the issuer supports it.
- The issuer advertises the
attestationproof type withES256for the credential's configuration.
The result is exposed as isUpdatable on the credential and its metadata.
When your wallet checks for an update
When your app asks the SDK to update a credential:
- The SDK presents the stored refresh token to the issuer's Token endpoint, together with a DPoP proof, and receives a new access token. The user is not asked to authenticate.
- The SDK requests the credential again with the new access token, sending the credential version it holds. It proves possession of the credential's device key with a key attestation signed by the key it bound the issuance to, so the device key does not need to be unlocked.
- The issuer compares the version against the latest version it issued, and decides whether an update is due:
- Update due: The issuer returns a new credential. The SDK verifies it, checks that it is bound to the same device key, and replaces the stored credential in place.
- No update due: The issuer responds with
204 No Content, and the SDK leaves the stored credential unchanged.
An update is due when the issuer has requested one for the credential, or when the issuer finds that the data behind the credential has changed. The issuer checks for changed data periodically, so a change reaches your wallet on the first check after the issuer detects it. See Conditional update.
What the SDK does and what your app does
| The Holder SDK | Your wallet app |
|---|---|
| Stores the refresh token, credential version and credential identifiers when a credential is claimed | Decides when to check for updates, and for which credentials |
| Reports whether each credential is updatable | Calls updateCredential for each credential it wants to check |
Obtains a new access token, requests the credential, and handles 204 No Content | Handles the result, including credentials that need to be claimed again |
| Verifies the new credential and replaces the stored one, keeping its ID and device key | Refreshes anything it displays or caches about the credential |
| Records an activity log event when a credential is updated | Shows update history to the user, if it uses the activity log |
The SDK does not check for updates on its own, and does not schedule background work. Neither the SDK nor MATTR VII notifies your app when the issuer has a new version, so your app finds out by checking. If your organization runs the issuer as well as the wallet app, your own backend can tell the app to check straight away. See Decide when to check.
Prerequisites
- Your wallet uses the iOS Holder SDK v7.0.0 or later, or the Android Holder SDK v8.0.0 or later, initialized with the SDK Backend.
- The issuer allows refresh on the credential's configuration. See Update via refresh token.
- You are familiar with claiming credentials. See the Credential claiming tutorial.
Update a credential
Choose which credentials to check
The SDK does not decide which credentials to check or when. Your app builds that logic. Start from the stored credentials and keep only those where isUpdatable is true, since calling updateCredential for any other credential fails. For example:
- Every updatable credential: The simplest rule, suitable for a check on app launch.
- A specific credential: When your backend tells the app that one credential has changed, match it by
credentialReferenceId, which stays the same across updates.
let holder = MobileCredentialHolder.shared
let updatable = try holder.getCredentials().filter { $0.isUpdatable }
// The credential your backend reported as changed
let changed = updatable.filter { $0.credentialReferenceId == changedCredentialReferenceId }Check for and apply an update
Call updateCredential with the ID of each credential you selected. This example checks every updatable credential. The method returns once the check is complete, and tells you whether the stored credential was replaced.
for metadata in updatable {
do {
switch try await holder.updateCredential(credentialId: metadata.id) {
case .updated:
break // The stored credential was replaced with the newer version
case .noUpdateAvailable:
break // The issuer confirmed the stored credential is current
@unknown default:
break
}
} catch MobileCredentialHolderError.credentialNotUpdatable {
// The user needs to claim this credential again
} catch MobileCredentialHolderError.connectivityError {
// Try again later
} catch MobileCredentialHolderError.failedToUpdateCredential(let message) {
// The update failed for another reason
}
}Handle the result
| Outcome | iOS | Android | What to do |
|---|---|---|---|
| Updated | CredentialUpdateResult.updated | CredentialUpdateResult.Updated | Read the credential again to show its new data. Its ID is unchanged |
| No update available | CredentialUpdateResult.noUpdateAvailable | CredentialUpdateResult.NoUpdateAvailable | Nothing. Check again later |
| Credential cannot be updated | MobileCredentialHolderError.credentialNotUpdatable | HolderException.CredentialNotUpdatableException | Ask the user to claim the credential again |
| Network problem | MobileCredentialHolderError.connectivityError | HolderException.ConnectivityException | Try again later |
| Any other failure | MobileCredentialHolderError.failedToUpdateCredential | HolderException.FailedToUpdateCredentialException | Try again later, and log the failure |
The "cannot be updated" error means the credential needs to be claimed again. Besides a credential that was never updatable, this happens when the issuer rejects the refresh token, for example because it withdrew the credential by unlinking it. isUpdatable stays true after this error, so keep track of these credentials in your app rather than checking them again.
Decide when to check
Your app decides when to check for updates. Common patterns are:
- On launch or when the app returns to the foreground: Keeps credentials current for users who open your app regularly.
- On user request: Offer a refresh action on the credential's details screen.
- On a signal from your backend: If your organization runs the issuer as well as the wallet app, your backend can prompt a check when data changes. See Prompt a check from your backend.
Checking often is safe. When no update is due, the issuer responds with 204 No Content and nothing changes. Whether a check results in a new credential depends on the issuer, not on how often your app checks.
Each check needs the SDK to be initialized and a network connection. Updating a credential does not require device key authentication. Depending on the user authentication configuration you pass to initialize, the user may still be asked to authenticate so the SDK can access its storage, in the same way as for other SDK operations. Plan background checks with this in mind.
Prompt a check from your backend
MATTR VII and the SDK do not send push notifications. When the same organization runs the issuer and the wallet app, its backend can use its own push infrastructure to tell the app to check, so a change reaches the holder quickly:
- Your system of record reports a change, for example Alex's new address.
- Your backend forces an update for the credential reference in MATTR VII, so the next check issues a new credential.
- Your backend sends the app a push notification carrying the
credentialReferenceId, for example through Apple Push Notification service or Firebase Cloud Messaging. - The app finds the matching credential and calls
updateCredential, as in Choose which credentials to check.
A silent or data-only notification can start the check in the background, within the limits each operating system places on background work, and subject to the initialization and authentication requirements above.
Considerations
- The credential keeps its ID: An updated credential keeps its ID and its device key. Its cached revocation status is reset, and is checked again the next time you call
getCredential. - Updates delivered as credential offers: An issuer can also deliver an update as a pre-authorized credential offer. The SDK claims such an offer like any other, storing a new credential alongside the old one. Compare
credentialReferenceIdto find the earlier copy and delete it. See Replacing the credential in the wallet. - Credentials claimed together share a refresh token: The SDK updates them one at a time. You do not need to coordinate this yourself.
- Deinitializing the SDK:
deinitializewaits for an update that is already in progress to finish before it closes access to storage. - Activity log: When activity log recording is enabled, each update that replaces a credential is recorded as a
credentialUpdated(iOS) orCredentialUpdated(Android) event. ItschangeSummarylists the claims, validity and branding the update changed. Claims are listed by name and type of change only, without their values. A check that finds no update is not recorded.
Related resources
- Credential update overview: How issuers update credentials, and the identifiers involved.
- Update via refresh token: What issuers configure, and how MATTR VII decides whether an update is due.
- iOS Holder SDK v7.0.0 migration guide and Android Holder SDK v8.0.0 migration guide.
How would you rate this page?
Last updated on