Skip to content

Commit

Permalink
fix: issuing_jurisdiction enforcement
Browse files Browse the repository at this point in the history
this is only required if the stateOrProvinceName element is present in the DS certificate

fixes #26
  • Loading branch information
siacomuzzi committed Oct 29, 2024
1 parent 87a39cb commit 822672a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/mdoc/IssuerSignedItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class IssuerSignedItem {
if (this.elementIdentifier === 'issuing_country') {
return countryName === this.elementValue;
}
if (this.elementIdentifier === 'issuing_jurisdiction') {
if (this.elementIdentifier === 'issuing_jurisdiction' && stateOrProvince) {
return stateOrProvince === this.elementValue;
}
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/mdoc/Verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class Verifier {
});

const invalidJurisdiction = verifications.filter((v) => v.ns === ns && v.ev.elementIdentifier === 'issuing_jurisdiction')
.find((v) => !v.isValid || !v.ev.matchCertificate(ns, issuerAuth));
.find((v) => !v.isValid || (issuerAuth.stateOrProvince && !v.ev.matchCertificate(ns, issuerAuth)));

onCheck({
status: invalidJurisdiction ? 'FAILED' : 'PASSED',
Expand Down

0 comments on commit 822672a

Please sign in to comment.