Use the MATTR Pi Mobile Credential Verifier SDK

Overview

We’ve transformed our credential verification capabilities to support the wider platform by making it work on your own mobile experience or integrating them into other types of your applications. Utilising the SDK will significantly reduce your development time while ensuring you are leveraging safe and reliable code libraries.

Interested in learning more about how you might use the MATTR Pi Mobile Credential Verifier SDK? Get in touch with us today.

Capabilities

We wanted to make our Mobile Credential Verifier SDK as easy to use and as flexible as possible. This allows you to start building your own Mobile Credential verifier App or adding these core pieces of functionality to your own apps. 

Capabilities include: 

  • Build your own mobile credential verification solution into existing applications

  • Validate mobile credentials' authenticity 

  • Offline in-person verification of your trusted credentials

  • QR code-based device engagement

  • Secure data transfer between holders and verifier using an encrypted BLE channel. ​

  • Manage the list of trusted credential issuers ​

Key Benefits

Build using the same tools as the MATTR Verifier App

The MATTR Pi Mobile Credentials Verifier SDK allows you to take advantage of the credential verification capabilities and use them to build your own mobile verifier experiences without needing to start from scratch. You can also use the SDK to integrate credential verification functionalities into other types of applications while maintaining a consistent brand and user experience. This means you can leverage the security, privacy and trust benefits of digital identity and verifiable credentials, while significantly reducing your development time and maintaining a consistent user experience.  

Ongoing support for evolving standards  

MATTR is actively engaged in the communities that define the fast-evolving standards for digital trust and verifiable data. Our investment in updating our SDK to support these standards means that you can rely on our expertise in this space to keep your application relevant and compliant. 

Using the same codebase for iOS and Android or build native

We’ve built the MATTR Pi Mobile Credentials Verifier SDK in React Native which means you can create either both iOS and Android apps using the same codebase.  

Limitations 

The SDK has the following limitations: 

  • The SDK provides a set of operations only, there are no UI elements provided by the SDK. 

  • Users will be given access to the NPMJS modules that contain obfuscated and minified packages.  

How to get access to MATTR Pi Mobile Credential SDK

To gain access to the MATTR Pi Mobile Credentials Verifier SDK, please follow these steps:

  1. Request or download the MATTR Pi SDK Trial Licence Agreement and the MATTR Customer Agreement and review these terms carefully.

  2. Sign and return the MATTR Pi SDK Trial Licence Agreement to us.

  3. Create an account at NPMJS - Node package manager for JavaScript.

  4. Ensure multi-factor authentication (MFA) is configured on NPMJS Account.

  5. Create a personal access token here.

  6. Supply the NPMJS (Node package manager for JavaScript) account name back to MATTR.

  7. MATTR will process the request and provision access to the MATTR Pi Verifier SDK if approved.

Please reach out to us in case you need any assistance. Get in touch.

How it works

Install dependencies

Add this SDK as a dependency to the react native app:

typescript
Copy to clipboard.
1yarn add @mattrglobal/mobile-credential-verifier-react-native

NOTE: mobile credential presentation utilise Bluetooth connection. For iOS make sure the NSBluetoothAlwaysUsageDescription and NSBluetoothPeripheralUsageDescription description are configured inside Info.plist.

Verifier

Initialise the verifier SDK

NOTE: SDK must be initialised first, otherwise other methods will throw an exception when invoked.

typescript
Copy to clipboard.
1iimport { initialise } from "@mattrglobal/mobile-credential-verifier-react-native";
2
3await initialise();

Trusted Issuers

Manage trusted issuer certificates

