/eudi-lib-ios-iso18013-data-model

Implementation of the mDoc data model according to ISO/IEC 18013-5 standard

Primary LanguageSwiftApache License 2.0Apache-2.0

EUDI Wallet Data Model library ISO/IEC 18013-5 for iOS

Important! Before you proceed, please read the EUDI Wallet Reference Implementation project description


eudi-lib-ios-iso18013-data-model

Swift Lines of Code Duplicated Lines (%) Reliability Rating Vulnerabilities

Implementation of the mDoc data model according to ISO/IEC 18013-5 standard (0.9.0)

Overview

DeviceEngagement

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.

Initialization

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
...

DeviceRequest

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)

DeviceResponse

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 }

Dependencies (to other libs)

Reference

Detailed documentation is provided here

Disclaimer

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

License details

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.