CLASS
Contents
- Properties
presentationService
readerCertIssuer
readerCertValidationMessage
readerCertIssuerValid
uiError
disclosedDocuments
status
deviceEngagement
- Methods
init(presentationService:userAuthenticationRequired:)
makeError(str:)
makeError(code:str:)
startQrEngagement()
receiveRequest()
sendResponse(userAccepted:itemsToSend:onCancel:onSuccess:)
public class PresentationSession: ObservableObject
Presentation session
This class wraps the PresentationService
instance, providing bindable fields to a SwifUI view
public var presentationService: any PresentationService
@Published public var readerCertIssuer: String?
Reader certificate issuer (only for BLE flow wih verifier using reader authentication)
@Published public var readerCertValidationMessage: String?
Reader certificate validation message (only for BLE transfer wih verifier using reader authentication)
@Published public var readerCertIssuerValid: Bool?
Reader certificate issuer is valid (only for BLE transfer wih verifier using reader authentication)
@Published public var uiError: WalletError?
Error message when the status
is in the error state.
@Published public var disclosedDocuments: [DocElementsViewModel] = []
Request items selected by the user to be sent to verifier.
@Published public var status: TransferStatus = .initializing
Status of the data transfer.
@Published public var deviceEngagement: Data?
Device engagement data (QR image data for the BLE flow)
public init(presentationService: any PresentationService, userAuthenticationRequired: Bool)
public static func makeError(str: String) -> NSError
public static func makeError(code: ErrorCode, str: String? = nil) -> NSError
public func startQrEngagement() async
Start QR engagement to be presented to verifier
On success deviceEngagement
published variable will be set with the result and status
will be .qrEngagementReady
On error uiError
will be filled and status
will be .error
public func receiveRequest() async -> [String: Any]?
Receive request from verifer
The request is futher decoded internally. See also decodeRequest(_:)
On success disclosedDocuments
published variable will be set and status
will be .requestReceived
On error uiError
will be filled and status
will be .error
- Returns: A request dictionary keyed by
MdocDataTransfer.UserRequestKeys
public func sendResponse(userAccepted: Bool, itemsToSend: RequestItems, onCancel: (() -> Void)? = nil, onSuccess: ((URL?) -> Void)? = nil) async
Send response to verifier
- Parameters:
- userAccepted: Whether user confirmed to send the response
- itemsToSend: Data to send organized into a hierarcy of doc.types and namespaces
- onCancel: Action to perform if the user cancels the biometric authentication
Name | Description |
---|---|
userAccepted | Whether user confirmed to send the response |
itemsToSend | Data to send organized into a hierarcy of doc.types and namespaces |
onCancel | Action to perform if the user cancels the biometric authentication |