@opendatalabs/vana-sdk 3.8.3 → 3.10.0
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/README.md +31 -10
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.js +8 -0
- package/dist/index.browser.js.map +2 -2
- package/dist/index.node.cjs +8 -0
- package/dist/index.node.cjs.map +2 -2
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.js +8 -0
- package/dist/index.node.js.map +2 -2
- package/dist/protocol/gateway.cjs +8 -0
- package/dist/protocol/gateway.cjs.map +1 -1
- package/dist/protocol/gateway.d.ts +24 -0
- package/dist/protocol/gateway.js +8 -0
- package/dist/protocol/gateway.js.map +1 -1
- package/dist/session-relay/client.cjs +215 -0
- package/dist/session-relay/client.cjs.map +1 -0
- package/dist/session-relay/client.d.ts +16 -0
- package/dist/session-relay/client.js +190 -0
- package/dist/session-relay/client.js.map +1 -0
- package/dist/session-relay/client.test.d.ts +1 -0
- package/dist/session-relay/endpoints.cjs +37 -0
- package/dist/session-relay/endpoints.cjs.map +1 -0
- package/dist/session-relay/endpoints.d.ts +7 -0
- package/dist/session-relay/endpoints.js +11 -0
- package/dist/session-relay/endpoints.js.map +1 -0
- package/dist/session-relay/errors.cjs +36 -0
- package/dist/session-relay/errors.cjs.map +1 -0
- package/dist/session-relay/errors.d.ts +13 -0
- package/dist/session-relay/errors.js +12 -0
- package/dist/session-relay/errors.js.map +1 -0
- package/dist/session-relay/index.cjs +46 -0
- package/dist/session-relay/index.cjs.map +1 -0
- package/dist/session-relay/index.d.ts +5 -0
- package/dist/session-relay/index.js +25 -0
- package/dist/session-relay/index.js.map +1 -0
- package/dist/session-relay/signing.cjs +62 -0
- package/dist/session-relay/signing.cjs.map +1 -0
- package/dist/session-relay/signing.d.ts +21 -0
- package/dist/session-relay/signing.js +39 -0
- package/dist/session-relay/signing.js.map +1 -0
- package/dist/session-relay/signing.test.d.ts +1 -0
- package/dist/session-relay/types.cjs +17 -0
- package/dist/session-relay/types.cjs.map +1 -0
- package/dist/session-relay/types.d.ts +119 -0
- package/dist/session-relay/types.js +1 -0
- package/dist/session-relay/types.js.map +1 -0
- package/dist/session-relay.cjs +46 -0
- package/dist/session-relay.cjs.map +1 -0
- package/dist/session-relay.d.ts +27 -0
- package/dist/session-relay.js +27 -0
- package/dist/session-relay.js.map +1 -0
- package/package.json +10 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var session_relay_exports = {};
|
|
20
|
+
__export(session_relay_exports, {
|
|
21
|
+
SESSION_RELAY_DEV_URL: () => import_endpoints.SESSION_RELAY_DEV_URL,
|
|
22
|
+
SESSION_RELAY_PRODUCTION_URL: () => import_endpoints.SESSION_RELAY_PRODUCTION_URL,
|
|
23
|
+
SessionRelayError: () => import_errors.SessionRelayError,
|
|
24
|
+
buildSessionRelayWeb3SignedHeader: () => import_signing.buildSessionRelayWeb3SignedHeader,
|
|
25
|
+
computeSessionRelayBodyHash: () => import_signing.computeSessionRelayBodyHash,
|
|
26
|
+
createSessionRelayBuilderClient: () => import_client.createSessionRelayBuilderClient,
|
|
27
|
+
createSessionRelayClient: () => import_client.createSessionRelayClient,
|
|
28
|
+
getSessionRelayUrl: () => import_endpoints.getSessionRelayUrl
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(session_relay_exports);
|
|
31
|
+
var import_endpoints = require("./endpoints");
|
|
32
|
+
var import_errors = require("./errors");
|
|
33
|
+
var import_signing = require("./signing");
|
|
34
|
+
var import_client = require("./client");
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
SESSION_RELAY_DEV_URL,
|
|
38
|
+
SESSION_RELAY_PRODUCTION_URL,
|
|
39
|
+
SessionRelayError,
|
|
40
|
+
buildSessionRelayWeb3SignedHeader,
|
|
41
|
+
computeSessionRelayBodyHash,
|
|
42
|
+
createSessionRelayBuilderClient,
|
|
43
|
+
createSessionRelayClient,
|
|
44
|
+
getSessionRelayUrl
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/session-relay/index.ts"],"sourcesContent":["export {\n SESSION_RELAY_DEV_URL,\n SESSION_RELAY_PRODUCTION_URL,\n getSessionRelayUrl,\n} from \"./endpoints\";\nexport { SessionRelayError, type SessionRelayErrorDetails } from \"./errors\";\nexport {\n computeSessionRelayBodyHash,\n buildSessionRelayWeb3SignedHeader,\n} from \"./signing\";\nexport {\n createSessionRelayClient,\n createSessionRelayBuilderClient,\n} from \"./client\";\nexport type {\n SessionRelayEnvironment,\n SessionRelayFetch,\n SessionRelayClientOptions,\n SessionRelayBuilderClientOptions,\n SessionRelayInitParams,\n SessionRelayInitResult,\n SessionRelayGrantPayload,\n SessionRelayPollResult,\n SessionRelayClaimRequest,\n SessionRelayClaimResponse,\n SessionRelayApproveRequest,\n SessionRelayDenyRequest,\n SessionRelayClient,\n SessionRelayBuilderClient,\n} from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAIO;AACP,oBAAiE;AACjE,qBAGO;AACP,oBAGO;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SESSION_RELAY_DEV_URL, SESSION_RELAY_PRODUCTION_URL, getSessionRelayUrl, } from "./endpoints";
|
|
2
|
+
export { SessionRelayError, type SessionRelayErrorDetails } from "./errors";
|
|
3
|
+
export { computeSessionRelayBodyHash, buildSessionRelayWeb3SignedHeader, } from "./signing";
|
|
4
|
+
export { createSessionRelayClient, createSessionRelayBuilderClient, } from "./client";
|
|
5
|
+
export type { SessionRelayEnvironment, SessionRelayFetch, SessionRelayClientOptions, SessionRelayBuilderClientOptions, SessionRelayInitParams, SessionRelayInitResult, SessionRelayGrantPayload, SessionRelayPollResult, SessionRelayClaimRequest, SessionRelayClaimResponse, SessionRelayApproveRequest, SessionRelayDenyRequest, SessionRelayClient, SessionRelayBuilderClient, } from "./types";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SESSION_RELAY_DEV_URL,
|
|
3
|
+
SESSION_RELAY_PRODUCTION_URL,
|
|
4
|
+
getSessionRelayUrl
|
|
5
|
+
} from "./endpoints.js";
|
|
6
|
+
import { SessionRelayError } from "./errors.js";
|
|
7
|
+
import {
|
|
8
|
+
computeSessionRelayBodyHash,
|
|
9
|
+
buildSessionRelayWeb3SignedHeader
|
|
10
|
+
} from "./signing.js";
|
|
11
|
+
import {
|
|
12
|
+
createSessionRelayClient,
|
|
13
|
+
createSessionRelayBuilderClient
|
|
14
|
+
} from "./client.js";
|
|
15
|
+
export {
|
|
16
|
+
SESSION_RELAY_DEV_URL,
|
|
17
|
+
SESSION_RELAY_PRODUCTION_URL,
|
|
18
|
+
SessionRelayError,
|
|
19
|
+
buildSessionRelayWeb3SignedHeader,
|
|
20
|
+
computeSessionRelayBodyHash,
|
|
21
|
+
createSessionRelayBuilderClient,
|
|
22
|
+
createSessionRelayClient,
|
|
23
|
+
getSessionRelayUrl
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/session-relay/index.ts"],"sourcesContent":["export {\n SESSION_RELAY_DEV_URL,\n SESSION_RELAY_PRODUCTION_URL,\n getSessionRelayUrl,\n} from \"./endpoints\";\nexport { SessionRelayError, type SessionRelayErrorDetails } from \"./errors\";\nexport {\n computeSessionRelayBodyHash,\n buildSessionRelayWeb3SignedHeader,\n} from \"./signing\";\nexport {\n createSessionRelayClient,\n createSessionRelayBuilderClient,\n} from \"./client\";\nexport type {\n SessionRelayEnvironment,\n SessionRelayFetch,\n SessionRelayClientOptions,\n SessionRelayBuilderClientOptions,\n SessionRelayInitParams,\n SessionRelayInitResult,\n SessionRelayGrantPayload,\n SessionRelayPollResult,\n SessionRelayClaimRequest,\n SessionRelayClaimResponse,\n SessionRelayApproveRequest,\n SessionRelayDenyRequest,\n SessionRelayClient,\n SessionRelayBuilderClient,\n} from \"./types\";\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAwD;AACjE;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;","names":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var signing_exports = {};
|
|
20
|
+
__export(signing_exports, {
|
|
21
|
+
buildSessionRelayWeb3SignedHeader: () => buildSessionRelayWeb3SignedHeader,
|
|
22
|
+
computeSessionRelayBodyHash: () => computeSessionRelayBodyHash
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(signing_exports);
|
|
25
|
+
var import_sha2 = require("@noble/hashes/sha2");
|
|
26
|
+
var import_viem = require("viem");
|
|
27
|
+
var import_web3_signed_builder = require("../auth/web3-signed-builder");
|
|
28
|
+
const textEncoder = new TextEncoder();
|
|
29
|
+
function canonicalizeJson(value) {
|
|
30
|
+
if (value === null || typeof value !== "object") return value;
|
|
31
|
+
if (Array.isArray(value)) return value.map(canonicalizeJson);
|
|
32
|
+
const sorted = {};
|
|
33
|
+
for (const key of Object.keys(value).sort()) {
|
|
34
|
+
if (key === "signature") continue;
|
|
35
|
+
sorted[key] = canonicalizeJson(value[key]);
|
|
36
|
+
}
|
|
37
|
+
return sorted;
|
|
38
|
+
}
|
|
39
|
+
function computeSessionRelayBodyHash(body) {
|
|
40
|
+
if (!body || body.length === 0) return "";
|
|
41
|
+
const parsed = JSON.parse(body);
|
|
42
|
+
const canonical = canonicalizeJson(parsed);
|
|
43
|
+
const digest = (0, import_sha2.sha256)(textEncoder.encode(JSON.stringify(canonical)));
|
|
44
|
+
return (0, import_viem.bytesToHex)(digest).slice(2);
|
|
45
|
+
}
|
|
46
|
+
function buildSessionRelayWeb3SignedHeader(params) {
|
|
47
|
+
return (0, import_web3_signed_builder.buildWeb3SignedHeader)({
|
|
48
|
+
signMessage: params.signMessage,
|
|
49
|
+
aud: params.aud,
|
|
50
|
+
method: params.method,
|
|
51
|
+
uri: params.uri,
|
|
52
|
+
bodyHash: computeSessionRelayBodyHash(params.body),
|
|
53
|
+
iat: params.iat,
|
|
54
|
+
exp: params.exp
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
buildSessionRelayWeb3SignedHeader,
|
|
60
|
+
computeSessionRelayBodyHash
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=signing.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/session-relay/signing.ts"],"sourcesContent":["import { sha256 } from \"@noble/hashes/sha2\";\nimport { bytesToHex } from \"viem\";\nimport {\n buildWeb3SignedHeader,\n type Web3SignedSignFn,\n} from \"../auth/web3-signed-builder\";\n\nconst textEncoder = new TextEncoder();\n\nfunction canonicalizeJson(value: unknown): unknown {\n if (value === null || typeof value !== \"object\") return value;\n if (Array.isArray(value)) return value.map(canonicalizeJson);\n\n const sorted: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n if (key === \"signature\") continue;\n sorted[key] = canonicalizeJson((value as Record<string, unknown>)[key]);\n }\n return sorted;\n}\n\n/**\n * Compute the legacy bodyHash shape currently accepted by Session Relay.\n *\n * @remarks\n * Personal Server Web3Signed requests use `sha256:<hex>`, including a canonical\n * empty-body hash. Session Relay's current signed init endpoint verifies a\n * legacy body hash: bare SHA-256 hex for non-empty JSON bodies and `\"\"` for\n * empty bodies. Keep this compatibility local to the Relay integration.\n */\nexport function computeSessionRelayBodyHash(body: string | undefined): string {\n if (!body || body.length === 0) return \"\";\n\n const parsed = JSON.parse(body);\n const canonical = canonicalizeJson(parsed);\n const digest = sha256(textEncoder.encode(JSON.stringify(canonical)));\n return bytesToHex(digest).slice(2);\n}\n\n/** Build a Web3Signed header compatible with Session Relay's signed endpoints. */\nexport function buildSessionRelayWeb3SignedHeader(params: {\n signMessage: Web3SignedSignFn;\n aud: string;\n method: string;\n uri: string;\n body?: string;\n iat?: number;\n exp?: number;\n}): Promise<string> {\n return buildWeb3SignedHeader({\n signMessage: params.signMessage,\n aud: params.aud,\n method: params.method,\n uri: params.uri,\n bodyHash: computeSessionRelayBodyHash(params.body),\n iat: params.iat,\n exp: params.exp,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB,kBAA2B;AAC3B,iCAGO;AAEP,MAAM,cAAc,IAAI,YAAY;AAEpC,SAAS,iBAAiB,OAAyB;AACjD,MAAI,UAAU,QAAQ,OAAO,UAAU,SAAU,QAAO;AACxD,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,gBAAgB;AAE3D,QAAM,SAAkC,CAAC;AACzC,aAAW,OAAO,OAAO,KAAK,KAAgC,EAAE,KAAK,GAAG;AACtE,QAAI,QAAQ,YAAa;AACzB,WAAO,GAAG,IAAI,iBAAkB,MAAkC,GAAG,CAAC;AAAA,EACxE;AACA,SAAO;AACT;AAWO,SAAS,4BAA4B,MAAkC;AAC5E,MAAI,CAAC,QAAQ,KAAK,WAAW,EAAG,QAAO;AAEvC,QAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,QAAM,YAAY,iBAAiB,MAAM;AACzC,QAAM,aAAS,oBAAO,YAAY,OAAO,KAAK,UAAU,SAAS,CAAC,CAAC;AACnE,aAAO,wBAAW,MAAM,EAAE,MAAM,CAAC;AACnC;AAGO,SAAS,kCAAkC,QAQ9B;AAClB,aAAO,kDAAsB;AAAA,IAC3B,aAAa,OAAO;AAAA,IACpB,KAAK,OAAO;AAAA,IACZ,QAAQ,OAAO;AAAA,IACf,KAAK,OAAO;AAAA,IACZ,UAAU,4BAA4B,OAAO,IAAI;AAAA,IACjD,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO;AAAA,EACd,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Web3SignedSignFn } from "../auth/web3-signed-builder";
|
|
2
|
+
/**
|
|
3
|
+
* Compute the legacy bodyHash shape currently accepted by Session Relay.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Personal Server Web3Signed requests use `sha256:<hex>`, including a canonical
|
|
7
|
+
* empty-body hash. Session Relay's current signed init endpoint verifies a
|
|
8
|
+
* legacy body hash: bare SHA-256 hex for non-empty JSON bodies and `""` for
|
|
9
|
+
* empty bodies. Keep this compatibility local to the Relay integration.
|
|
10
|
+
*/
|
|
11
|
+
export declare function computeSessionRelayBodyHash(body: string | undefined): string;
|
|
12
|
+
/** Build a Web3Signed header compatible with Session Relay's signed endpoints. */
|
|
13
|
+
export declare function buildSessionRelayWeb3SignedHeader(params: {
|
|
14
|
+
signMessage: Web3SignedSignFn;
|
|
15
|
+
aud: string;
|
|
16
|
+
method: string;
|
|
17
|
+
uri: string;
|
|
18
|
+
body?: string;
|
|
19
|
+
iat?: number;
|
|
20
|
+
exp?: number;
|
|
21
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { sha256 } from "@noble/hashes/sha2";
|
|
2
|
+
import { bytesToHex } from "viem";
|
|
3
|
+
import {
|
|
4
|
+
buildWeb3SignedHeader
|
|
5
|
+
} from "../auth/web3-signed-builder.js";
|
|
6
|
+
const textEncoder = new TextEncoder();
|
|
7
|
+
function canonicalizeJson(value) {
|
|
8
|
+
if (value === null || typeof value !== "object") return value;
|
|
9
|
+
if (Array.isArray(value)) return value.map(canonicalizeJson);
|
|
10
|
+
const sorted = {};
|
|
11
|
+
for (const key of Object.keys(value).sort()) {
|
|
12
|
+
if (key === "signature") continue;
|
|
13
|
+
sorted[key] = canonicalizeJson(value[key]);
|
|
14
|
+
}
|
|
15
|
+
return sorted;
|
|
16
|
+
}
|
|
17
|
+
function computeSessionRelayBodyHash(body) {
|
|
18
|
+
if (!body || body.length === 0) return "";
|
|
19
|
+
const parsed = JSON.parse(body);
|
|
20
|
+
const canonical = canonicalizeJson(parsed);
|
|
21
|
+
const digest = sha256(textEncoder.encode(JSON.stringify(canonical)));
|
|
22
|
+
return bytesToHex(digest).slice(2);
|
|
23
|
+
}
|
|
24
|
+
function buildSessionRelayWeb3SignedHeader(params) {
|
|
25
|
+
return buildWeb3SignedHeader({
|
|
26
|
+
signMessage: params.signMessage,
|
|
27
|
+
aud: params.aud,
|
|
28
|
+
method: params.method,
|
|
29
|
+
uri: params.uri,
|
|
30
|
+
bodyHash: computeSessionRelayBodyHash(params.body),
|
|
31
|
+
iat: params.iat,
|
|
32
|
+
exp: params.exp
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
buildSessionRelayWeb3SignedHeader,
|
|
37
|
+
computeSessionRelayBodyHash
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=signing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/session-relay/signing.ts"],"sourcesContent":["import { sha256 } from \"@noble/hashes/sha2\";\nimport { bytesToHex } from \"viem\";\nimport {\n buildWeb3SignedHeader,\n type Web3SignedSignFn,\n} from \"../auth/web3-signed-builder\";\n\nconst textEncoder = new TextEncoder();\n\nfunction canonicalizeJson(value: unknown): unknown {\n if (value === null || typeof value !== \"object\") return value;\n if (Array.isArray(value)) return value.map(canonicalizeJson);\n\n const sorted: Record<string, unknown> = {};\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n if (key === \"signature\") continue;\n sorted[key] = canonicalizeJson((value as Record<string, unknown>)[key]);\n }\n return sorted;\n}\n\n/**\n * Compute the legacy bodyHash shape currently accepted by Session Relay.\n *\n * @remarks\n * Personal Server Web3Signed requests use `sha256:<hex>`, including a canonical\n * empty-body hash. Session Relay's current signed init endpoint verifies a\n * legacy body hash: bare SHA-256 hex for non-empty JSON bodies and `\"\"` for\n * empty bodies. Keep this compatibility local to the Relay integration.\n */\nexport function computeSessionRelayBodyHash(body: string | undefined): string {\n if (!body || body.length === 0) return \"\";\n\n const parsed = JSON.parse(body);\n const canonical = canonicalizeJson(parsed);\n const digest = sha256(textEncoder.encode(JSON.stringify(canonical)));\n return bytesToHex(digest).slice(2);\n}\n\n/** Build a Web3Signed header compatible with Session Relay's signed endpoints. */\nexport function buildSessionRelayWeb3SignedHeader(params: {\n signMessage: Web3SignedSignFn;\n aud: string;\n method: string;\n uri: string;\n body?: string;\n iat?: number;\n exp?: number;\n}): Promise<string> {\n return buildWeb3SignedHeader({\n signMessage: params.signMessage,\n aud: params.aud,\n method: params.method,\n uri: params.uri,\n bodyHash: computeSessionRelayBodyHash(params.body),\n iat: params.iat,\n exp: params.exp,\n });\n}\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,OAEK;AAEP,MAAM,cAAc,IAAI,YAAY;AAEpC,SAAS,iBAAiB,OAAyB;AACjD,MAAI,UAAU,QAAQ,OAAO,UAAU,SAAU,QAAO;AACxD,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,gBAAgB;AAE3D,QAAM,SAAkC,CAAC;AACzC,aAAW,OAAO,OAAO,KAAK,KAAgC,EAAE,KAAK,GAAG;AACtE,QAAI,QAAQ,YAAa;AACzB,WAAO,GAAG,IAAI,iBAAkB,MAAkC,GAAG,CAAC;AAAA,EACxE;AACA,SAAO;AACT;AAWO,SAAS,4BAA4B,MAAkC;AAC5E,MAAI,CAAC,QAAQ,KAAK,WAAW,EAAG,QAAO;AAEvC,QAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,QAAM,YAAY,iBAAiB,MAAM;AACzC,QAAM,SAAS,OAAO,YAAY,OAAO,KAAK,UAAU,SAAS,CAAC,CAAC;AACnE,SAAO,WAAW,MAAM,EAAE,MAAM,CAAC;AACnC;AAGO,SAAS,kCAAkC,QAQ9B;AAClB,SAAO,sBAAsB;AAAA,IAC3B,aAAa,OAAO;AAAA,IACpB,KAAK,OAAO;AAAA,IACZ,QAAQ,OAAO;AAAA,IACf,KAAK,OAAO;AAAA,IACZ,UAAU,4BAA4B,OAAO,IAAI;AAAA,IACjD,KAAK,OAAO;AAAA,IACZ,KAAK,OAAO;AAAA,EACd,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/session-relay/types.ts"],"sourcesContent":["import type { Web3SignedSignFn } from \"../auth/web3-signed-builder\";\n\n/** Deployment environment for Vana's Session Relay service. */\nexport type SessionRelayEnvironment = \"production\" | \"dev\";\n\n/** Minimal fetch signature accepted by the Session Relay clients. */\nexport type SessionRelayFetch = (\n input: string,\n init?: {\n method?: string;\n headers?: Record<string, string>;\n body?: string;\n },\n) => Promise<{\n ok: boolean;\n status: number;\n statusText?: string;\n json(): Promise<unknown>;\n text?(): Promise<string>;\n}>;\n\n/** Shared Session Relay client options. */\nexport interface SessionRelayClientOptions {\n /** Session Relay base URL. Defaults from `env` when omitted. */\n baseUrl?: string;\n /** Vana deployment environment. Defaults to `\"production\"`. */\n env?: SessionRelayEnvironment;\n /** Fetch implementation. Defaults to `globalThis.fetch`. */\n fetchFn?: SessionRelayFetch;\n}\n\n/** Builder-side Session Relay options. */\nexport interface SessionRelayBuilderClientOptions extends SessionRelayClientOptions {\n /** Builder/app address registered with the Vana builder registry. */\n granteeAddress: `0x${string}`;\n /** EIP-191 signer for Web3Signed Relay requests. */\n signMessage: Web3SignedSignFn;\n /** Clock source used for signed request freshness claims. */\n now?: () => number;\n}\n\n/** Parameters for creating a Session Relay session. */\nexport interface SessionRelayInitParams {\n /** Data scopes requested from the user. */\n scopes: string[];\n /** Public HTTPS callback URL for grant notifications. */\n webhookUrl?: string;\n /** App-owned user id for correlating the approved grant. */\n appUserId?: string;\n}\n\n/** Raw Session Relay init result. */\nexport interface SessionRelayInitResult {\n sessionId: string;\n deepLinkUrl: string;\n expiresAt: string;\n}\n\n/** Grant payload returned after a Relay session is approved. */\nexport interface SessionRelayGrantPayload {\n grantId: string;\n userAddress: string;\n builderAddress: string;\n scopes: string[];\n serverAddress?: string;\n appUserId?: string;\n}\n\n/** Session Relay poll result. */\nexport interface SessionRelayPollResult {\n /**\n * Current session status.\n *\n * @remarks\n * Current Session Relay deployments may report expired sessions as a\n * structured `SESSION_EXPIRED` error instead of a JSON body with\n * `status: \"expired\"`. The `\"expired\"` status is accepted for deployments\n * that return expiry as a terminal poll body.\n */\n status: \"pending\" | \"claimed\" | \"approved\" | \"denied\" | \"expired\";\n grant?: SessionRelayGrantPayload;\n reason?: string;\n}\n\n/** Desktop/app-side claim request. */\nexport interface SessionRelayClaimRequest {\n sessionId: string;\n secret: string;\n}\n\n/** Claimed session data returned to the app that completes user consent. */\nexport interface SessionRelayClaimResponse {\n sessionId: string;\n granteeAddress: string;\n scopes: string[];\n expiresAt: string;\n webhookUrl?: string;\n appUserId?: string;\n}\n\n/** Desktop/app-side approval request. */\nexport interface SessionRelayApproveRequest {\n secret: string;\n grantId: string;\n userAddress: string;\n serverAddress?: string;\n scopes: string[];\n}\n\n/** Desktop/app-side denial request. */\nexport interface SessionRelayDenyRequest {\n secret: string;\n reason?: string;\n}\n\n/** Session Relay methods that do not require builder signing. */\nexport interface SessionRelayClient {\n claimSession(\n request: SessionRelayClaimRequest,\n ): Promise<SessionRelayClaimResponse>;\n approveSession(\n sessionId: string,\n request: SessionRelayApproveRequest,\n ): Promise<void>;\n denySession(\n sessionId: string,\n request: SessionRelayDenyRequest,\n ): Promise<void>;\n pollSession(sessionId: string): Promise<SessionRelayPollResult>;\n pollUntilComplete(\n sessionId: string,\n opts?: { intervalMs?: number; timeoutMs?: number },\n ): Promise<SessionRelayPollResult>;\n}\n\n/** Builder-side Session Relay methods. */\nexport interface SessionRelayBuilderClient {\n initSession(params: SessionRelayInitParams): Promise<SessionRelayInitResult>;\n pollSession(sessionId: string): Promise<SessionRelayPollResult>;\n pollUntilComplete(\n sessionId: string,\n opts?: { intervalMs?: number; timeoutMs?: number },\n ): Promise<SessionRelayPollResult>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { Web3SignedSignFn } from "../auth/web3-signed-builder";
|
|
2
|
+
/** Deployment environment for Vana's Session Relay service. */
|
|
3
|
+
export type SessionRelayEnvironment = "production" | "dev";
|
|
4
|
+
/** Minimal fetch signature accepted by the Session Relay clients. */
|
|
5
|
+
export type SessionRelayFetch = (input: string, init?: {
|
|
6
|
+
method?: string;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
body?: string;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
ok: boolean;
|
|
11
|
+
status: number;
|
|
12
|
+
statusText?: string;
|
|
13
|
+
json(): Promise<unknown>;
|
|
14
|
+
text?(): Promise<string>;
|
|
15
|
+
}>;
|
|
16
|
+
/** Shared Session Relay client options. */
|
|
17
|
+
export interface SessionRelayClientOptions {
|
|
18
|
+
/** Session Relay base URL. Defaults from `env` when omitted. */
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
/** Vana deployment environment. Defaults to `"production"`. */
|
|
21
|
+
env?: SessionRelayEnvironment;
|
|
22
|
+
/** Fetch implementation. Defaults to `globalThis.fetch`. */
|
|
23
|
+
fetchFn?: SessionRelayFetch;
|
|
24
|
+
}
|
|
25
|
+
/** Builder-side Session Relay options. */
|
|
26
|
+
export interface SessionRelayBuilderClientOptions extends SessionRelayClientOptions {
|
|
27
|
+
/** Builder/app address registered with the Vana builder registry. */
|
|
28
|
+
granteeAddress: `0x${string}`;
|
|
29
|
+
/** EIP-191 signer for Web3Signed Relay requests. */
|
|
30
|
+
signMessage: Web3SignedSignFn;
|
|
31
|
+
/** Clock source used for signed request freshness claims. */
|
|
32
|
+
now?: () => number;
|
|
33
|
+
}
|
|
34
|
+
/** Parameters for creating a Session Relay session. */
|
|
35
|
+
export interface SessionRelayInitParams {
|
|
36
|
+
/** Data scopes requested from the user. */
|
|
37
|
+
scopes: string[];
|
|
38
|
+
/** Public HTTPS callback URL for grant notifications. */
|
|
39
|
+
webhookUrl?: string;
|
|
40
|
+
/** App-owned user id for correlating the approved grant. */
|
|
41
|
+
appUserId?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Raw Session Relay init result. */
|
|
44
|
+
export interface SessionRelayInitResult {
|
|
45
|
+
sessionId: string;
|
|
46
|
+
deepLinkUrl: string;
|
|
47
|
+
expiresAt: string;
|
|
48
|
+
}
|
|
49
|
+
/** Grant payload returned after a Relay session is approved. */
|
|
50
|
+
export interface SessionRelayGrantPayload {
|
|
51
|
+
grantId: string;
|
|
52
|
+
userAddress: string;
|
|
53
|
+
builderAddress: string;
|
|
54
|
+
scopes: string[];
|
|
55
|
+
serverAddress?: string;
|
|
56
|
+
appUserId?: string;
|
|
57
|
+
}
|
|
58
|
+
/** Session Relay poll result. */
|
|
59
|
+
export interface SessionRelayPollResult {
|
|
60
|
+
/**
|
|
61
|
+
* Current session status.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Current Session Relay deployments may report expired sessions as a
|
|
65
|
+
* structured `SESSION_EXPIRED` error instead of a JSON body with
|
|
66
|
+
* `status: "expired"`. The `"expired"` status is accepted for deployments
|
|
67
|
+
* that return expiry as a terminal poll body.
|
|
68
|
+
*/
|
|
69
|
+
status: "pending" | "claimed" | "approved" | "denied" | "expired";
|
|
70
|
+
grant?: SessionRelayGrantPayload;
|
|
71
|
+
reason?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Desktop/app-side claim request. */
|
|
74
|
+
export interface SessionRelayClaimRequest {
|
|
75
|
+
sessionId: string;
|
|
76
|
+
secret: string;
|
|
77
|
+
}
|
|
78
|
+
/** Claimed session data returned to the app that completes user consent. */
|
|
79
|
+
export interface SessionRelayClaimResponse {
|
|
80
|
+
sessionId: string;
|
|
81
|
+
granteeAddress: string;
|
|
82
|
+
scopes: string[];
|
|
83
|
+
expiresAt: string;
|
|
84
|
+
webhookUrl?: string;
|
|
85
|
+
appUserId?: string;
|
|
86
|
+
}
|
|
87
|
+
/** Desktop/app-side approval request. */
|
|
88
|
+
export interface SessionRelayApproveRequest {
|
|
89
|
+
secret: string;
|
|
90
|
+
grantId: string;
|
|
91
|
+
userAddress: string;
|
|
92
|
+
serverAddress?: string;
|
|
93
|
+
scopes: string[];
|
|
94
|
+
}
|
|
95
|
+
/** Desktop/app-side denial request. */
|
|
96
|
+
export interface SessionRelayDenyRequest {
|
|
97
|
+
secret: string;
|
|
98
|
+
reason?: string;
|
|
99
|
+
}
|
|
100
|
+
/** Session Relay methods that do not require builder signing. */
|
|
101
|
+
export interface SessionRelayClient {
|
|
102
|
+
claimSession(request: SessionRelayClaimRequest): Promise<SessionRelayClaimResponse>;
|
|
103
|
+
approveSession(sessionId: string, request: SessionRelayApproveRequest): Promise<void>;
|
|
104
|
+
denySession(sessionId: string, request: SessionRelayDenyRequest): Promise<void>;
|
|
105
|
+
pollSession(sessionId: string): Promise<SessionRelayPollResult>;
|
|
106
|
+
pollUntilComplete(sessionId: string, opts?: {
|
|
107
|
+
intervalMs?: number;
|
|
108
|
+
timeoutMs?: number;
|
|
109
|
+
}): Promise<SessionRelayPollResult>;
|
|
110
|
+
}
|
|
111
|
+
/** Builder-side Session Relay methods. */
|
|
112
|
+
export interface SessionRelayBuilderClient {
|
|
113
|
+
initSession(params: SessionRelayInitParams): Promise<SessionRelayInitResult>;
|
|
114
|
+
pollSession(sessionId: string): Promise<SessionRelayPollResult>;
|
|
115
|
+
pollUntilComplete(sessionId: string, opts?: {
|
|
116
|
+
intervalMs?: number;
|
|
117
|
+
timeoutMs?: number;
|
|
118
|
+
}): Promise<SessionRelayPollResult>;
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var session_relay_exports = {};
|
|
20
|
+
__export(session_relay_exports, {
|
|
21
|
+
SESSION_RELAY_DEV_URL: () => import_endpoints.SESSION_RELAY_DEV_URL,
|
|
22
|
+
SESSION_RELAY_PRODUCTION_URL: () => import_endpoints.SESSION_RELAY_PRODUCTION_URL,
|
|
23
|
+
SessionRelayError: () => import_errors.SessionRelayError,
|
|
24
|
+
buildSessionRelayWeb3SignedHeader: () => import_signing.buildSessionRelayWeb3SignedHeader,
|
|
25
|
+
computeSessionRelayBodyHash: () => import_signing.computeSessionRelayBodyHash,
|
|
26
|
+
createSessionRelayBuilderClient: () => import_client.createSessionRelayBuilderClient,
|
|
27
|
+
createSessionRelayClient: () => import_client.createSessionRelayClient,
|
|
28
|
+
getSessionRelayUrl: () => import_endpoints.getSessionRelayUrl
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(session_relay_exports);
|
|
31
|
+
var import_endpoints = require("./session-relay/endpoints");
|
|
32
|
+
var import_errors = require("./session-relay/errors");
|
|
33
|
+
var import_signing = require("./session-relay/signing");
|
|
34
|
+
var import_client = require("./session-relay/client");
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
SESSION_RELAY_DEV_URL,
|
|
38
|
+
SESSION_RELAY_PRODUCTION_URL,
|
|
39
|
+
SessionRelayError,
|
|
40
|
+
buildSessionRelayWeb3SignedHeader,
|
|
41
|
+
computeSessionRelayBodyHash,
|
|
42
|
+
createSessionRelayBuilderClient,
|
|
43
|
+
createSessionRelayClient,
|
|
44
|
+
getSessionRelayUrl
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=session-relay.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/session-relay.ts"],"sourcesContent":["/**\n * Session Relay service integration for Vana app flows.\n *\n * @remarks\n * Session Relay coordinates the handoff between a builder app and the Vana app\n * that completes user consent. This entry point is intentionally separate from\n * `protocol/*`: it is a Vana-operated service integration, like Account or\n * Storage integrations, not a canonical on-chain protocol primitive.\n *\n * @example\n * ```typescript\n * import { createSessionRelayBuilderClient } from \"@opendatalabs/vana-sdk/session-relay\";\n *\n * const relay = createSessionRelayBuilderClient({\n * granteeAddress: appAddress,\n * signMessage,\n * });\n * ```\n *\n * @category Integrations\n * @module session-relay\n */\n\nexport {\n SESSION_RELAY_DEV_URL,\n SESSION_RELAY_PRODUCTION_URL,\n getSessionRelayUrl,\n} from \"./session-relay/endpoints\";\nexport {\n SessionRelayError,\n type SessionRelayErrorDetails,\n} from \"./session-relay/errors\";\nexport {\n computeSessionRelayBodyHash,\n buildSessionRelayWeb3SignedHeader,\n} from \"./session-relay/signing\";\nexport {\n createSessionRelayClient,\n createSessionRelayBuilderClient,\n} from \"./session-relay/client\";\nexport type {\n SessionRelayEnvironment,\n SessionRelayFetch,\n SessionRelayClientOptions,\n SessionRelayBuilderClientOptions,\n SessionRelayInitParams,\n SessionRelayInitResult,\n SessionRelayGrantPayload,\n SessionRelayPollResult,\n SessionRelayClaimRequest,\n SessionRelayClaimResponse,\n SessionRelayApproveRequest,\n SessionRelayDenyRequest,\n SessionRelayClient,\n SessionRelayBuilderClient,\n} from \"./session-relay/types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBA,uBAIO;AACP,oBAGO;AACP,qBAGO;AACP,oBAGO;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Relay service integration for Vana app flows.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Session Relay coordinates the handoff between a builder app and the Vana app
|
|
6
|
+
* that completes user consent. This entry point is intentionally separate from
|
|
7
|
+
* `protocol/*`: it is a Vana-operated service integration, like Account or
|
|
8
|
+
* Storage integrations, not a canonical on-chain protocol primitive.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { createSessionRelayBuilderClient } from "@opendatalabs/vana-sdk/session-relay";
|
|
13
|
+
*
|
|
14
|
+
* const relay = createSessionRelayBuilderClient({
|
|
15
|
+
* granteeAddress: appAddress,
|
|
16
|
+
* signMessage,
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @category Integrations
|
|
21
|
+
* @module session-relay
|
|
22
|
+
*/
|
|
23
|
+
export { SESSION_RELAY_DEV_URL, SESSION_RELAY_PRODUCTION_URL, getSessionRelayUrl, } from "./session-relay/endpoints";
|
|
24
|
+
export { SessionRelayError, type SessionRelayErrorDetails, } from "./session-relay/errors";
|
|
25
|
+
export { computeSessionRelayBodyHash, buildSessionRelayWeb3SignedHeader, } from "./session-relay/signing";
|
|
26
|
+
export { createSessionRelayClient, createSessionRelayBuilderClient, } from "./session-relay/client";
|
|
27
|
+
export type { SessionRelayEnvironment, SessionRelayFetch, SessionRelayClientOptions, SessionRelayBuilderClientOptions, SessionRelayInitParams, SessionRelayInitResult, SessionRelayGrantPayload, SessionRelayPollResult, SessionRelayClaimRequest, SessionRelayClaimResponse, SessionRelayApproveRequest, SessionRelayDenyRequest, SessionRelayClient, SessionRelayBuilderClient, } from "./session-relay/types";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SESSION_RELAY_DEV_URL,
|
|
3
|
+
SESSION_RELAY_PRODUCTION_URL,
|
|
4
|
+
getSessionRelayUrl
|
|
5
|
+
} from "./session-relay/endpoints.js";
|
|
6
|
+
import {
|
|
7
|
+
SessionRelayError
|
|
8
|
+
} from "./session-relay/errors.js";
|
|
9
|
+
import {
|
|
10
|
+
computeSessionRelayBodyHash,
|
|
11
|
+
buildSessionRelayWeb3SignedHeader
|
|
12
|
+
} from "./session-relay/signing.js";
|
|
13
|
+
import {
|
|
14
|
+
createSessionRelayClient,
|
|
15
|
+
createSessionRelayBuilderClient
|
|
16
|
+
} from "./session-relay/client.js";
|
|
17
|
+
export {
|
|
18
|
+
SESSION_RELAY_DEV_URL,
|
|
19
|
+
SESSION_RELAY_PRODUCTION_URL,
|
|
20
|
+
SessionRelayError,
|
|
21
|
+
buildSessionRelayWeb3SignedHeader,
|
|
22
|
+
computeSessionRelayBodyHash,
|
|
23
|
+
createSessionRelayBuilderClient,
|
|
24
|
+
createSessionRelayClient,
|
|
25
|
+
getSessionRelayUrl
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=session-relay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/session-relay.ts"],"sourcesContent":["/**\n * Session Relay service integration for Vana app flows.\n *\n * @remarks\n * Session Relay coordinates the handoff between a builder app and the Vana app\n * that completes user consent. This entry point is intentionally separate from\n * `protocol/*`: it is a Vana-operated service integration, like Account or\n * Storage integrations, not a canonical on-chain protocol primitive.\n *\n * @example\n * ```typescript\n * import { createSessionRelayBuilderClient } from \"@opendatalabs/vana-sdk/session-relay\";\n *\n * const relay = createSessionRelayBuilderClient({\n * granteeAddress: appAddress,\n * signMessage,\n * });\n * ```\n *\n * @category Integrations\n * @module session-relay\n */\n\nexport {\n SESSION_RELAY_DEV_URL,\n SESSION_RELAY_PRODUCTION_URL,\n getSessionRelayUrl,\n} from \"./session-relay/endpoints\";\nexport {\n SessionRelayError,\n type SessionRelayErrorDetails,\n} from \"./session-relay/errors\";\nexport {\n computeSessionRelayBodyHash,\n buildSessionRelayWeb3SignedHeader,\n} from \"./session-relay/signing\";\nexport {\n createSessionRelayClient,\n createSessionRelayBuilderClient,\n} from \"./session-relay/client\";\nexport type {\n SessionRelayEnvironment,\n SessionRelayFetch,\n SessionRelayClientOptions,\n SessionRelayBuilderClientOptions,\n SessionRelayInitParams,\n SessionRelayInitResult,\n SessionRelayGrantPayload,\n SessionRelayPollResult,\n SessionRelayClaimRequest,\n SessionRelayClaimResponse,\n SessionRelayApproveRequest,\n SessionRelayDenyRequest,\n SessionRelayClient,\n SessionRelayBuilderClient,\n} from \"./session-relay/types\";\n"],"mappings":"AAuBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendatalabs/vana-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "A TypeScript library for interacting with Vana Network smart contracts.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -37,6 +37,15 @@
|
|
|
37
37
|
"types": "./dist/react.d.ts",
|
|
38
38
|
"import": "./dist/react.js"
|
|
39
39
|
},
|
|
40
|
+
"./session-relay": {
|
|
41
|
+
"browser": {
|
|
42
|
+
"types": "./dist/session-relay.d.ts",
|
|
43
|
+
"import": "./dist/session-relay.js"
|
|
44
|
+
},
|
|
45
|
+
"types": "./dist/session-relay.d.ts",
|
|
46
|
+
"import": "./dist/session-relay.js",
|
|
47
|
+
"require": "./dist/session-relay.cjs"
|
|
48
|
+
},
|
|
40
49
|
"./chains": {
|
|
41
50
|
"browser": {
|
|
42
51
|
"types": "./dist/chains.browser.d.ts",
|