Group Credentials: Request six days of data to account for clock skew

This commit is contained in:
Scott Nonnenberg 2022-08-15 09:34:27 -07:00 committed by GitHub
parent 1d0b1d806a
commit 7399086939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,23 +198,23 @@ export function getDatesForRequest(
data?: CredentialsDataType data?: CredentialsDataType
): RequestDatesType | undefined { ): RequestDatesType | undefined {
const today = toDayMillis(Date.now()); const today = toDayMillis(Date.now());
const oneWeekOut = today + durations.WEEK; const sixDaysOut = today + 6 * durations.DAY;
const lastCredential = last(data); const lastCredential = last(data);
if (!lastCredential || lastCredential.redemptionTime < today) { if (!lastCredential || lastCredential.redemptionTime < today) {
return { return {
startDayInMs: today, startDayInMs: today,
endDayInMs: oneWeekOut, endDayInMs: sixDaysOut,
}; };
} }
if (lastCredential.redemptionTime >= oneWeekOut) { if (lastCredential.redemptionTime >= sixDaysOut) {
return undefined; return undefined;
} }
return { return {
startDayInMs: lastCredential.redemptionTime + durations.DAY, startDayInMs: lastCredential.redemptionTime + durations.DAY,
endDayInMs: oneWeekOut, endDayInMs: sixDaysOut,
}; };
} }