handle

suspend fun handle(qrCodeData: String, askConsent: suspend (ConsentPromptData) -> Boolean, authenticate: suspend (cryptoObject: BiometricPrompt.CryptoObject, onAuthenticated: suspend (BiometricPrompt.CryptoObject) -> Unit) -> Boolean, onSuccess: () -> Unit)

Main entry point for handling a remote OpenID4VP presentation from a QR code.

High-level flow:

  1. Resolve the OpenID4VP request from qrCodeData using SiopOpenId4Vp.

  2. Extract the PresentationDefinition and requested claims.

  3. Build PREX PrexClaims from wallet documents and run PE matching.

  4. For a successful match:

    • identify the selected document and which fields will be disclosed;

    • build a PresentationSubmission with descriptor maps.

  5. Ask the user for consent via askConsent (UI supplied by the host app).

  6. Trigger device / biometric authentication via authenticate.

  7. Build an SD-JWT-based VerifiablePresentation inside the authenticated session.

  8. Dispatch the VP to the verifier and call onSuccess on acceptance.

Parameters

qrCodeData

Raw QR code string, typically containing a request_uri.

askConsent

Callback that:

  • receives a ConsentPromptData describing what will be shared,

  • shows your own consent UI,

  • returns true if user approves, false otherwise.

authenticate

Callback that:

  • receives a BiometricPrompt.CryptoObject for signing,

  • is responsible for starting a biometric / device-auth flow,

  • must call onAuthenticated when authentication succeeds,

  • returns true if auth completed successfully, false if cancelled or failed.

onSuccess

Invoked when the verifier returns an Accepted response.

Throws

for all domain / protocol / network errors.