1
1
package org.multipaz.documenttype.knowntypes
2
2
3
- import org.multipaz.cbor.CborArray
4
- import org.multipaz.cbor.toDataItem
5
- import org.multipaz.cbor.toDataItemFullDate
6
3
import org.multipaz.documenttype.DocumentAttributeType
7
4
import org.multipaz.documenttype.DocumentType
8
5
import org.multipaz.documenttype.Icon
9
- import kotlinx.datetime.LocalDate
10
6
import kotlinx.serialization.json.JsonPrimitive
11
7
import kotlinx.serialization.json.buildJsonArray
12
- import kotlinx.serialization.json.buildJsonObject
13
8
14
9
/* *
15
10
* Object containing the metadata of the German ID Document Type.
@@ -26,64 +21,64 @@ object GermanPersonalID {
26
21
*/
27
22
fun getDocumentType (): DocumentType {
28
23
return DocumentType .Builder (" German Personal ID" )
29
- .addVcDocumentType(vct = EUPID_VCT , keyBound = true )
30
- .addVcAttribute (
24
+ .addJsonDocumentType(type = EUPID_VCT , keyBound = true )
25
+ .addJsonAttribute (
31
26
DocumentAttributeType .String ,
32
27
" family_name" ,
33
28
" Family Name" ,
34
29
" Current last name(s), surname(s), or primary identifier of the PID holder" ,
35
30
Icon .PERSON ,
36
31
JsonPrimitive (SampleData .FAMILY_NAME )
37
32
)
38
- .addVcAttribute (
33
+ .addJsonAttribute (
39
34
DocumentAttributeType .String ,
40
35
" given_name" ,
41
36
" Given Names" ,
42
37
" Current first name(s), other name(s), or secondary identifier of the PID holder" ,
43
38
Icon .PERSON ,
44
39
JsonPrimitive (SampleData .GIVEN_NAME )
45
40
)
46
- .addVcAttribute (
41
+ .addJsonAttribute (
47
42
DocumentAttributeType .Date ,
48
43
" birthdate" ,
49
44
" Date of Birth" ,
50
45
" Day, month, and year on which the PID holder was born. If unknown, approximate date of birth." ,
51
46
Icon .TODAY ,
52
47
JsonPrimitive (SampleData .BIRTH_DATE )
53
48
)
54
- .addVcAttribute (
49
+ .addJsonAttribute (
55
50
DocumentAttributeType .Number ,
56
51
" age_in_years" ,
57
52
" Age in Years" ,
58
53
" The age of the PID holder in years" ,
59
54
Icon .TODAY ,
60
55
JsonPrimitive (SampleData .AGE_IN_YEARS )
61
56
)
62
- .addVcAttribute (
57
+ .addJsonAttribute (
63
58
DocumentAttributeType .Number ,
64
59
" age_birth_year" ,
65
60
" Year of Birth" ,
66
61
" The year when the PID holder was born" ,
67
62
Icon .TODAY ,
68
63
JsonPrimitive (SampleData .AGE_BIRTH_YEAR )
69
64
)
70
- .addVcAttribute (
65
+ .addJsonAttribute (
71
66
DocumentAttributeType .Boolean ,
72
67
" 12" ,
73
68
" Older Than 12" ,
74
69
" Age over 12?" ,
75
70
Icon .TODAY ,
76
71
JsonPrimitive (SampleData .AGE_OVER )
77
72
)
78
- .addVcAttribute (
73
+ .addJsonAttribute (
79
74
DocumentAttributeType .Boolean ,
80
75
" 14" ,
81
76
" Older Than 14" ,
82
77
" Age over 14?" ,
83
78
Icon .TODAY ,
84
79
JsonPrimitive (SampleData .AGE_OVER )
85
80
)
86
- .addVcAttribute (
81
+ .addJsonAttribute (
87
82
DocumentAttributeType .Boolean ,
88
83
" 16" ,
89
84
" Older Than 16" ,
@@ -92,111 +87,111 @@ object GermanPersonalID {
92
87
JsonPrimitive (SampleData .AGE_OVER_16 )
93
88
)
94
89
// TODO: nest in age_equal_or_over object
95
- .addVcAttribute (
90
+ .addJsonAttribute (
96
91
DocumentAttributeType .Boolean ,
97
92
" 18" ,
98
93
" Older Than 18" ,
99
94
" Age over 18?" ,
100
95
Icon .TODAY ,
101
96
JsonPrimitive (SampleData .AGE_OVER_18 )
102
97
)
103
- .addVcAttribute (
98
+ .addJsonAttribute (
104
99
DocumentAttributeType .Boolean ,
105
100
" 21" ,
106
101
" Older Than 21" ,
107
102
" Age over 21?" ,
108
103
Icon .TODAY ,
109
104
JsonPrimitive (SampleData .AGE_OVER_21 )
110
105
)
111
- .addVcAttribute (
106
+ .addJsonAttribute (
112
107
DocumentAttributeType .Boolean ,
113
108
" 65" ,
114
109
" Older Than 65" ,
115
110
" Age over 65?" ,
116
111
Icon .TODAY ,
117
112
JsonPrimitive (SampleData .AGE_OVER_65 )
118
113
)
119
- .addVcAttribute (
114
+ .addJsonAttribute (
120
115
DocumentAttributeType .String ,
121
116
" birth_family_name" ,
122
117
" Family Name at Birth" ,
123
118
" Last name(s), surname(s), or primary identifier of the PID holder at birth" ,
124
119
Icon .PERSON ,
125
120
JsonPrimitive (SampleData .FAMILY_NAME_BIRTH )
126
121
)
127
- .addVcAttribute (
122
+ .addJsonAttribute (
128
123
DocumentAttributeType .String ,
129
124
" birth_place" ,
130
125
" Place of Birth" ,
131
126
" Country and municipality or state/province where the PID holder was born" ,
132
127
Icon .PLACE ,
133
128
JsonPrimitive (SampleData .BIRTH_PLACE )
134
129
)
135
- .addVcAttribute (
130
+ .addJsonAttribute (
136
131
DocumentAttributeType .StringOptions (Options .COUNTRY_ISO_3166_1_ALPHA_2 ),
137
132
" birth_country" ,
138
133
" Country of Birth" ,
139
134
" The country where the PID User was born, as an Alpha-2 country code as specified in ISO 3166-1" ,
140
135
Icon .PLACE ,
141
136
JsonPrimitive (SampleData .BIRTH_COUNTRY )
142
137
)
143
- .addVcAttribute (
138
+ .addJsonAttribute (
144
139
DocumentAttributeType .String ,
145
140
" birth_state" ,
146
141
" State of Birth" ,
147
142
" The state, province, district, or local area where the PID User was born" ,
148
143
Icon .PLACE ,
149
144
JsonPrimitive (SampleData .BIRTH_STATE )
150
145
)
151
- .addVcAttribute (
146
+ .addJsonAttribute (
152
147
DocumentAttributeType .String ,
153
148
" birth_city" ,
154
149
" City of Birth" ,
155
150
" The municipality, city, town, or village where the PID User was born" ,
156
151
Icon .PLACE ,
157
152
JsonPrimitive (SampleData .BIRTH_CITY )
158
153
)
159
- .addVcAttribute (
154
+ .addJsonAttribute (
160
155
DocumentAttributeType .String ,
161
156
" street_address" ,
162
157
" Resident Address" ,
163
158
" The full address of the place where the PID holder currently resides and/or may be contacted (street/house number, municipality etc.)" ,
164
159
Icon .PLACE ,
165
160
JsonPrimitive (SampleData .RESIDENT_ADDRESS )
166
161
)
167
- .addVcAttribute (
162
+ .addJsonAttribute (
168
163
DocumentAttributeType .String ,
169
164
" locality" ,
170
165
" Resident City" ,
171
166
" The city where the PID holder currently resides" ,
172
167
Icon .PLACE ,
173
168
JsonPrimitive (SampleData .RESIDENT_CITY )
174
169
)
175
- .addVcAttribute (
170
+ .addJsonAttribute (
176
171
DocumentAttributeType .StringOptions (Options .COUNTRY_ISO_3166_1_ALPHA_2 ),
177
172
" country" ,
178
173
" Resident Country" ,
179
174
" The country where the PID User currently resides, as an Alpha-2 country code as specified in ISO 3166-1" ,
180
175
Icon .PLACE ,
181
176
JsonPrimitive (SampleData .RESIDENT_COUNTRY )
182
177
)
183
- .addVcAttribute (
178
+ .addJsonAttribute (
184
179
DocumentAttributeType .String ,
185
180
" postal_code" ,
186
181
" Resident Postal Code" ,
187
182
" The postal code of the place where the PID holder currently resides" ,
188
183
Icon .PLACE ,
189
184
JsonPrimitive (SampleData .RESIDENT_POSTAL_CODE )
190
185
)
191
- .addVcAttribute (
186
+ .addJsonAttribute (
192
187
DocumentAttributeType .IntegerOptions (Options .SEX_ISO_IEC_5218 ),
193
188
" gender" ,
194
189
" Gender" ,
195
190
" PID holder’s gender" ,
196
191
Icon .EMERGENCY ,
197
192
JsonPrimitive (SampleData .SEX_ISO218 )
198
193
)
199
- .addVcAttribute (
194
+ .addJsonAttribute (
200
195
DocumentAttributeType .ComplexType ,
201
196
" nationalities" ,
202
197
" Nationality" ,
@@ -206,23 +201,23 @@ object GermanPersonalID {
206
201
add(JsonPrimitive (SampleData .NATIONALITY ))
207
202
}
208
203
)
209
- .addVcAttribute (
204
+ .addJsonAttribute (
210
205
DocumentAttributeType .Date ,
211
206
" issuance_date" ,
212
207
" Date of Issue" ,
213
208
" Date (and possibly time) when the PID was issued." ,
214
209
Icon .DATE_RANGE ,
215
210
JsonPrimitive (SampleData .ISSUE_DATE )
216
211
)
217
- .addVcAttribute (
212
+ .addJsonAttribute (
218
213
DocumentAttributeType .Date ,
219
214
" expiry_date" ,
220
215
" Date of Expiry" ,
221
216
" Date (and possibly time) when the PID will expire." ,
222
217
Icon .CALENDAR_CLOCK ,
223
218
JsonPrimitive (SampleData .EXPIRY_DATE )
224
219
)
225
- .addVcAttribute (
220
+ .addJsonAttribute (
226
221
DocumentAttributeType .String ,
227
222
" issuing_authority" ,
228
223
" Issuing Authority" ,
@@ -232,23 +227,23 @@ object GermanPersonalID {
232
227
Icon .ACCOUNT_BALANCE ,
233
228
JsonPrimitive (SampleData .ISSUING_AUTHORITY_EU_PID )
234
229
)
235
- .addVcAttribute (
230
+ .addJsonAttribute (
236
231
DocumentAttributeType .String ,
237
232
" document_number" ,
238
233
" Document Number" ,
239
234
" A number for the PID, assigned by the PID Provider." ,
240
235
Icon .NUMBERS ,
241
236
JsonPrimitive (SampleData .DOCUMENT_NUMBER )
242
237
)
243
- .addVcAttribute (
238
+ .addJsonAttribute (
244
239
DocumentAttributeType .String ,
245
240
" administrative_number" ,
246
241
" Administrative Number" ,
247
242
" A number assigned by the PID Provider for audit control or other purposes." ,
248
243
Icon .NUMBERS ,
249
244
JsonPrimitive (SampleData .ADMINISTRATIVE_NUMBER )
250
245
)
251
- .addVcAttribute (
246
+ .addJsonAttribute (
252
247
DocumentAttributeType .String ,
253
248
" issuing_jurisdiction" ,
254
249
" Issuing Jurisdiction" ,
@@ -258,7 +253,7 @@ object GermanPersonalID {
258
253
Icon .ACCOUNT_BALANCE ,
259
254
JsonPrimitive (SampleData .ISSUING_JURISDICTION )
260
255
)
261
- .addVcAttribute (
256
+ .addJsonAttribute (
262
257
DocumentAttributeType .StringOptions (Options .COUNTRY_ISO_3166_1_ALPHA_2 ),
263
258
" issuing_country" ,
264
259
" Issuing Country" ,
@@ -270,12 +265,12 @@ object GermanPersonalID {
270
265
.addSampleRequest(
271
266
id = " age_over_18" ,
272
267
displayName = " Age Over 18" ,
273
- vcClaims = listOf (" 18" )
268
+ jsonClaims = listOf (" 18" )
274
269
)
275
270
.addSampleRequest(
276
271
id = " mandatory" ,
277
272
displayName = " Mandatory Data Elements" ,
278
- vcClaims = listOf (
273
+ jsonClaims = listOf (
279
274
" family_name" ,
280
275
" given_name" ,
281
276
" birthdate" ,
@@ -289,7 +284,7 @@ object GermanPersonalID {
289
284
.addSampleRequest(
290
285
id = " full" ,
291
286
displayName = " All Data Elements" ,
292
- vcClaims = listOf ()
287
+ jsonClaims = listOf ()
293
288
)
294
289
.build()
295
290
}
0 commit comments