@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.
- package/dist/auth/web3-signed-builder.cjs.map +1 -1
- package/dist/auth/web3-signed-builder.d.ts +12 -6
- package/dist/auth/web3-signed-builder.js.map +1 -1
- package/dist/auth/web3-signed.cjs +11 -0
- package/dist/auth/web3-signed.cjs.map +1 -1
- package/dist/auth/web3-signed.d.ts +7 -0
- package/dist/auth/web3-signed.js +10 -0
- package/dist/auth/web3-signed.js.map +1 -1
- package/dist/index.browser.js +9 -0
- package/dist/index.browser.js.map +2 -2
- package/dist/index.node.cjs +9 -0
- package/dist/index.node.cjs.map +2 -2
- package/dist/index.node.js +9 -0
- package/dist/index.node.js.map +2 -2
- package/dist/protocol/jobs-client.js +1 -1
- package/package.json +1 -1
package/dist/index.node.js
CHANGED
|
@@ -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
|
|