diff --git a/packages/issuer/lib/VcIssuer.ts b/packages/issuer/lib/VcIssuer.ts index 04e439de..af66ac26 100644 --- a/packages/issuer/lib/VcIssuer.ts +++ b/packages/issuer/lib/VcIssuer.ts @@ -519,7 +519,7 @@ export class VcIssuer { } if (!iat) { throw new Error(IAT_ERROR) - } else if (iat > createdAt + tokenExpiresIn) { + } else if (iat > createdAt + tokenExpiresIn * 1000) { throw new Error(IAT_ERROR) } // todo: Add a check of iat against current TS on server with a skew diff --git a/packages/issuer/lib/functions/CredentialOfferUtils.ts b/packages/issuer/lib/functions/CredentialOfferUtils.ts index 137e4277..647dd46b 100644 --- a/packages/issuer/lib/functions/CredentialOfferUtils.ts +++ b/packages/issuer/lib/functions/CredentialOfferUtils.ts @@ -115,9 +115,9 @@ export function createCredentialOfferURI( return createCredentialOfferURIFromObject(credentialOffer, opts) } -export const isPreAuthorizedCodeExpired = (state: CredentialOfferSession, expirationDuration: number) => { +export const isPreAuthorizedCodeExpired = (state: CredentialOfferSession, expirationDurationInSeconds: number) => { const now = +new Date() - const expirationTime = state.createdAt + expirationDuration + const expirationTime = state.createdAt + expirationDurationInSeconds * 1000 return now >= expirationTime }