Log signing errors
This commit is contained in:
parent
0e0da6d722
commit
0be56adcf4
@ -102,10 +102,14 @@ export const hasValidSignature = (path: string, query: ParsedQs, req: Request) =
|
|||||||
const { ex, is, hm } = query;
|
const { ex, is, hm } = query;
|
||||||
|
|
||||||
// if the required query parameters are not present, return false
|
// if the required query parameters are not present, return false
|
||||||
if (!ex || !is || !hm) return false;
|
if (!ex || !is || !hm) {
|
||||||
|
console.debug("Missing required query parameters for signature validation");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// check if the signature is expired
|
// check if the signature is expired
|
||||||
if (isExpired(ex as string, is as string)) {
|
if (isExpired(ex as string, is as string)) {
|
||||||
|
console.debug("Signature is expired");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +121,10 @@ export const hasValidSignature = (path: string, query: ParsedQs, req: Request) =
|
|||||||
calculated.length === received.length &&
|
calculated.length === received.length &&
|
||||||
timingSafeEqual(calculated, received);
|
timingSafeEqual(calculated, received);
|
||||||
|
|
||||||
|
console.debug(
|
||||||
|
`Signature validation for ${path} - isHashValid: ${isHashValid}, calculated: ${calcd}, received: ${hm}`,
|
||||||
|
);
|
||||||
|
|
||||||
return isHashValid;
|
return isHashValid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user