@opendatalabs/vana-sdk 4.3.1 → 4.3.2

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.
@@ -31529,6 +31529,7 @@ import {
31529
31529
  } from "./auth/errors.js";
31530
31530
  var WEB3_SIGNED_PREFIX = "Web3Signed ";
31531
31531
  var CLOCK_SKEW_SECONDS = 60;
31532
+ var MAX_WEB3SIGNED_LIFETIME_SECONDS = 15 * 60;
31532
31533
  function base64urlDecode(input) {
31533
31534
  let base64 = input.replace(/-/g, "+").replace(/_/g, "/");
31534
31535
  const padLength = (4 - base64.length % 4) % 4;
@@ -31641,6 +31642,14 @@ async function verifyWeb3Signed(params) {
31641
31642
  if (payload.iat > now + CLOCK_SKEW_SECONDS) {
31642
31643
  throw new ExpiredTokenError({ reason: "Token issued in the future" });
31643
31644
  }
31645
+ const lifetime = payload.exp - payload.iat;
31646
+ if (lifetime <= 0 || lifetime > MAX_WEB3SIGNED_LIFETIME_SECONDS) {
31647
+ throw new ExpiredTokenError({
31648
+ reason: "Token lifetime exceeds the maximum",
31649
+ maxLifetimeSeconds: MAX_WEB3SIGNED_LIFETIME_SECONDS,
31650
+ lifetimeSeconds: lifetime
31651
+ });
31652
+ }
31644
31653
  return { signer, payload };
31645
31654
  }
31646
31655