From 2ed36aa60402063b89f5f2ffe0d0deb583196159 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Fri, 12 Sep 2025 05:35:36 +0700 Subject: [PATCH] Use invariant culture for AWS date formatting Updated date formatting and parsing in AWS authentication to explicitly use System.Globalization.CultureInfo.InvariantCulture and DateTimeStyles.AssumeUniversal. This ensures consistent behavior regardless of system locale. Closes BLD-298 --- .../InAppWallet/EmbeddedWallet.Authentication/AWS.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs index 5662f71b..d66a26e3 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs @@ -132,8 +132,8 @@ private static async Task PostAwsRequestWithDateOverride( var dateTimeNow = dateOverride ?? DateTime.UtcNow; var amzDateFormat = "yyyyMMddTHHmmssZ"; - var amzDate = dateTimeNow.ToString(amzDateFormat); - var dateStamp = dateTimeNow.ToString("yyyyMMdd"); + var amzDate = dateTimeNow.ToString(amzDateFormat, System.Globalization.CultureInfo.InvariantCulture); + var dateStamp = dateTimeNow.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); var canonicalHeaders = $"host:{new Uri(endpoint).Host}\n" + $"x-amz-date:{amzDate}\n"; var signedHeaders = "host;x-amz-date"; @@ -181,7 +181,7 @@ private static async Task PostAwsRequestWithDateOverride( if (idx > -1) { var parsedTimeString = responseContent.Substring(idx + 1, amzDate.Length); - var serverTime = DateTime.ParseExact(parsedTimeString, amzDateFormat, System.Globalization.CultureInfo.InvariantCulture).ToUniversalTime(); + var serverTime = DateTime.ParseExact(parsedTimeString, amzDateFormat, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AssumeUniversal); return await PostAwsRequestWithDateOverride( credentials,