You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fetches VCT Metadata from the header of the SD-JWT-VC. Returns the type metadata format. If the SD-JWT-VC does not contain a vct claim, an error is thrown.
309
+
* @param result
310
+
* @param
311
+
*/
312
+
privateasyncfetchVctFromHeader(
313
+
vct: string,
314
+
result: VerificationResult,
315
+
): Promise<TypeMetadataFormat>{
316
+
constvctmHeader=result.header?.vctm;
317
+
318
+
if(!vctmHeader||!Array.isArray(vctmHeader)){
319
+
thrownewError('vctm claim in SD JWT header is invalid');
320
+
}
321
+
322
+
consttypeMetadataFormat=(vctmHeaderasunknown[])
323
+
.map((vctm)=>{
324
+
if(!(typeofvctm==='string')){
325
+
thrownewError('vctm claim in SD JWT header is invalid');
326
+
}
327
+
328
+
returnJSON.parse(base64urlDecode(vctm));
329
+
})
330
+
.find((typeMetadataFormat)=>{
331
+
returntypeMetadataFormat.vct===vct;
332
+
});
333
+
334
+
if(!typeMetadataFormat){
335
+
thrownewError('could not find VCT Metadata in JWT header');
0 commit comments