Try to see if we can avoid timestamp issue

This commit is contained in:
Fang-Pen Lin
2025-11-25 08:54:34 -08:00
parent f7f8fd2595
commit 13022adc5e
@@ -35,10 +35,10 @@ export const getDNSMadeEasyUrl = (path: string) => {
export const makeDNSMadeEasyAuthHeaders = ( export const makeDNSMadeEasyAuthHeaders = (
apiKey: string, apiKey: string,
secretKey: string, secretKey: string,
currentDate: Date = new Date() currentDate?: Date
): Record<string, string> => { ): Record<string, string> => {
// Format date as "Day, DD Mon YYYY HH:MM:SS GMT" (e.g., "Mon, 01 Jan 2024 12:00:00 GMT") // Format date as "Day, DD Mon YYYY HH:MM:SS GMT" (e.g., "Mon, 01 Jan 2024 12:00:00 GMT")
const requestDate = currentDate.toUTCString(); const requestDate = (currentDate ?? new Date()).toUTCString();
// Generate HMAC-SHA1 signature // Generate HMAC-SHA1 signature
const hmac = crypto.nativeCrypto.createHmac("sha1", secretKey); const hmac = crypto.nativeCrypto.createHmac("sha1", secretKey);