{"version":3,"file":"VerifyService.mjs","names":["VerifyService","contextService: ContextService","revocations: RevocationService","proofs: ProofService"],"sources":["../../src/services/VerifyService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport { injectable, inject } from '@credo-ts/core'\nimport { ONE_EDTECH_REVOCATION_LIST } from '../constants'\nimport { validateObEnvelope } from '../utils/validate'\nimport { ContextService } from './ContextService'\nimport { ProofService } from './ProofService'\nimport { RevocationService } from './RevocationService'\n\n@injectable()\nexport class VerifyService {\n  public constructor(\n    @inject(ContextService) private readonly contextService: ContextService,\n    @inject(RevocationService) private readonly revocations: RevocationService,\n    @inject(ProofService) private readonly proofs: ProofService\n  ) {}\n\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  public async verify(agentContext: AgentContext, credentialOrJwt: any) {\n    const result = await this.proofs.verify(agentContext, credentialOrJwt)\n    const credential = result.credential ?? (typeof credentialOrJwt === 'string' ? undefined : credentialOrJwt)\n    const issues = credential ? validateObEnvelope(credential) : [{ code: 'missing_vc_claim', message: 'VC missing' }]\n    const status = credential ? await this.evaluateStatus(agentContext, credential) : 'unknown'\n    return { isValidStructure: issues.length === 0, issues, status, proofVerified: !!result.verified }\n  }\n\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  private async evaluateStatus(agentContext: AgentContext, credential: any) {\n    const now = Date.now()\n    const validUntil = credential?.validUntil ? Date.parse(credential.validUntil) : undefined\n    const expired = validUntil != null && now > validUntil\n    const revoked = await this.revocations.isRevoked(agentContext, credential)\n    return expired ? 'expired' : revoked ? 'revoked' : 'valid'\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;AASO,0BAAMA,gBAAc;CACzB,AAAO,YACL,AAAyCC,gBACzC,AAA4CC,aAC5C,AAAuCC,QACvC;EAHyC;EACG;EACL;;CAIzC,MAAa,OAAO,cAA4B,iBAAsB;EACpE,MAAM,SAAS,MAAM,KAAK,OAAO,OAAO,cAAc,gBAAgB;EACtE,MAAM,aAAa,OAAO,eAAe,OAAO,oBAAoB,WAAW,SAAY;EAC3F,MAAM,SAAS,aAAa,mBAAmB,WAAW,GAAG,CAAC;GAAE,MAAM;GAAoB,SAAS;GAAc,CAAC;EAClH,MAAM,SAAS,aAAa,MAAM,KAAK,eAAe,cAAc,WAAW,GAAG;AAClF,SAAO;GAAE,kBAAkB,OAAO,WAAW;GAAG;GAAQ;GAAQ,eAAe,CAAC,CAAC,OAAO;GAAU;;CAIpG,MAAc,eAAe,cAA4B,YAAiB;EACxE,MAAM,MAAM,KAAK,KAAK;EACtB,MAAM,aAAa,YAAY,aAAa,KAAK,MAAM,WAAW,WAAW,GAAG;EAChF,MAAM,UAAU,cAAc,QAAQ,MAAM;EAC5C,MAAM,UAAU,MAAM,KAAK,YAAY,UAAU,cAAc,WAAW;AAC1E,SAAO,UAAU,YAAY,UAAU,YAAY;;;;CAvBtD,YAAY;oBAGR,OAAO,eAAe;oBACtB,OAAO,kBAAkB;oBACzB,OAAO,aAAa"}