createProximityPresentationSession
Create a proximity based presentation session with an mDoc verifier using device retrieval as per ISO/IEC 18013-5:2021.
Create a proximity based presentation session with an mDoc verifier using device retrieval as per ISO/IEC 18013-5:2021.
This function requires the calling application to have been granted the following Bluetooth-related permissions:
For iOS
The integrating application MUST have the "NSBluetoothAlwaysUsageDescription" attribute in its "info.plist" file. Failing to do so might result in a runtime application crash when calling this API.
If the application using this SDK hasn't tried to use Bluetooth before, calling this function will result in a system UI prompt asking the user to grant Bluetooth permissions to the application. If the user has denied a similar previous permission request (either when interacting with another part of the application or through a prior call to this function) the MobileCredentialHolderErrorType.BluetoothPermissionDenied error is thrown until the user explicitly grants Bluetooth permissions to the application in their OS app settings.
For Android
For Android versions R/11 (API level 30) and below:
- android.permission.BLUETOOTH
- android.permission.BLUETOOTH_ADMIN
- android.permission.ACCESS_FINE_LOCATION
- android.permission.ACCESS_COARSE_LOCATION
For Android versions S/12 (API level 31) and above:
- android.permission.BLUETOOTH_SCAN
- android.permission.BLUETOOTH_ADVERTISE
- android.permission.BLUETOOTH_CONNECT
requestReceivedAction
In the event of an error onRequestReceived action can produce the following:
- ProximityPresentationSessionErrorType.MobileCredentialRequestDecodingError
- ProximityPresentationSessionErrorType.MobileCredentialRequestNotReceived
- ProximityPresentationSessionErrorType.SessionTerminated
- ProximityPresentationSessionErrorType.CannotEstablishSession
- ProximityPresentationSessionErrorType.MobileCredentialRequestReceivedOnTerminatedSession
sessionTerminatedAction
sessionTerminatedAction is invoked when a session is terminated:
| Termination Cause | Error Passed to onSessionTerminated Callback |
|---|---|
| Incoming message from verifier cannot be processed due to invalid CBOR format or a cryptography-related issue. | ProximityPresentationSessionTerminationErrorType.SessionStatusCodeSent |
| The verifier indicated that they cannot process a message from the holder due to invalid CBOR format or a cryptography-related issue. | ProximityPresentationSessionTerminationErrorType.SessionStatusCodeReceived |
The holder terminates the session by calling terminateSession(). | null |
| The verifier terminates the session. | null |
| BLE connection lost | ProximityPresentationSessionTerminationErrorType.DataTransportDisconnected |
| Session timeout | ProximityPresentationSessionTerminationErrorType.InactivitySessionTimedOut |
Signature
function createProximityPresentationSession(
options: CreateProximityPresentationSessionOptions
): Promise<Result<ProximityPresentationSession, CreateProximityPresentationSessionError>>Parameters
Prop
Type
Returns
Promise<Result<ProximityPresentationSession, CreateProximityPresentationSessionError>>
Throws
InvalidParams if the provided arguments are missing or invalid.
MobileCredentialHolderErrorType.SdkNotInitialized if the SDK has not been initialized.
How would you rate this page?