@@ -77,12 +77,10 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
77
77
// pass
78
78
} else {
79
79
throw new Violation ( {
80
- violates : {
81
- message : "CWT Token ID claim MUST be present" ,
82
- section : "2.1.0.1.1" ,
83
- link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
84
- description : "The COVID Pass is malformed or has been modified."
85
- } ,
80
+ message : "CWT Token ID claim MUST be present" ,
81
+ section : "2.1.0.1.1" ,
82
+ link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
83
+ description : "The COVID Pass is malformed or has been modified." ,
86
84
} ) ;
87
85
}
88
86
@@ -92,12 +90,10 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
92
90
// pass
93
91
} else {
94
92
throw new Violation ( {
95
- violates : {
96
- message : "Issuer claim MUST be present" ,
97
- section : "2.1.0.2.1" ,
98
- link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
99
- description : "The COVID Pass is malformed or has been modified."
100
- } ,
93
+ message : "Issuer claim MUST be present" ,
94
+ section : "2.1.0.2.1" ,
95
+ link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
96
+ description : "The COVID Pass is malformed or has been modified." ,
101
97
} ) ;
102
98
}
103
99
// Section 2.1.0.3.5
@@ -106,13 +102,11 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
106
102
// pass
107
103
} else {
108
104
throw new Violation ( {
109
- violates : {
110
- message :
111
- "Not Before claim MUST be present and MUST be a timestamp encoded as an integer in the NumericDate format (as specified in [RFC8392] section 2)" ,
112
- section : "2.1.0.3.1" ,
113
- link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
114
- description : "The COVID Pass is malformed or has been modified."
115
- } ,
105
+ message :
106
+ "Not Before claim MUST be present and MUST be a timestamp encoded as an integer in the NumericDate format (as specified in [RFC8392] section 2)" ,
107
+ section : "2.1.0.3.1" ,
108
+ link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
109
+ description : "The COVID Pass is malformed or has been modified." ,
116
110
} ) ;
117
111
}
118
112
@@ -122,13 +116,11 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
122
116
// pass
123
117
} else {
124
118
throw new Violation ( {
125
- violates : {
126
- message :
127
- "Not Before claim MUST be present and MUST be a timestamp encoded as an integer in the NumericDate format (as specified in [RFC8392] section 2)" ,
128
- section : "2.1.0.4.1" ,
129
- link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
130
- description : "The COVID Pass is malformed or has been modified."
131
- } ,
119
+ message :
120
+ "Not Before claim MUST be present and MUST be a timestamp encoded as an integer in the NumericDate format (as specified in [RFC8392] section 2)" ,
121
+ section : "2.1.0.4.1" ,
122
+ link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
123
+ description : "The COVID Pass is malformed or has been modified." ,
132
124
} ) ;
133
125
}
134
126
@@ -137,13 +129,11 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
137
129
// pass
138
130
} else {
139
131
throw new Violation ( {
140
- violates : {
141
- message :
142
- "The current datetime is after or equal to the value of the `nbf` claim" ,
143
- link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
144
- section : "2.1.0.3.3" ,
145
- description : "The COVID Pass is not yet activated."
146
- } ,
132
+ message :
133
+ "The current datetime is after or equal to the value of the `nbf` claim" ,
134
+ link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
135
+ section : "2.1.0.3.3" ,
136
+ description : "The COVID Pass is not yet activated." ,
147
137
} ) ;
148
138
}
149
139
@@ -152,12 +142,10 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
152
142
// pass
153
143
} else {
154
144
throw new Violation ( {
155
- violates : {
156
- message : "The current datetime is before the value of the `exp` claim" ,
157
- link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
158
- section : "2.1.0.4.3" ,
159
- description : "The COVID Pass has expired."
160
- } ,
145
+ message : "The current datetime is before the value of the `exp` claim" ,
146
+ link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
147
+ section : "2.1.0.4.3" ,
148
+ description : "The COVID Pass has expired." ,
161
149
} ) ;
162
150
}
163
151
@@ -167,12 +155,10 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
167
155
// pass
168
156
} else {
169
157
throw new Violation ( {
170
- violates : {
171
- message : "Verifiable Credential CWT claim MUST be present" ,
172
- section : "2.1.0.5.1" ,
173
- link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
174
- description : "The COVID Pass is malformed or has been modified."
175
- } ,
158
+ message : "Verifiable Credential CWT claim MUST be present" ,
159
+ section : "2.1.0.5.1" ,
160
+ link : "https://nzcp.covid19.health.nz/#cwt-claims" ,
161
+ description : "The COVID Pass is malformed or has been modified." ,
176
162
} ) ;
177
163
}
178
164
@@ -191,13 +177,11 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
191
177
// pass
192
178
} else {
193
179
throw new Violation ( {
194
- violates : {
195
- message :
196
- "Verifiable Credential JSON-LD Context property doesn't conform to New Zealand COVID Pass example" ,
197
- link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
198
- section : "2.3.2" ,
199
- description : "The COVID Pass is malformed or has been modified."
200
- } ,
180
+ message :
181
+ "Verifiable Credential JSON-LD Context property doesn't conform to New Zealand COVID Pass example" ,
182
+ link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
183
+ section : "2.3.2" ,
184
+ description : "The COVID Pass is malformed or has been modified." ,
201
185
} ) ;
202
186
}
203
187
@@ -217,13 +201,11 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
217
201
// pass
218
202
} else {
219
203
throw new Violation ( {
220
- violates : {
221
- message :
222
- "Verifiable Credential Type property doesn't conform to New Zealand COVID Pass example" ,
223
- link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
224
- section : "2.3.5" ,
225
- description : "The COVID Pass is malformed or has been modified."
226
- } ,
204
+ message :
205
+ "Verifiable Credential Type property doesn't conform to New Zealand COVID Pass example" ,
206
+ link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
207
+ section : "2.3.5" ,
208
+ description : "The COVID Pass is malformed or has been modified." ,
227
209
} ) ;
228
210
}
229
211
@@ -233,12 +215,10 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
233
215
// pass
234
216
} else {
235
217
throw new Violation ( {
236
- violates : {
237
- message : "Verifiable Credential Version property MUST be 1.0.0" ,
238
- link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
239
- section : "2.3.8" ,
240
- description : "The QR code is not a valid NZ COVID Pass."
241
- } ,
218
+ message : "Verifiable Credential Version property MUST be 1.0.0" ,
219
+ link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
220
+ section : "2.3.8" ,
221
+ description : "The QR code is not a valid NZ COVID Pass." ,
242
222
} ) ;
243
223
}
244
224
@@ -248,33 +228,27 @@ export function validateCWTClaims(cwtClaims: UnvalidatedCWTClaims): CWTClaims {
248
228
// and its value MUST be a JSON object with properties determined by the declared pass type for the pass
249
229
if ( ! cwtClaims . vc . credentialSubject . givenName ) {
250
230
throw new Violation ( {
251
- violates : {
252
- message : "Missing REQUIRED 'givenName' in credentialSubject property" ,
253
- link : "https://nzcp.covid19.health.nz/#publiccovidpass" ,
254
- section : "2.4.1.2.1" ,
255
- description : "\"Given Name\" missing from NZ COVID Pass."
256
- } ,
231
+ message : "Missing REQUIRED 'givenName' in credentialSubject property" ,
232
+ link : "https://nzcp.covid19.health.nz/#publiccovidpass" ,
233
+ section : "2.4.1.2.1" ,
234
+ description : '"Given Name" missing from NZ COVID Pass.' ,
257
235
} ) ;
258
236
}
259
237
if ( ! cwtClaims . vc . credentialSubject . dob ) {
260
238
throw new Violation ( {
261
- violates : {
262
- message : "Missing REQUIRED 'dob' in credentialSubject property" ,
263
- link : "https://nzcp.covid19.health.nz/#publiccovidpass" ,
264
- section : "2.4.1.2.2" ,
265
- description : "\"Date of Birth\" missing from NZ COVID Pass."
266
- } ,
239
+ message : "Missing REQUIRED 'dob' in credentialSubject property" ,
240
+ link : "https://nzcp.covid19.health.nz/#publiccovidpass" ,
241
+ section : "2.4.1.2.2" ,
242
+ description : '"Date of Birth" missing from NZ COVID Pass.' ,
267
243
} ) ;
268
244
}
269
245
} else {
270
246
throw new Violation ( {
271
- violates : {
272
- message :
273
- "Verifiable Credential Credential Subject property MUST be present" ,
274
- link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
275
- section : "2.3.9" ,
276
- description : "The COVID Pass is malformed or has been modified."
277
- } ,
247
+ message :
248
+ "Verifiable Credential Credential Subject property MUST be present" ,
249
+ link : "https://nzcp.covid19.health.nz/#verifiable-credential-claim-structure" ,
250
+ section : "2.3.9" ,
251
+ description : "The COVID Pass is malformed or has been modified." ,
278
252
} ) ;
279
253
}
280
254
0 commit comments