Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error('must have a jti string property');
}
if (typeof payload.iat !== 'number' || !payload.iat) {
throw new Error('must have a iat number property');
}
if (payload.htm !== this.ctx.method) {
throw new Error('htm mismatch');
}
if (payload.htu !== `${this.urlFor(this.route)}`) {
throw new Error('htu mismatch');
}
try {
JWT.verify(token, key, { maxTokenAge: `${dPoPConfig.iatTolerance} seconds`, clockTolerance: `${clockTolerance} seconds` });
} catch (err) {
if (err instanceof errors.JWTClaimInvalid) {
throw new Error(`failed claim check (${err.message})`);
}
throw err;
}
const result = { jwk: key, jti: payload.jti, iat: payload.iat };
instance(this).dpop = result;
return result;
} catch (err) {
throw new InvalidRequest(`invalid DPoP Proof JWT (${err.message})`);
}
}