typescript
Copy to clipboard.
1import {
2  addTrustedIssuerCertificates,
3  getTrustedIssuerCertificates,
4  deleteTrustedIssuerCertificate,
5} from "@mattrglobal/mobile-credential-verifier-react-native";
6
7// Add a new certificate
8const addCertificateResult = await addTrustedIssuerCertificates([
9  "MIIBwzCCAWmgAwIBAgILAOZSe5t+MOzXtX8wCgYIKoZIzj0EAwIwIDEeMAkGA1UEBhMCTlowEQYDVQQDEwpNQVRUUiBJQUNBMB4XDTIzMDcxODIwMDYzM1oXDTMzMDcxNTIwMDYzM1owIDEeMAkGA1UEBhMCTlowEQYDVQQDEwpNQVRUUiBJQUNBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE0XWwfvFPzbBHiDVLefOueGG1DMHc8WRfXfZqD6748kLZNTOBysm635yM7YCMlkUxDEIHVkLeyV6KoAOM2o0i5qOBiTCBhjASBgNVHRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIABjAdBgNVHQ4EFgQUypKEavotsICoAsXypAUUlsVUylMwHAYDVR0SBBUwE4ERaW5mb0BtYXR0ci5nbG9iYWwwIwYDVR0fBBwwGjAYohaGFGh0dHBzOi8vbWF0dHIuZ2xvYmFsMAoGCCqGSM49BAMCA0gAMEUCIClmASfWcf/K2WbClaERQfA38TNTSgYZu2SdNeNFdQyGAiEAhfk+FloZkNOb6TOLcDGqSNwXf+NzvPX0yl+8aq+rMKQ=",
10]);
11
12if (addCertificateResult.isErr()) {
13  const { error } = addCertificateResult;
14  // handle error scenarios
15  return;
16}
17
18// Get list of all stored certificates
19const certificates = await getTrustedIssuerCertificates();
20
21// Delete certificate by id
22await deleteTrustedIssuerCertificate(certificateId);

Request Credentials

Request for mobile credentials

typescript
Copy to clipboard.
1import {
2  createProximityPresentationSession,
3  sendProximityPresentationRequest,
4  terminateProximityPresentationSession,
5} from "@mattrglobal/mobile-credential-verifier-react-native";
6
7// Create new session
8const createSessionResult = await createProximityPresentationSession({
9  deviceEngagement: "mdoc:owBjMS4wAYIB2BhYS6QBAiABIVgg_t9K0BaXU27ynODS5q8OcvBZ4m1HFEQwl61lhRD2rdciWCA7hKLr_xN6_bdznDePa_yY1tGdHsc8ni_88uVuehRU-QKBgwIBowD1AfQKUMW8DfgLrUclmxp2InJCddk" // proximity presentation device engagement string
10  onConnected: () => {
11    // handle onConnect event
12  },
13  onSessionTerminated: () => {
14    // handle onSessionTerminated event
15  },
16});
17
18if (createSessionResult.isErr()) {
19  const { error } = createSessionResult;
20  // hande error scenarios
21  return;
22}
23
24// Send session
25const sendRequestResult = await sendProximityPresentationRequest({
26  mobileCredentialRequests: [{
27    docType: "org.iso.18013.5.1.mDL",
28    namespaces: {
29      "org.iso.18013.5.1": {
30        family_name: false,
31        driving_privileges: false,
32      },
33    },
34  }],
35});
36
37if (sendRequestResult.isErr()) {
38  const { error } = sendRequestResult;
39  // handle error scenarios
40  return;
41}
42
43const response = sendRequestResult.value;
44
45// Terminate current active session
46await terminateProximityPresentationSession();

Error Handling

Functions that are expected to have an error path return a Neverthrow Result type that represents either success (Ok) or failure (Err).

Although this pattern is more verbose, it encourages the handling of possible errors and reserves throwing exceptions for truly exceptional situations.

typescript
Copy to clipboard.
1import { sendProximityPresentationRequest } from "@mattrglobal/mobile-credential-verifier-react-native";
2
3// Send session
4const sendRequestResult = await sendProximityPresentationRequest(...);
5
6if (sendRequestResult.isErr()) {
7  const { error } = sendRequestResult;
8  // handle error scenarios
9  return;
10}
11
12const response = sendRequestResult.value;

Unwrap

A utility function is provided for convenience if you decide not to handle your errors as results. This function will simply throw an error if the function passed in returns a Result where Result.isErr() is true

typescript
Copy to clipboard.
1import { unwrap, sendProximityPresentationRequest } from "@mattrglobal/mobile-credential-verifier-react-native";
2
3try {
4  const sendRequestResult = unwrap(await sendProximityPresentationRequest(...));
5} catch (error) {
6  // Handle thrown error
7}

Get in touch if you wish to find out more about using the MATTR Pi Mobile Credentials Verifier SDK in production.