light-mode-image
Learn

Remote presentation mDocs Holder SDK Cheatsheet

This guide provides a quick overview of how to use the MATTR mDocs Holder SDKs to present a claimed mDoc for verification via an online presentation workflow as per ISO/IEC 18013-7:2025 and OID4VP.

Use these guides as a quick reference to get started. For detailed information, explore the linked tutorials and reference documentation tailored for each platform.

Core usage

Initialize the SDK

Initialize the SDK
    mobileCredentialHolder.initialize(userAuthRequiredOnInitialize: false)
Initialize the SDK
mobileCredentialHolder.initialize(activity, userAuthRequiredOnInitialize = false)
Initialize the SDK
const initialiseResult = await mobileCredentialHolder.initialise();
if (initialiseResult.isErr()) {
  const { error } = initialiseResult;
  // handle error scenarios
  return;
}

Register the verifier's Authorization URL

Ensure that your application is registered to handle the verifier's authorization URL. This is typically done in the app's Info.plist file. The URL scheme should match the one used by the verifier.

Ensure that your application is registered to handle the verifier's authorization URL. This is typically done in the AndroidManifest.xml file. The URL scheme should match the one used by the verifier.

Ensure that your application is registered to handle the verifier's authorization URL. The URL scheme should match the one used by the verifier.

  • For iOS this is typically done in the app's Info.plist file.
  • For Android this is typically done in the AndroidManifest.xml file.

Create an online presentation session

Create an online presentation session
    let onlinePresentationSession = try await mobileCredentialHolder.createOnlinePresentationSession(authorizationRequestUri: authorizationRequestURI, requireTrustedVerifier: false)
  • authorizationRequestURI : Pass the OID4VP authorization request URI as a string.
  • requireTrustedVerifier : Set to true if you want to ensure that the verifier exists on the app's trusted verifier's list.

The createOnlinePresentationSession method returns an instance of OnlinePresentationSession containing requested and matching credentials.

Create an online presentation session
    val onlinePresentationSession = mobileCredentialHolder.createOnlinePresentationSession(
        authorisationRequestUri = authorizationRequestUri,
        requireTrustedVerifier = false
    )
  • authorisationRequestURI : Pass the OID4VP authorization request URI as a string.
  • requireTrustedVerifier : Set to true if you want to ensure that the verifier exists on the app's trusted verifier's list.

The createOnlinePresentationSession method returns an instance of OnlinePresentationSession containing requested and matching credentials.

Create an online presentation session
const createSessionResult =
  await mobileCredentialHolder.createOnlinePresentationSession({
    authorisationRequestUri: authorizationRequestURI,
    requireTrustedVerifier: false,
  });
if (createSessionResult.isErr()) {
  const { error } = createSessionResult;
  // handle error scenarios
  return;
}
const onlinePresentationSession = createSessionResult.value;
  • authorizationRequestUri : Pass the OID4VP authorization request URI as a string.
  • requireTrustedVerifier : Set to true if you want to ensure that the verifier exists on the app's trusted verifier's list.

The createOnlinePresentationSession method returns an instance of OnlinePresentationSession containing requested and matching credentials.

Present matching credentials to holder

Present matching credentials to the holder
    let credential = try await mobileCredentialHolder.getCredential(credentialId: id)

Your application must then gather the user's consent to share the matching credential with the verifier.

Present matching credentials to the holder
    val credential = mobileCredentialHolder.getCredential(credentialId)

Your application must then gather the user's consent to share the matching credential with the verifier.

Present matching credentials to the holder
const credentialResult = await mobileCredentialHolder.getCredential(
  credentialId, 
);
if (credentialResult.isErr()) {
  const { error } = credentialResult;
  // handle error scenarios
  return;
}
const credential = credentialResult.value;
  • credentialId : Pass the identifier of the credential you want to present, as a string. This information can be retrieved from the OnlinePresentationSession object returned by the method.

Your application must then gather the user's consent to share the matching credential with the verifier.

Send a response to the verifier

Send response to the verifier
    try await onlinePresentationSession.sendResponse(credentialIds: [id])
  • id : Pass the identifier of the credential you want to send, as a string.
Send response to the verifier
onlinePresentationSession.sendResponse(
    credentialIds = listOf(credentialId), 
    activity = activity
)
  • credentialId : Pass the identifier of the credential you want to send, as a string.
Send response to the verifier
const sendResponseResult = await onlinePresentationSession.sendResponse({
  credentialIds: [credentialId],
});
if (sendResponseResult.isErr()) {
  const { error } = sendResponseResult;
  // handle error scenarios
  return;
}
  • credentialId : Pass the identifier of the credential you want to send, as a string.

How would you rate this page?