@opendatalabs/vana-sdk 4.3.0 → 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.
@@ -31810,6 +31810,7 @@ var import_viem13 = require("viem");
31810
31810
  var import_errors = require("./auth/errors.cjs");
31811
31811
  var WEB3_SIGNED_PREFIX = "Web3Signed ";
31812
31812
  var CLOCK_SKEW_SECONDS = 60;
31813
+ var MAX_WEB3SIGNED_LIFETIME_SECONDS = 15 * 60;
31813
31814
  function base64urlDecode(input) {
31814
31815
  let base64 = input.replace(/-/g, "+").replace(/_/g, "/");
31815
31816
  const padLength = (4 - base64.length % 4) % 4;
@@ -31922,6 +31923,14 @@ async function verifyWeb3Signed(params) {
31922
31923
  if (payload.iat > now + CLOCK_SKEW_SECONDS) {
31923
31924
  throw new import_errors.ExpiredTokenError({ reason: "Token issued in the future" });
31924
31925
  }
31926
+ const lifetime = payload.exp - payload.iat;
31927
+ if (lifetime <= 0 || lifetime > MAX_WEB3SIGNED_LIFETIME_SECONDS) {
31928
+ throw new import_errors.ExpiredTokenError({
31929
+ reason: "Token lifetime exceeds the maximum",
31930
+ maxLifetimeSeconds: MAX_WEB3SIGNED_LIFETIME_SECONDS,
31931
+ lifetimeSeconds: lifetime
31932
+ });
31933
+ }
31925
31934
  return { signer, payload };
31926
31935
  }
31927
31936