Define your checks
package samples
import com.wallet.model.DocTypesimport com.wallet.model.PresentationRequestimport com.wallet.model.PresetAnswerimport com.wallet.model.RequestPreset
/** The checks an operator can pick. A preset is a title, the document, the fields, and how to show the answer. */object Checks { private const val EID = "org.iso.23220.1" private const val EID_PHOTO_ID = "org.iso.23220.photoid.1"
val AGE_18 = RequestPreset( id = "eid-age-over-18", section = "Emirates ID", // group in the picker title = "Age check", subtitle = "Photo and over 18", request = PresentationRequest( docType = DocTypes.PHOTO_ID, namespaces = mapOf(EID to setOf("portrait", "age_over_18", "issuing_authority")), ), answer = PresetAnswer.YesNo("age_over_18", "Over 18"), // one big Yes / No symbol = "18+", )
val IDENTITY = RequestPreset( id = "eid-identity", section = "Emirates ID", title = "Identity check", subtitle = "Photo, name, ID number, validity", request = PresentationRequest( docType = DocTypes.PHOTO_ID, namespaces = mapOf( EID to setOf("portrait", "given_name", "family_name", "birth_date", "expiry_date", "issuing_authority"), EID_PHOTO_ID to setOf("person_id"), ), ), answer = PresetAnswer.Details, // photo, name and every field returned symbol = "ID", )
val emiratesId = listOf(AGE_18, IDENTITY)}import Wallet
/// The checks an operator can pick. A preset is a title, the document, the fields, and how to show the answer.enum Checks { private static let eid = "org.iso.23220.1" private static let eidPhotoId = "org.iso.23220.photoid.1"
static let age18 = RequestPreset( id: "eid-age-over-18", section: "Emirates ID", // group in the picker title: "Age check", subtitle: "Photo and over 18", request: PresentationRequest( docType: DocTypes.shared.PHOTO_ID, attributes: [], namespaces: [eid: ["portrait", "age_over_18", "issuing_authority"]] ), answer: PresetAnswerYesNo(element: "age_over_18", label: "Over 18"), // one big Yes / No symbol: "18+" )
static let identity = RequestPreset( id: "eid-identity", section: "Emirates ID", title: "Identity check", subtitle: "Photo, name, ID number, validity", request: PresentationRequest( docType: DocTypes.shared.PHOTO_ID, attributes: [], namespaces: [ eid: ["portrait", "given_name", "family_name", "birth_date", "expiry_date", "issuing_authority"], eidPhotoId: ["person_id"], ] ), answer: PresetAnswerDetails.shared, // photo, name and every field returned symbol: "ID" )
static let emiratesId = [age18, identity]}Pass presets to the screen in the order you want them; they are grouped by section
(RequestPresets.mdl + Checks.emiratesId, as in the Quickstart).
How the answer is shown
Section titled “How the answer is shown”answer |
The result screen shows |
|---|---|
PresetAnswer.Details |
the photo, the name and every field returned |
PresetAnswer.YesNo(element, label) |
one large Yes / No from a boolean field (age_over_21) |
PresetAnswer.ValidUntil(element, label) |
one large Valid / Expired from a date field (a medical, a permit) |
Ask for the minimum
Section titled “Ask for the minimum”The wallet shows the list to the holder, and a short list is approved more often.
| You need to know | Ask for |
|---|---|
| Is this person over 21? | portrait, age_over_21 |
| Who is this person? | portrait, given_name, family_name, birth_date, and the ID number |
| Is the licence valid? | portrait, document_number, expiry_date, driving_privileges |
issuing_authority is not personal data and lets the result say who issued the document.
Ready-made presets
Section titled “Ready-made presets”| Document | Presets |
|---|---|
| Driving licence | RequestPresets.MDL_AGE_OVER_18, RequestPresets.MDL_DRIVER_CHECK (built in) |
| Emirates ID | age 18+ and identity (the sample above; the demo’s brand pack has the same) |
| Competition licence | valid medical, licence check (in the demo’s brand pack) |
Field names per document are in Credentials.
Next: Read the result.