❗ Important! Before you proceed, please read the EUDI Wallet Reference Implementation project description
Implementation of the mDoc data model according to ISO/IEC 18013-5 standard (0.9.0)
The DeviceEngagement
structure contains information to perform device engagement.
At present, device engagement using QR code and data retrieval using Bluetooth low energy (BLE) are available.
To initialize a new instance of the DeviceEngagement
structure, supply BLE mode and optionally EC Curve type.
You can then retrieve a QR code, as the following code shows:
let de = DeviceEngagement(isBleServer: isBleServer, crv: .p256)
// get a UIKit image
let qrCodeImage = de.getQrCodeImage()
// get a string payload
let qrCodePayload = de.getQrCodePayload()
// to use in SwiftUI, use the Image(uiImage:) initializer
...
Device retrieval mdoc request structure
In mDoc holder initialize a DeviceRequest
with incoming CBOR bytes (decoding)
let dr = DeviceRequest(data: bytes)
In mdoc reader initialize a DeviceRequest
with desired elements to read
let isoKeys: [IsoMdlModel.CodingKeys] = [.familyName, .documentNumber, .drivingPrivileges, .issueDate, .expiryDate, .portrait]
let dr3 = DeviceRequest(mdl: isoKeys, agesOver: [18,21], intentToRetain: true)
Device retrieval mdoc response. It is CBOR encoded
In mdoc reader initialize from CBOR data received from holder (data exchange) In mdoc holder initialize from CBOR data received from server (registration)
let dr = DeviceResponse(data: bytes)
The device response has the following structure:
Data = { "documents" : [+Document] }
Document = { "docType" : DocType, "issuerSigned" : IssuerSigned }
IssuerSigned = { "nameSpaces" : IssuerNameSpaces, }
IssuerNameSpaces = {
- NameSpace => [ + IssuerSignedItemBytes ] }
IssuerSignedItem = { "digestID" : uint, "random" : bstr, "elementIdentifier" : DataElementIdentifier, "elementValue" : DataElementValue }
- A CBOR implementation for Swift SwiftCBOR
- A Logging API for Swift: swift-log
- Commonly used data structures for Swift swift-collections
Detailed documentation is provided here
The released software is a initial development release version:
- The initial development release is an early endeavor reflecting the efforts of a short timeboxed period, and by no means can be considered as the final product.
- The initial development release may be changed substantially over time, might introduce new features but also may change or remove existing ones, potentially breaking compatibility with your existing code.
- The initial development release is limited in functional scope.
- The initial development release may contain errors or design flaws and other problems that could cause system or other failures and data loss.
- The initial development release has reduced security, privacy, availability, and reliability standards relative to future releases. This could make the software slower, less reliable, or more vulnerable to attacks than mature software.
- The initial development release is not yet comprehensively documented.
- Users of the software must perform sufficient engineering and additional testing in order to properly evaluate their application and determine whether any of the open-sourced components is suitable for use in that application.
- We strongly recommend to not put this version of the software into production use.
- Only the latest version of the software will be supported
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.