SpruceKit
SpruceID
  • 🌲SpruceKit Introduction
    • Decentralized Identity Overview
    • Glossary
  • ⚡Quickstart
  • SpruceKit Mobile
    • SpruceKit Showcase App
      • Installation
      • Getting Started
      • Issue a Showcase Credential
      • Present a Showcase Credential
    • SpruceKit Mobile SDK
      • Introduction
      • Core Components
        • StorageManager
        • KeyManager
        • CredentialPack
        • Card
        • IsoMdlPresentation
        • mDocReader/IsomDLReader
        • Document Scanner
      • SpruceKit iOS SDK
        • Installation
        • Build a Wallet
          • Accept a W3C VC
          • Present a W3C VC
          • Present mDL in-person/offline
          • Present an mDL over the internet
        • Build a Verifier
          • Verify a W3C VC
          • Verify an mDL in-person/offline
          • Verify an mDL over the internet
      • SpruceKit Android SDK
        • Installation
        • Build a Wallet
          • Accept a W3C VC
          • Present a W3C VC
          • Present an mDL in-person/offline
          • Present an mDL over the internet
        • Build a Verifier
          • Verify a W3C VC
          • Verify an mDL in-person/offline
          • Verify an mDL over the internet
  • Verifiable Digital Credentials
    • ⚙️DIDKit
      • Installation
      • Core Concepts
      • DID Methods
      • Runtime Configuration
      • Specifications and Dependencies
      • Quickstart
      • DIDKit Packages
        • Command Line Interface
        • HTTP Server
        • Rust Crate
        • C Interface
        • Java and Android
        • Python
        • Javascript
      • DIDKit Examples
        • Core Functions (CLI)
        • Core Functions (HTTP)
        • did-web in minutes
        • Batch Generation & Verification
    • 🪪ISO mDL
      • Quickstart
      • Core Concepts
      • User Guide
  • Schema Definition Language
    • 🔗TreeLDR
      • TreeLDR Quickstart
        • First Schema
        • Compilation into JSON Schema
        • Compilation into JSON-LD Context
        • Writing a Layout
        • Simple Rust Integration
      • Types
        • Literal Types
      • Layouts
        • Primitive Layouts
        • Literal Layouts
        • Enumeration
        • Array Layout
        • References
      • Compiling
        • Schema Definition Formats
          • JSON Schema
          • JSON-LD Context
          • Resource Description Framework (RDF)
        • Programming Languages
          • Compiling to Rust
      • RDF Vocabulary
      • 💡TreeLDR Basics
        • Types and Layouts
        • Properties
        • Syntax
  • Witness for Credential Claims
    • 🔭Rebase
      • Core Library
      • Rust Client/Witness SDK
      • WASM Client SDK
      • Simple "Basic Post" Schema
      • DNS Witness Flow Schema
  • References
    • Contributing
    • Code of Conduct
Powered by GitBook
On this page
  • 1. Define your Mdl Sharing View
  • 2. Implement the Engaging_Qr_Code status
  • 3. Implement the Submit_Namespaces status
  • 4. Implement the other PresentmentStates

Was this helpful?

  1. SpruceKit Mobile
  2. SpruceKit Mobile SDK
  3. SpruceKit Android SDK
  4. Build a Wallet

Present an mDL in-person/offline

Present an ISO/IEC 18013-5 mDL over BlueTooth Low Energy

PreviousPresent a W3C VCNextPresent an mDL over the internet

Last updated 3 months ago

Was this helpful?

This guide is for Android applications. Building for iOS? Look here: Present mDL in-person/offline

To present an mDL over BLE, you will need to use the following components:

  • The CredentialViewModel Component

  • The IsoMdlPresentation Component

During the presentation, you will have to manage the . The PresentmentState definition is repeated here to show the stages that the presentation goes through. The View that manages your UI should deal with each one of these listed cases. Again, we have an to give you some inspiration.

// The different Wallet-side states of an mDL presentation.

enum class PresentmentState {
    /// Presentment has yet to start
    UNINITIALIZED,

    /// App should display the error message
    ERROR,

    /// App should display the QR code
    ENGAGING_QR_CODE,

    /// App should display an interactive page for the user to chose which values to reveal
    SELECT_NAMESPACES,

    /// App should display a success message and offer to close the page
    SUCCESS,
}

1. Define your Mdl Sharing View

@Composable
fun MdlShareView(
    credentialViewModel: CredentialsViewModel,
) {

    val context = LocalContext.current
    val session by credentialViewModel.session.collectAsState()
    val currentState by credentialViewModel.currState.collectAsState()

    when (currentState) {
        // Implement your UI based on the PresentmentState
    }

}

2. Implement the Engaging_Qr_Code status

// Instantiate the CredentialViewModel

val credentialViewModel = ViewModelProvider.AndroidViewModelFactory(application)
            .create(CredentialsViewModel::class.java)

val session = credentialViewModel.session.collectAsState()

// Generate a QR code uri to embed.
let uri = session.getQrCodeUri()

// Then, generate the QR image

3. Implement the Submit_Namespaces status

// The submitNamespaces() method can be called from the credentialViewModel
// To set the allowedNamespaces value in the credentialViewModel, implement a UI that
// allows a user to select which data fields can be shared.
val allowedNamespaces by credentialViewModel.allowedNamespaces.collectAsState()
credentialViewmodel.submitNamespace(allowedNamespaces)

4. Implement the other PresentmentStates

The remaining PresentmentStates are available for you to implement the rest of the user experience.

In the step, the user needs to permit datafields to be shared. The Showcase app achieves this with the .

PresentmentState
example
MdocFieldSelector