@gvnrdao/dh-lit-actions 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
487c310167d785851cb9174b523c2463359e04cfa8e24d2a6afe12a7a7925b6b
|
|
@@ -1806,10 +1806,13 @@ var _LIT_ACTION_ = (() => {
|
|
|
1806
1806
|
throw new Error("auth.signature is required");
|
|
1807
1807
|
}
|
|
1808
1808
|
const currentTime = Date.now();
|
|
1809
|
-
const
|
|
1809
|
+
const timestampThreshold = 1e10;
|
|
1810
|
+
const isTimestampInSeconds = auth.timestamp < timestampThreshold;
|
|
1811
|
+
const timestampMs = isTimestampInSeconds ? auth.timestamp * 1e3 : auth.timestamp;
|
|
1812
|
+
const timestampAge = currentTime - timestampMs;
|
|
1810
1813
|
if (timestampAge < 0) {
|
|
1811
1814
|
throw new Error(
|
|
1812
|
-
`auth.timestamp is in the future: ${auth.timestamp} vs current ${currentTime}. This may indicate clock synchronization issues.`
|
|
1815
|
+
`auth.timestamp is in the future: ${auth.timestamp} ${isTimestampInSeconds ? "(seconds)" : "(milliseconds)"} vs current ${currentTime}ms. This may indicate clock synchronization issues.`
|
|
1813
1816
|
);
|
|
1814
1817
|
}
|
|
1815
1818
|
if (timestampAge > MAX_TIMESTAMP_AGE_MS) {
|
|
@@ -1817,7 +1820,7 @@ var _LIT_ACTION_ = (() => {
|
|
|
1817
1820
|
`auth.timestamp is too old: ${Math.round(timestampAge / 1e3)}s ago (max ${Math.round(MAX_TIMESTAMP_AGE_MS / 1e3)}s). Please refresh your authorization and try again.`
|
|
1818
1821
|
);
|
|
1819
1822
|
}
|
|
1820
|
-
console.log(` \u2705 Timestamp validation passed (${Math.round(timestampAge / 1e3)}s old)`);
|
|
1823
|
+
console.log(` \u2705 Timestamp validation passed (${Math.round(timestampAge / 1e3)}s old, format: ${isTimestampInSeconds ? "seconds" : "milliseconds"})`);
|
|
1821
1824
|
if (globalThis.amount === void 0 || globalThis.amount === null) {
|
|
1822
1825
|
throw new Error('Missing required parameter: "amount"');
|
|
1823
1826
|
}
|