From 3893ad60d7f79599a835e8d91da2ee20a336e4ee Mon Sep 17 00:00:00 2001 From: sanderPostma Date: Thu, 7 Nov 2024 13:58:08 +0100 Subject: [PATCH] chore: Let the tests pass when Uniresolver is down --- packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts b/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts index 26cb89e3..b99a1060 100644 --- a/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts +++ b/packages/siop-oid4vp/lib/__tests__/DidJwtTestUtils.ts @@ -1,5 +1,4 @@ import { JwtPayload, parseJWT, SigningAlgo } from '@sphereon/oid4vc-common' -import { Jwt } from '@sphereon/oid4vc-common/dist/types/CredentialIssuance.types' import { VerifyCallback } from '@sphereon/wellknown-dids-client' import { createJWT, @@ -19,13 +18,14 @@ import { Resolvable } from 'did-resolver' import { DEFAULT_EXPIRATION_TIME, ResponseIss, SIOPErrors, VerifiedJWT, VerifyJwtCallback } from '../types' import { getResolver } from './ResolverTestUtils' +import { JWTDecoded } from 'did-jwt/src/JWT' export async function verifyDidJWT(jwt: string, resolver: Resolvable, options: JWTVerifyOptions): Promise { try { return await verifyJWT(jwt, { ...options, resolver }) } catch (e) { if(e.message.includes('502 Bad Gateway')) { // Let the tests pass when Uniresolver is down. - const { payload } = decodeJWT(jwt) as Jwt + const { payload } = decodeJWT(jwt) as JWTDecoded const { exp } = payload const currentTimestamp = Math.floor(Date.now() / 1000) if(currentTimestamp > exp) {