:heavy_exclamation_mark: Important! Before you proceed, please read the EUDI Wallet Reference Implementation project description
Implementation of mDoc Data retrieval using Bluetooth® low energy (BLE) according to ISO/IEC 18013-5 standard. At the present time, device engagement is available only using QR code.
The MdocGattServer
provides the BLE transfer implementation. To begin, create an instance of the class and keep the referenence in the view.
var bleServerTransfer = MdocGattServer()
The BLE server needs to be initialized with a dictionary. The parameters are: | Key | Value |
---|---|---|
document_data | Array of documents Base64-serialized as described here | |
trusted_certificates | Array of trusted certificates of reader authentication | |
require_user_accept | True if holder acceptance is required to send the requested data |
func initialize() {
bleServerTransfer.initialize(parameters: [
InitializeKeys.document_data.rawValue: [Data(name: "sample_data")!],
InitializeKeys.trusted_certificates.rawValue: [Data(name: "scytales_root_ca", ext: "der")!],
InitializeKeys.require_user_accept.rawValue: true
]
)
bleServerTransfer.delegate = this
}
The delegate object must be an instance of a class conforming to the MdocOfflineDelegate
protocol
public protocol MdocOfflineDelegate: AnyObject {
func didChangeStatus(_ newStatus: TransferStatus)
func didFinishedWithError(_ error: Error)
func didReceiveRequest(_ request: UserRequestInfo, handleAccept: @escaping (Bool) -> Void)
}
To initiate the device engagement method, use the following method:
bleServerTransfer.performDeviceEngagement()
The QR code payload can be obtained from the property qrCodePayload
when the status
has the value TransferStatus.qrEngagementReady
.
When user (holder) acceptance is required, the app should show the request items and the reader certificate details (if reader auth is used).
The BLE server will send the requested if the user accepts. In the case the client app must call the handleAccept
callback with true
.
Detail documentation reference is provided here
The released software is a initial development release version:
Copyright (c) 2023 European Commission
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.