Skip to content

Commit

Permalink
fix: check issuer verification result
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Jul 18, 2024
1 parent d7aed20 commit 25c7675
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/modules/claims/claims.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import {
RoleEIP191JWT,
isEIP191Jwt,
IssuerResolver,
VerificationResult,
} from '@energyweb/vc-verification';
import { DidRegistry } from '../did-registry/did-registry.service';
import { ClaimData, isClaimService } from '../did-registry/did.types';
Expand Down Expand Up @@ -1490,11 +1491,20 @@ export class ClaimsService {
}
const role = vc.credentialSubject.role.namespace;
try {
let issuerVerificationResult: VerificationResult;
if (typeof issuerDID === 'string') {
await this._issuerVerification.verifyIssuer(issuerDID, role);
issuerVerificationResult = await this._issuerVerification.verifyIssuer(
issuerDID,
role
);
} else {
await this._issuerVerification.verifyIssuer(issuerDID.id, role);
issuerVerificationResult = await this._issuerVerification.verifyIssuer(
issuerDID.id,
role
);
}
issuerVerified = issuerVerified && issuerVerificationResult.verified;
errors.push(issuerVerificationResult.error);
} catch (e) {
issuerVerified = false;
errors.push((e as Error).message);
Expand Down

0 comments on commit 25c7675

Please sign in to comment.