@opendatalabs/vana-sdk 3.0.1 → 3.2.0-canary.88d802d
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 +2 -1
- package/dist/__tests__/interop-personal-server.test.d.ts +1 -0
- package/dist/account/personal-server-lite-owner-binding.cjs +81 -0
- package/dist/account/personal-server-lite-owner-binding.cjs.map +1 -0
- package/dist/account/personal-server-lite-owner-binding.d.ts +30 -0
- package/dist/account/personal-server-lite-owner-binding.js +59 -0
- package/dist/account/personal-server-lite-owner-binding.js.map +1 -0
- package/dist/account/personal-server-lite-owner-binding.test.d.ts +1 -0
- package/dist/account/personal-server-registration.cjs +263 -0
- package/dist/account/personal-server-registration.cjs.map +1 -0
- package/dist/account/personal-server-registration.d.ts +66 -0
- package/dist/account/personal-server-registration.js +240 -0
- package/dist/account/personal-server-registration.js.map +1 -0
- package/dist/account/personal-server-registration.test.d.ts +1 -0
- package/dist/auth/errors.js +1 -1
- package/dist/auth/oauth-client.cjs +250 -0
- package/dist/auth/oauth-client.cjs.map +1 -0
- package/dist/auth/oauth-client.d.ts +90 -0
- package/dist/auth/oauth-client.js +228 -0
- package/dist/auth/oauth-client.js.map +1 -0
- package/dist/auth/oauth-client.test.d.ts +1 -0
- package/dist/auth/web3-signed-builder.js +1 -1
- package/dist/auth/web3-signed.js +3 -3
- package/dist/browser.js +1 -1
- package/dist/chains/definitions.js +1 -1
- package/dist/chains/index.js +1 -1
- package/dist/chains.browser.js +1 -1
- package/dist/chains.js +1 -1
- package/dist/chains.node.js +1 -1
- package/dist/contracts/contractController.js +4 -4
- package/dist/core/client.js +1 -1
- package/dist/crypto/ecies/base.js +3 -3
- package/dist/crypto/ecies/browser.js +1 -1
- package/dist/crypto/ecies/index.js +1 -1
- package/dist/crypto/ecies/interface.js +1 -1
- package/dist/crypto/ecies/node.js +1 -1
- package/dist/crypto/services/WalletKeyEncryptionService.js +1 -1
- package/dist/generated/abi/index.js +26 -26
- package/dist/index.browser.d.ts +9 -3
- package/dist/index.browser.js +930 -73
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +958 -74
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +9 -3
- package/dist/index.node.js +930 -73
- package/dist/index.node.js.map +4 -4
- package/dist/node.js +1 -1
- package/dist/platform/browser-only.js +1 -1
- package/dist/platform/browser-safe.js +1 -1
- package/dist/platform/browser.js +6 -6
- package/dist/platform/index.js +4 -4
- package/dist/platform/node.js +8 -8
- package/dist/platform/utils.js +2 -2
- package/dist/platform.browser.js +3 -3
- package/dist/platform.js +4 -4
- package/dist/platform.node.js +4 -4
- package/dist/protocol/eip712.cjs +58 -3
- package/dist/protocol/eip712.cjs.map +1 -1
- package/dist/protocol/eip712.d.ts +98 -7
- package/dist/protocol/eip712.js +52 -3
- package/dist/protocol/eip712.js.map +1 -1
- package/dist/protocol/escrow-deposit.cjs +89 -0
- package/dist/protocol/escrow-deposit.cjs.map +1 -0
- package/dist/protocol/escrow-deposit.d.ts +47 -0
- package/dist/protocol/escrow-deposit.js +60 -0
- package/dist/protocol/escrow-deposit.js.map +1 -0
- package/dist/protocol/escrow-deposit.test.d.ts +1 -0
- package/dist/protocol/escrow-flow.test.d.ts +21 -0
- package/dist/protocol/gateway.cjs +124 -3
- package/dist/protocol/gateway.cjs.map +1 -1
- package/dist/protocol/gateway.d.ts +196 -16
- package/dist/protocol/gateway.js +124 -3
- package/dist/protocol/gateway.js.map +1 -1
- package/dist/protocol/grants.cjs +24 -64
- package/dist/protocol/grants.cjs.map +1 -1
- package/dist/protocol/grants.d.ts +6 -13
- package/dist/protocol/grants.js +25 -64
- package/dist/protocol/grants.js.map +1 -1
- package/dist/protocol/personal-server-lite-owner-binding.cjs +93 -0
- package/dist/protocol/personal-server-lite-owner-binding.cjs.map +1 -0
- package/dist/protocol/personal-server-lite-owner-binding.d.ts +44 -0
- package/dist/protocol/personal-server-lite-owner-binding.js +65 -0
- package/dist/protocol/personal-server-lite-owner-binding.js.map +1 -0
- package/dist/protocol/personal-server-lite-owner-binding.test.d.ts +1 -0
- package/dist/protocol/personal-server-registration.cjs +122 -0
- package/dist/protocol/personal-server-registration.cjs.map +1 -0
- package/dist/protocol/personal-server-registration.d.ts +62 -0
- package/dist/protocol/personal-server-registration.js +97 -0
- package/dist/protocol/personal-server-registration.js.map +1 -0
- package/dist/protocol/personal-server-registration.test.d.ts +1 -0
- package/dist/storage/default.js +1 -1
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +10 -10
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/manager.js +1 -1
- package/dist/storage/providers/callback-storage.js +1 -1
- package/dist/storage/providers/dropbox.js +1 -1
- package/dist/storage/providers/google-drive.js +1 -1
- package/dist/storage/providers/ipfs.js +2 -2
- package/dist/storage/providers/pinata.js +1 -1
- package/dist/storage/providers/r2.js +1 -1
- package/dist/storage/providers/vana-storage.cjs +1 -1
- package/dist/storage/providers/vana-storage.cjs.map +1 -1
- package/dist/storage/providers/vana-storage.d.ts +2 -2
- package/dist/storage/providers/vana-storage.js +3 -3
- package/dist/storage/providers/vana-storage.js.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types.js +1 -1
- package/package.json +7 -3
package/dist/index.browser.js
CHANGED
|
@@ -29006,7 +29006,7 @@ async function buildWeb3SignedHeader(params) {
|
|
|
29006
29006
|
}
|
|
29007
29007
|
|
|
29008
29008
|
// src/storage/providers/vana-storage.ts
|
|
29009
|
-
var DEFAULT_ENDPOINT = "https://storage.vana.
|
|
29009
|
+
var DEFAULT_ENDPOINT = "https://storage.vana.org";
|
|
29010
29010
|
var BLOB_PATH_PREFIX = "/v1/blobs";
|
|
29011
29011
|
var DEFAULT_TOKEN_TTL_SECONDS = 300;
|
|
29012
29012
|
var VanaStorage = class {
|
|
@@ -31432,6 +31432,228 @@ var InMemoryTokenStore = class {
|
|
|
31432
31432
|
}
|
|
31433
31433
|
};
|
|
31434
31434
|
|
|
31435
|
+
// src/auth/oauth-client.ts
|
|
31436
|
+
var VERIFIER_TTL_SECONDS = 600;
|
|
31437
|
+
var RESERVED_AUTHORIZE_PARAMS = /* @__PURE__ */ new Set([
|
|
31438
|
+
"response_type",
|
|
31439
|
+
"client_id",
|
|
31440
|
+
"redirect_uri",
|
|
31441
|
+
"scope",
|
|
31442
|
+
"state",
|
|
31443
|
+
"code_challenge",
|
|
31444
|
+
"code_challenge_method"
|
|
31445
|
+
]);
|
|
31446
|
+
var OAuthClient = class {
|
|
31447
|
+
#config;
|
|
31448
|
+
constructor(config) {
|
|
31449
|
+
const fetchImpl = config.fetchImpl ?? globalThis.fetch;
|
|
31450
|
+
if (typeof fetchImpl !== "function") {
|
|
31451
|
+
throw new TypeError(
|
|
31452
|
+
"OAuthClient requires a global `fetch` or an explicit `fetchImpl`"
|
|
31453
|
+
);
|
|
31454
|
+
}
|
|
31455
|
+
this.#config = {
|
|
31456
|
+
authorizationEndpoint: config.authorizationEndpoint,
|
|
31457
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
31458
|
+
clientId: config.clientId,
|
|
31459
|
+
redirectUri: config.redirectUri,
|
|
31460
|
+
scope: config.scope,
|
|
31461
|
+
tokenStore: config.tokenStore ?? new InMemoryTokenStore(),
|
|
31462
|
+
fetchImpl,
|
|
31463
|
+
generateState: config.generateState ?? defaultGenerateState
|
|
31464
|
+
};
|
|
31465
|
+
}
|
|
31466
|
+
/** Build the authorize URL and persist the PKCE verifier keyed by `state`. */
|
|
31467
|
+
async buildAuthorizationUrl(opts = {}) {
|
|
31468
|
+
const state = opts.state ?? this.#config.generateState();
|
|
31469
|
+
const scope = opts.scope ?? this.#config.scope;
|
|
31470
|
+
const verifier = generatePkceVerifier();
|
|
31471
|
+
const challenge = await computePkceChallenge(verifier);
|
|
31472
|
+
await this.#config.tokenStore.set(this.#verifierKey(state), {
|
|
31473
|
+
token: verifier,
|
|
31474
|
+
expiresAt: Math.floor(Date.now() / 1e3) + VERIFIER_TTL_SECONDS
|
|
31475
|
+
});
|
|
31476
|
+
const params = new URLSearchParams();
|
|
31477
|
+
params.set("response_type", "code");
|
|
31478
|
+
params.set("client_id", this.#config.clientId);
|
|
31479
|
+
params.set("redirect_uri", this.#config.redirectUri);
|
|
31480
|
+
if (scope !== void 0 && scope.length > 0) {
|
|
31481
|
+
params.set("scope", scope);
|
|
31482
|
+
}
|
|
31483
|
+
params.set("state", state);
|
|
31484
|
+
params.set("code_challenge", challenge);
|
|
31485
|
+
params.set("code_challenge_method", "S256");
|
|
31486
|
+
if (opts.extraParams !== void 0) {
|
|
31487
|
+
for (const k of Object.keys(opts.extraParams)) {
|
|
31488
|
+
if (RESERVED_AUTHORIZE_PARAMS.has(k)) {
|
|
31489
|
+
throw new Error(
|
|
31490
|
+
`extraParams may not override the reserved OAuth/PKCE parameter "${k}"`
|
|
31491
|
+
);
|
|
31492
|
+
}
|
|
31493
|
+
}
|
|
31494
|
+
for (const [k, v] of Object.entries(opts.extraParams)) {
|
|
31495
|
+
params.set(k, v);
|
|
31496
|
+
}
|
|
31497
|
+
}
|
|
31498
|
+
const sep = this.#config.authorizationEndpoint.includes("?") ? "&" : "?";
|
|
31499
|
+
const url = `${this.#config.authorizationEndpoint}${sep}${params.toString()}`;
|
|
31500
|
+
return { url, state };
|
|
31501
|
+
}
|
|
31502
|
+
/**
|
|
31503
|
+
* Handle the redirect-callback URL. Validates `state`, retrieves the saved
|
|
31504
|
+
* verifier, exchanges the authorization code + verifier for tokens, and
|
|
31505
|
+
* persists them. Returns the access {@link TokenRecord}.
|
|
31506
|
+
*/
|
|
31507
|
+
async handleCallback(callbackUrl) {
|
|
31508
|
+
const parsed = new URL(callbackUrl);
|
|
31509
|
+
const params = parsed.searchParams;
|
|
31510
|
+
const errorCode = params.get("error");
|
|
31511
|
+
if (errorCode !== null) {
|
|
31512
|
+
throw new Error(
|
|
31513
|
+
formatOAuthError({
|
|
31514
|
+
error: errorCode,
|
|
31515
|
+
error_description: params.get("error_description") ?? void 0
|
|
31516
|
+
})
|
|
31517
|
+
);
|
|
31518
|
+
}
|
|
31519
|
+
const code = params.get("code");
|
|
31520
|
+
const state = params.get("state");
|
|
31521
|
+
if (code === null || state === null) {
|
|
31522
|
+
throw new Error("OAuth callback is missing `code` or `state`");
|
|
31523
|
+
}
|
|
31524
|
+
const verifierRecord = await this.#config.tokenStore.get(
|
|
31525
|
+
this.#verifierKey(state)
|
|
31526
|
+
);
|
|
31527
|
+
if (verifierRecord === null) {
|
|
31528
|
+
throw new Error(
|
|
31529
|
+
"OAuth callback state does not match any in-flight verifier (possible CSRF or expired flow)"
|
|
31530
|
+
);
|
|
31531
|
+
}
|
|
31532
|
+
const body = new URLSearchParams();
|
|
31533
|
+
body.set("grant_type", "authorization_code");
|
|
31534
|
+
body.set("code", code);
|
|
31535
|
+
body.set("redirect_uri", this.#config.redirectUri);
|
|
31536
|
+
body.set("client_id", this.#config.clientId);
|
|
31537
|
+
body.set("code_verifier", verifierRecord.token);
|
|
31538
|
+
let tokens;
|
|
31539
|
+
try {
|
|
31540
|
+
tokens = await this.#tokenRequest(body);
|
|
31541
|
+
} finally {
|
|
31542
|
+
await this.#config.tokenStore.delete(this.#verifierKey(state));
|
|
31543
|
+
}
|
|
31544
|
+
return this.#persistTokens(tokens);
|
|
31545
|
+
}
|
|
31546
|
+
/**
|
|
31547
|
+
* Exchange a stored refresh token for a fresh access token. Throws if no
|
|
31548
|
+
* refresh token is available.
|
|
31549
|
+
*/
|
|
31550
|
+
async refresh() {
|
|
31551
|
+
const refreshRecord = await this.#config.tokenStore.get(this.#refreshKey());
|
|
31552
|
+
if (refreshRecord === null) {
|
|
31553
|
+
throw new Error("OAuth refresh failed: no refresh token stored");
|
|
31554
|
+
}
|
|
31555
|
+
const body = new URLSearchParams();
|
|
31556
|
+
body.set("grant_type", "refresh_token");
|
|
31557
|
+
body.set("refresh_token", refreshRecord.token);
|
|
31558
|
+
body.set("client_id", this.#config.clientId);
|
|
31559
|
+
const tokens = await this.#tokenRequest(body);
|
|
31560
|
+
return this.#persistTokens(tokens, refreshRecord.token);
|
|
31561
|
+
}
|
|
31562
|
+
/**
|
|
31563
|
+
* Get the current access token if valid (refreshing first if expired and a
|
|
31564
|
+
* refresh token is available). Returns `null` when no usable token exists.
|
|
31565
|
+
*/
|
|
31566
|
+
async getAccessToken() {
|
|
31567
|
+
const stored = await this.#config.tokenStore.get(this.#accessKey());
|
|
31568
|
+
if (stored !== null) return stored.token;
|
|
31569
|
+
const refresh = await this.#config.tokenStore.get(this.#refreshKey());
|
|
31570
|
+
if (refresh === null) return null;
|
|
31571
|
+
try {
|
|
31572
|
+
const refreshed = await this.refresh();
|
|
31573
|
+
return refreshed.token;
|
|
31574
|
+
} catch {
|
|
31575
|
+
return null;
|
|
31576
|
+
}
|
|
31577
|
+
}
|
|
31578
|
+
/** Forget tokens (logout). Does NOT call any remote revocation endpoint. */
|
|
31579
|
+
async signOut() {
|
|
31580
|
+
await this.#config.tokenStore.delete(this.#accessKey());
|
|
31581
|
+
await this.#config.tokenStore.delete(this.#refreshKey());
|
|
31582
|
+
}
|
|
31583
|
+
#accessKey() {
|
|
31584
|
+
return `oauth:tokens:${this.#config.clientId}`;
|
|
31585
|
+
}
|
|
31586
|
+
#refreshKey() {
|
|
31587
|
+
return `oauth:refresh:${this.#config.clientId}`;
|
|
31588
|
+
}
|
|
31589
|
+
#verifierKey(state) {
|
|
31590
|
+
return `oauth:verifier:${state}`;
|
|
31591
|
+
}
|
|
31592
|
+
async #tokenRequest(body) {
|
|
31593
|
+
const response = await this.#config.fetchImpl(this.#config.tokenEndpoint, {
|
|
31594
|
+
method: "POST",
|
|
31595
|
+
headers: {
|
|
31596
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
31597
|
+
Accept: "application/json"
|
|
31598
|
+
},
|
|
31599
|
+
body: body.toString()
|
|
31600
|
+
});
|
|
31601
|
+
const text = await response.text();
|
|
31602
|
+
const parsed = parseJsonBody(text);
|
|
31603
|
+
if (!response.ok) {
|
|
31604
|
+
throw new Error(formatOAuthError(parsed ?? {}, response.status));
|
|
31605
|
+
}
|
|
31606
|
+
if (parsed === null || typeof parsed !== "object" || typeof parsed.access_token !== "string") {
|
|
31607
|
+
throw new Error(
|
|
31608
|
+
"OAuth token endpoint returned a response without an `access_token` string"
|
|
31609
|
+
);
|
|
31610
|
+
}
|
|
31611
|
+
return parsed;
|
|
31612
|
+
}
|
|
31613
|
+
async #persistTokens(tokens, previousRefreshToken) {
|
|
31614
|
+
const record = { token: tokens.access_token };
|
|
31615
|
+
if (typeof tokens.expires_in === "number" && tokens.expires_in > 0) {
|
|
31616
|
+
record.expiresAt = Math.floor(Date.now() / 1e3) + tokens.expires_in;
|
|
31617
|
+
}
|
|
31618
|
+
await this.#config.tokenStore.set(this.#accessKey(), record);
|
|
31619
|
+
const newRefresh = tokens.refresh_token ?? previousRefreshToken;
|
|
31620
|
+
if (newRefresh !== void 0) {
|
|
31621
|
+
await this.#config.tokenStore.set(this.#refreshKey(), {
|
|
31622
|
+
token: newRefresh
|
|
31623
|
+
});
|
|
31624
|
+
}
|
|
31625
|
+
return record;
|
|
31626
|
+
}
|
|
31627
|
+
};
|
|
31628
|
+
function defaultGenerateState() {
|
|
31629
|
+
const bytes = new Uint8Array(24);
|
|
31630
|
+
crypto.getRandomValues(bytes);
|
|
31631
|
+
let binary = "";
|
|
31632
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
31633
|
+
binary += String.fromCharCode(bytes[i]);
|
|
31634
|
+
}
|
|
31635
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
31636
|
+
}
|
|
31637
|
+
function parseJsonBody(text) {
|
|
31638
|
+
if (text.length === 0) return null;
|
|
31639
|
+
try {
|
|
31640
|
+
return JSON.parse(text);
|
|
31641
|
+
} catch {
|
|
31642
|
+
return null;
|
|
31643
|
+
}
|
|
31644
|
+
}
|
|
31645
|
+
function formatOAuthError(body, status) {
|
|
31646
|
+
const parts = ["OAuth token request failed"];
|
|
31647
|
+
if (status !== void 0) parts.push(`(HTTP ${String(status)})`);
|
|
31648
|
+
if (body.error !== void 0 && body.error.length > 0) {
|
|
31649
|
+
parts.push(`: ${body.error}`);
|
|
31650
|
+
if (body.error_description !== void 0 && body.error_description.length > 0) {
|
|
31651
|
+
parts.push(`- ${body.error_description}`);
|
|
31652
|
+
}
|
|
31653
|
+
}
|
|
31654
|
+
return parts.join(" ").replace(" : ", ": ").replace(" - ", " - ");
|
|
31655
|
+
}
|
|
31656
|
+
|
|
31435
31657
|
// src/platform/utils.ts
|
|
31436
31658
|
function detectPlatform() {
|
|
31437
31659
|
if (typeof process !== "undefined" && process.versions && process.versions.node) {
|
|
@@ -31660,6 +31882,7 @@ async function verifyWeb3Signed(params) {
|
|
|
31660
31882
|
// src/protocol/eip712.ts
|
|
31661
31883
|
var DOMAIN_NAME = "Vana Data Portability";
|
|
31662
31884
|
var DOMAIN_VERSION = "1";
|
|
31885
|
+
var NATIVE_VANA_ASSET = "0x0000000000000000000000000000000000000000";
|
|
31663
31886
|
function buildDomain(chainId, verifyingContract) {
|
|
31664
31887
|
return {
|
|
31665
31888
|
name: DOMAIN_NAME,
|
|
@@ -31674,6 +31897,12 @@ function fileRegistrationDomain(config) {
|
|
|
31674
31897
|
config.contracts.dataRegistry
|
|
31675
31898
|
);
|
|
31676
31899
|
}
|
|
31900
|
+
function dataRegistryDomain(config) {
|
|
31901
|
+
return buildDomain(
|
|
31902
|
+
config.chainId,
|
|
31903
|
+
config.contracts.dataRegistry
|
|
31904
|
+
);
|
|
31905
|
+
}
|
|
31677
31906
|
function grantRegistrationDomain(config) {
|
|
31678
31907
|
return buildDomain(
|
|
31679
31908
|
config.chainId,
|
|
@@ -31698,6 +31927,12 @@ function builderRegistrationDomain(config) {
|
|
|
31698
31927
|
config.contracts.dataPortabilityGrantees
|
|
31699
31928
|
);
|
|
31700
31929
|
}
|
|
31930
|
+
function escrowPaymentDomain(config) {
|
|
31931
|
+
return buildDomain(
|
|
31932
|
+
config.chainId,
|
|
31933
|
+
config.contracts.dataPortabilityEscrow
|
|
31934
|
+
);
|
|
31935
|
+
}
|
|
31701
31936
|
var FILE_REGISTRATION_TYPES = {
|
|
31702
31937
|
FileRegistration: [
|
|
31703
31938
|
{ name: "ownerAddress", type: "address" },
|
|
@@ -31709,14 +31944,16 @@ var GRANT_REGISTRATION_TYPES = {
|
|
|
31709
31944
|
GrantRegistration: [
|
|
31710
31945
|
{ name: "grantorAddress", type: "address" },
|
|
31711
31946
|
{ name: "granteeId", type: "bytes32" },
|
|
31712
|
-
{ name: "
|
|
31713
|
-
{ name: "
|
|
31947
|
+
{ name: "scopes", type: "string[]" },
|
|
31948
|
+
{ name: "grantVersion", type: "uint256" },
|
|
31949
|
+
{ name: "expiresAt", type: "uint256" }
|
|
31714
31950
|
]
|
|
31715
31951
|
};
|
|
31716
31952
|
var GRANT_REVOCATION_TYPES = {
|
|
31717
31953
|
GrantRevocation: [
|
|
31718
31954
|
{ name: "grantorAddress", type: "address" },
|
|
31719
|
-
{ name: "grantId", type: "bytes32" }
|
|
31955
|
+
{ name: "grantId", type: "bytes32" },
|
|
31956
|
+
{ name: "grantVersion", type: "uint256" }
|
|
31720
31957
|
]
|
|
31721
31958
|
};
|
|
31722
31959
|
var SERVER_REGISTRATION_TYPES = {
|
|
@@ -31735,83 +31972,500 @@ var BUILDER_REGISTRATION_TYPES = {
|
|
|
31735
31972
|
{ name: "appUrl", type: "string" }
|
|
31736
31973
|
]
|
|
31737
31974
|
};
|
|
31975
|
+
var GENERIC_PAYMENT_TYPES = {
|
|
31976
|
+
GenericPayment: [
|
|
31977
|
+
{ name: "payerAddress", type: "address" },
|
|
31978
|
+
{ name: "opType", type: "string" },
|
|
31979
|
+
{ name: "opId", type: "bytes32" },
|
|
31980
|
+
{ name: "asset", type: "address" },
|
|
31981
|
+
{ name: "amount", type: "uint256" },
|
|
31982
|
+
{ name: "paymentNonce", type: "uint256" }
|
|
31983
|
+
]
|
|
31984
|
+
};
|
|
31985
|
+
var ADD_DATA_TYPES = {
|
|
31986
|
+
AddData: [
|
|
31987
|
+
{ name: "ownerAddress", type: "address" },
|
|
31988
|
+
{ name: "scope", type: "string" },
|
|
31989
|
+
{ name: "dataHash", type: "bytes32" },
|
|
31990
|
+
{ name: "metadataHash", type: "bytes32" },
|
|
31991
|
+
{ name: "expectedVersion", type: "uint256" }
|
|
31992
|
+
]
|
|
31993
|
+
};
|
|
31994
|
+
var RECORD_DATA_ACCESS_TYPES = {
|
|
31995
|
+
RecordDataAccess: [
|
|
31996
|
+
{ name: "ownerAddress", type: "address" },
|
|
31997
|
+
{ name: "scope", type: "string" },
|
|
31998
|
+
{ name: "version", type: "uint256" },
|
|
31999
|
+
{ name: "accessor", type: "address" },
|
|
32000
|
+
{ name: "recordId", type: "bytes32" }
|
|
32001
|
+
]
|
|
32002
|
+
};
|
|
31738
32003
|
|
|
31739
|
-
// src/protocol/
|
|
31740
|
-
import {
|
|
31741
|
-
|
|
31742
|
-
|
|
32004
|
+
// src/protocol/personal-server-registration.ts
|
|
32005
|
+
import {
|
|
32006
|
+
isAddress
|
|
32007
|
+
} from "viem";
|
|
32008
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID = 1480;
|
|
32009
|
+
var PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT = "0x1483B1F634DBA75AeaE60da7f01A679aabd5ee2c";
|
|
32010
|
+
function assertAddress(value, name) {
|
|
32011
|
+
if (!isAddress(value)) {
|
|
32012
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
32013
|
+
}
|
|
31743
32014
|
}
|
|
31744
|
-
function
|
|
31745
|
-
if (
|
|
31746
|
-
return
|
|
32015
|
+
function getAccountAddress(account) {
|
|
32016
|
+
if (!account) {
|
|
32017
|
+
return void 0;
|
|
31747
32018
|
}
|
|
31748
|
-
|
|
31749
|
-
|
|
31750
|
-
|
|
31751
|
-
|
|
32019
|
+
return typeof account === "string" ? account : account.address;
|
|
32020
|
+
}
|
|
32021
|
+
function isPersonalServerRegistrationSigner(source) {
|
|
32022
|
+
return "address" in source && typeof source.signTypedData === "function";
|
|
32023
|
+
}
|
|
32024
|
+
function createViemPersonalServerRegistrationSigner(source, options = {}) {
|
|
32025
|
+
if (isPersonalServerRegistrationSigner(source)) {
|
|
32026
|
+
return source;
|
|
31752
32027
|
}
|
|
31753
|
-
const
|
|
31754
|
-
|
|
32028
|
+
const accountAddress = getAccountAddress(options.account) ?? getAccountAddress(source.account);
|
|
32029
|
+
if (accountAddress) {
|
|
32030
|
+
return {
|
|
32031
|
+
address: accountAddress,
|
|
32032
|
+
signTypedData: (typedData) => source.signTypedData({
|
|
32033
|
+
...typedData,
|
|
32034
|
+
account: options.account ?? source.account ?? accountAddress
|
|
32035
|
+
})
|
|
32036
|
+
};
|
|
32037
|
+
}
|
|
32038
|
+
throw new Error(
|
|
32039
|
+
"Viem wallet client requires an account option or account property"
|
|
32040
|
+
);
|
|
31755
32041
|
}
|
|
31756
|
-
function
|
|
31757
|
-
|
|
31758
|
-
|
|
31759
|
-
parsed = JSON.parse(grant);
|
|
31760
|
-
} catch {
|
|
31761
|
-
return null;
|
|
32042
|
+
function personalServerRegistrationDomain(input = {}) {
|
|
32043
|
+
if (input.config) {
|
|
32044
|
+
return serverRegistrationDomain(input.config);
|
|
31762
32045
|
}
|
|
31763
|
-
|
|
31764
|
-
|
|
32046
|
+
const verifyingContract = input.verifyingContract ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT;
|
|
32047
|
+
assertAddress(verifyingContract, "verifyingContract");
|
|
32048
|
+
return {
|
|
32049
|
+
name: "Vana Data Portability",
|
|
32050
|
+
version: "1",
|
|
32051
|
+
chainId: input.chainId ?? PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
32052
|
+
verifyingContract
|
|
32053
|
+
};
|
|
32054
|
+
}
|
|
32055
|
+
function buildPersonalServerRegistrationTypedData(input) {
|
|
32056
|
+
assertAddress(input.ownerAddress, "ownerAddress");
|
|
32057
|
+
assertAddress(input.serverAddress, "serverAddress");
|
|
32058
|
+
return {
|
|
32059
|
+
domain: personalServerRegistrationDomain(input),
|
|
32060
|
+
types: SERVER_REGISTRATION_TYPES,
|
|
32061
|
+
primaryType: "ServerRegistration",
|
|
32062
|
+
message: {
|
|
32063
|
+
ownerAddress: input.ownerAddress,
|
|
32064
|
+
serverAddress: input.serverAddress,
|
|
32065
|
+
publicKey: input.serverPublicKey,
|
|
32066
|
+
serverUrl: input.serverUrl
|
|
32067
|
+
}
|
|
32068
|
+
};
|
|
32069
|
+
}
|
|
32070
|
+
async function buildPersonalServerRegistrationSignature(input) {
|
|
32071
|
+
const typedData = buildPersonalServerRegistrationTypedData({
|
|
32072
|
+
ownerAddress: input.signer.address,
|
|
32073
|
+
serverAddress: input.serverAddress,
|
|
32074
|
+
serverPublicKey: input.serverPublicKey,
|
|
32075
|
+
serverUrl: input.serverUrl,
|
|
32076
|
+
config: input.config,
|
|
32077
|
+
chainId: input.chainId,
|
|
32078
|
+
verifyingContract: input.verifyingContract
|
|
32079
|
+
});
|
|
32080
|
+
const signature = await input.signer.signTypedData(typedData);
|
|
32081
|
+
return {
|
|
32082
|
+
signature,
|
|
32083
|
+
signerAddress: input.signer.address,
|
|
32084
|
+
typedData
|
|
32085
|
+
};
|
|
32086
|
+
}
|
|
32087
|
+
var registerPersonalServerSignature = buildPersonalServerRegistrationSignature;
|
|
32088
|
+
|
|
32089
|
+
// src/protocol/personal-server-lite-owner-binding.ts
|
|
32090
|
+
import {
|
|
32091
|
+
isAddress as isAddress2
|
|
32092
|
+
} from "viem";
|
|
32093
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.account.v1";
|
|
32094
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
32095
|
+
var PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
|
|
32096
|
+
function assertAddress2(value, name) {
|
|
32097
|
+
if (!isAddress2(value)) {
|
|
32098
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
31765
32099
|
}
|
|
31766
|
-
|
|
31767
|
-
|
|
31768
|
-
|
|
32100
|
+
}
|
|
32101
|
+
function getAccountAddress2(account) {
|
|
32102
|
+
if (!account) {
|
|
32103
|
+
return void 0;
|
|
31769
32104
|
}
|
|
31770
|
-
|
|
31771
|
-
|
|
32105
|
+
return typeof account === "string" ? account : account.address;
|
|
32106
|
+
}
|
|
32107
|
+
function isPersonalServerLiteOwnerBindingSigner(source) {
|
|
32108
|
+
return "address" in source && typeof source.signMessage === "function";
|
|
32109
|
+
}
|
|
32110
|
+
function buildPersonalServerLiteOwnerBindingMessage(ownerAddress) {
|
|
32111
|
+
assertAddress2(ownerAddress, "ownerAddress");
|
|
32112
|
+
return `${PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${ownerAddress.toLowerCase()}`;
|
|
32113
|
+
}
|
|
32114
|
+
function createViemPersonalServerLiteOwnerBindingSigner(source, options = {}) {
|
|
32115
|
+
if (isPersonalServerLiteOwnerBindingSigner(source)) {
|
|
32116
|
+
return source;
|
|
31772
32117
|
}
|
|
31773
|
-
|
|
31774
|
-
|
|
32118
|
+
const accountAddress = getAccountAddress2(options.account) ?? getAccountAddress2(source.account);
|
|
32119
|
+
if (accountAddress) {
|
|
32120
|
+
return {
|
|
32121
|
+
address: accountAddress,
|
|
32122
|
+
signMessage: ({ message }) => source.signMessage({
|
|
32123
|
+
account: options.account ?? source.account ?? accountAddress,
|
|
32124
|
+
message
|
|
32125
|
+
})
|
|
32126
|
+
};
|
|
31775
32127
|
}
|
|
31776
|
-
|
|
31777
|
-
|
|
32128
|
+
throw new Error(
|
|
32129
|
+
"Viem wallet client requires an account option or account property"
|
|
32130
|
+
);
|
|
32131
|
+
}
|
|
32132
|
+
async function buildPersonalServerLiteOwnerBindingSignature(input) {
|
|
32133
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(
|
|
32134
|
+
input.signer.address
|
|
32135
|
+
);
|
|
32136
|
+
const signature = await input.signer.signMessage({ message });
|
|
32137
|
+
return {
|
|
32138
|
+
signature,
|
|
32139
|
+
signerAddress: input.signer.address,
|
|
32140
|
+
message,
|
|
32141
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
32142
|
+
};
|
|
32143
|
+
}
|
|
32144
|
+
var signPersonalServerLiteOwnerBinding = buildPersonalServerLiteOwnerBindingSignature;
|
|
32145
|
+
|
|
32146
|
+
// src/account/personal-server-registration.ts
|
|
32147
|
+
import { isAddress as isAddress3 } from "viem";
|
|
32148
|
+
var ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT = "personal_server.server_registration.v1";
|
|
32149
|
+
var AccountPersonalServerRegistrationError = class extends Error {
|
|
32150
|
+
status;
|
|
32151
|
+
code;
|
|
32152
|
+
details;
|
|
32153
|
+
constructor(input) {
|
|
32154
|
+
super(input.message);
|
|
32155
|
+
this.name = "AccountPersonalServerRegistrationError";
|
|
32156
|
+
this.status = input.status;
|
|
32157
|
+
this.code = input.code;
|
|
32158
|
+
this.details = input.details;
|
|
31778
32159
|
}
|
|
31779
|
-
|
|
31780
|
-
|
|
32160
|
+
};
|
|
32161
|
+
var DEFAULT_ACCOUNT_PS_REGISTRATION_PATH = "/api/v1/intents/personal-server-registration/sign";
|
|
32162
|
+
function trimTrailingSlash(value) {
|
|
32163
|
+
return value.replace(/\/+$/, "");
|
|
32164
|
+
}
|
|
32165
|
+
function assertAddress3(value, name) {
|
|
32166
|
+
if (!isAddress3(value)) {
|
|
32167
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
31781
32168
|
}
|
|
31782
|
-
|
|
31783
|
-
|
|
32169
|
+
}
|
|
32170
|
+
async function parseAccountResponse(response) {
|
|
32171
|
+
const body = await response.json().catch(() => void 0);
|
|
32172
|
+
if (!response.ok) {
|
|
32173
|
+
throw new AccountPersonalServerRegistrationError({
|
|
32174
|
+
status: response.status,
|
|
32175
|
+
code: accountErrorCode(body),
|
|
32176
|
+
message: accountErrorMessage(response.status, body),
|
|
32177
|
+
details: body
|
|
32178
|
+
});
|
|
31784
32179
|
}
|
|
32180
|
+
return body;
|
|
32181
|
+
}
|
|
32182
|
+
function accountErrorMessage(status, body) {
|
|
32183
|
+
const nestedMessage = nestedAccountErrorField(body, "message");
|
|
32184
|
+
if (nestedMessage) {
|
|
32185
|
+
return nestedMessage;
|
|
32186
|
+
}
|
|
32187
|
+
if (isRecord(body) && typeof body.message === "string") {
|
|
32188
|
+
return body.message;
|
|
32189
|
+
}
|
|
32190
|
+
const code = accountErrorCode(body);
|
|
32191
|
+
if (code) {
|
|
32192
|
+
return `Account PS registration signing failed: ${code}`;
|
|
32193
|
+
}
|
|
32194
|
+
return `Account PS registration signing failed: ${status}`;
|
|
32195
|
+
}
|
|
32196
|
+
function accountErrorCode(body) {
|
|
32197
|
+
const nestedCode = nestedAccountErrorField(body, "code");
|
|
32198
|
+
if (nestedCode) {
|
|
32199
|
+
return nestedCode;
|
|
32200
|
+
}
|
|
32201
|
+
if (isRecord(body)) {
|
|
32202
|
+
if (typeof body.code === "string") {
|
|
32203
|
+
return body.code;
|
|
32204
|
+
}
|
|
32205
|
+
if (typeof body.error === "string") {
|
|
32206
|
+
return body.error;
|
|
32207
|
+
}
|
|
32208
|
+
}
|
|
32209
|
+
return void 0;
|
|
32210
|
+
}
|
|
32211
|
+
function nestedAccountErrorField(body, field) {
|
|
32212
|
+
if (!isRecord(body) || !isRecord(body.error)) {
|
|
32213
|
+
return void 0;
|
|
32214
|
+
}
|
|
32215
|
+
const value = body.error[field];
|
|
32216
|
+
return typeof value === "string" ? value : void 0;
|
|
32217
|
+
}
|
|
32218
|
+
function isRecord(value) {
|
|
32219
|
+
return typeof value === "object" && value !== null;
|
|
32220
|
+
}
|
|
32221
|
+
function normalizeAccountResponse(response) {
|
|
31785
32222
|
return {
|
|
31786
|
-
|
|
31787
|
-
|
|
31788
|
-
|
|
31789
|
-
|
|
31790
|
-
nonce: value["nonce"]
|
|
32223
|
+
...response,
|
|
32224
|
+
status: response.status === "fallback_required" ? "confirmation_required" : response.status,
|
|
32225
|
+
signerAddress: response.signerAddress ?? response.signer?.address,
|
|
32226
|
+
typedData: response.typedData ?? response.typed_data
|
|
31791
32227
|
};
|
|
31792
32228
|
}
|
|
31793
|
-
function
|
|
31794
|
-
|
|
31795
|
-
|
|
32229
|
+
function buildSignedResult(response, request) {
|
|
32230
|
+
assertAddress3(response.signerAddress, "signerAddress");
|
|
32231
|
+
if (response.typedData) {
|
|
32232
|
+
assertTypedDataMatchesRequest(
|
|
32233
|
+
response.typedData,
|
|
32234
|
+
request,
|
|
32235
|
+
response.signerAddress
|
|
32236
|
+
);
|
|
32237
|
+
}
|
|
32238
|
+
return {
|
|
32239
|
+
signature: response.signature,
|
|
32240
|
+
signerAddress: response.signerAddress,
|
|
32241
|
+
typedData: response.typedData ?? buildPersonalServerRegistrationTypedData({
|
|
32242
|
+
ownerAddress: response.signerAddress,
|
|
32243
|
+
...request
|
|
32244
|
+
}),
|
|
32245
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT
|
|
32246
|
+
};
|
|
32247
|
+
}
|
|
32248
|
+
function assertTypedDataMatchesRequest(typedData, request, expectedSignerAddress) {
|
|
32249
|
+
assertAddress3(
|
|
32250
|
+
typedData.message.ownerAddress,
|
|
32251
|
+
"typedData.message.ownerAddress"
|
|
32252
|
+
);
|
|
32253
|
+
assertAddress3(
|
|
32254
|
+
typedData.message.serverAddress,
|
|
32255
|
+
"typedData.message.serverAddress"
|
|
32256
|
+
);
|
|
32257
|
+
if (expectedSignerAddress && !sameAddress(typedData.message.ownerAddress, expectedSignerAddress)) {
|
|
32258
|
+
throw new Error(
|
|
32259
|
+
"Account typedData ownerAddress must match the expected signer address"
|
|
32260
|
+
);
|
|
32261
|
+
}
|
|
32262
|
+
if (!sameAddress(typedData.message.serverAddress, request.serverAddress)) {
|
|
32263
|
+
throw new Error(
|
|
32264
|
+
"Account typedData serverAddress must match the requested serverAddress"
|
|
32265
|
+
);
|
|
32266
|
+
}
|
|
32267
|
+
if (typedData.message.publicKey !== request.serverPublicKey) {
|
|
32268
|
+
throw new Error(
|
|
32269
|
+
"Account typedData publicKey must match the requested serverPublicKey"
|
|
32270
|
+
);
|
|
32271
|
+
}
|
|
32272
|
+
if (typedData.message.serverUrl !== request.serverUrl) {
|
|
32273
|
+
throw new Error(
|
|
32274
|
+
"Account typedData serverUrl must match the requested serverUrl"
|
|
32275
|
+
);
|
|
32276
|
+
}
|
|
32277
|
+
if (typedData.primaryType !== "ServerRegistration") {
|
|
32278
|
+
throw new Error("Account typedData primaryType must be ServerRegistration");
|
|
32279
|
+
}
|
|
32280
|
+
if (JSON.stringify(typedData.types) !== JSON.stringify(SERVER_REGISTRATION_TYPES)) {
|
|
32281
|
+
throw new Error("Account typedData types must be ServerRegistration types");
|
|
32282
|
+
}
|
|
32283
|
+
const expectedDomain = personalServerRegistrationDomain({
|
|
32284
|
+
config: request.config,
|
|
32285
|
+
chainId: request.chainId,
|
|
32286
|
+
verifyingContract: request.verifyingContract
|
|
32287
|
+
});
|
|
32288
|
+
if (!domainsEqual(typedData.domain, expectedDomain)) {
|
|
32289
|
+
throw new Error("Account typedData domain must match the requested domain");
|
|
32290
|
+
}
|
|
32291
|
+
}
|
|
32292
|
+
function sameAddress(a, b) {
|
|
32293
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
32294
|
+
}
|
|
32295
|
+
function domainsEqual(a, b) {
|
|
32296
|
+
if (!a || !b) {
|
|
32297
|
+
return false;
|
|
32298
|
+
}
|
|
32299
|
+
return a.name === b.name && a.version === b.version && Number(a.chainId) === Number(b.chainId) && String(a.verifyingContract ?? "").toLowerCase() === String(b.verifyingContract ?? "").toLowerCase() && a.salt === b.salt;
|
|
32300
|
+
}
|
|
32301
|
+
async function signPersonalServerRegistrationWithAccount(config, request) {
|
|
32302
|
+
assertAddress3(request.serverAddress, "serverAddress");
|
|
32303
|
+
const fetchImpl = config.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
32304
|
+
const endpoint = new URL(
|
|
32305
|
+
config.endpointPath ?? DEFAULT_ACCOUNT_PS_REGISTRATION_PATH,
|
|
32306
|
+
`${trimTrailingSlash(config.accountOrigin)}/`
|
|
32307
|
+
);
|
|
32308
|
+
const response = await fetchImpl(endpoint, {
|
|
32309
|
+
method: "POST",
|
|
32310
|
+
headers: { "content-type": "application/json" },
|
|
32311
|
+
credentials: "include",
|
|
32312
|
+
body: JSON.stringify({
|
|
32313
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
32314
|
+
serverAddress: request.serverAddress,
|
|
32315
|
+
serverPublicKey: request.serverPublicKey,
|
|
32316
|
+
serverUrl: request.serverUrl,
|
|
32317
|
+
config: request.config,
|
|
32318
|
+
chainId: request.chainId,
|
|
32319
|
+
verifyingContract: request.verifyingContract
|
|
32320
|
+
})
|
|
32321
|
+
});
|
|
32322
|
+
const body = normalizeAccountResponse(await parseAccountResponse(response));
|
|
32323
|
+
if (body.status === "signed") {
|
|
32324
|
+
if (!body.signature || !body.signerAddress) {
|
|
32325
|
+
throw new Error(
|
|
32326
|
+
"Account signed response must include signature and signerAddress"
|
|
32327
|
+
);
|
|
32328
|
+
}
|
|
32329
|
+
return {
|
|
32330
|
+
status: "signed",
|
|
32331
|
+
result: buildSignedResult(
|
|
32332
|
+
{
|
|
32333
|
+
signature: body.signature,
|
|
32334
|
+
signerAddress: body.signerAddress,
|
|
32335
|
+
typedData: body.typedData
|
|
32336
|
+
},
|
|
32337
|
+
request
|
|
32338
|
+
)
|
|
32339
|
+
};
|
|
32340
|
+
}
|
|
32341
|
+
if (body.status === "confirmation_required") {
|
|
32342
|
+
if (!body.typedData) {
|
|
32343
|
+
throw new Error(
|
|
32344
|
+
"Account confirmation_required response must include typedData"
|
|
32345
|
+
);
|
|
32346
|
+
}
|
|
32347
|
+
assertTypedDataMatchesRequest(body.typedData, request, body.signerAddress);
|
|
32348
|
+
if (!config.fallbackSigner) {
|
|
32349
|
+
return {
|
|
32350
|
+
status: "confirmation_required",
|
|
32351
|
+
typedData: body.typedData,
|
|
32352
|
+
signerAddress: body.signerAddress
|
|
32353
|
+
};
|
|
32354
|
+
}
|
|
32355
|
+
assertTypedDataMatchesRequest(
|
|
32356
|
+
body.typedData,
|
|
32357
|
+
request,
|
|
32358
|
+
config.fallbackSigner.address
|
|
32359
|
+
);
|
|
32360
|
+
const signature = await config.fallbackSigner.signTypedData(body.typedData);
|
|
31796
32361
|
return {
|
|
31797
|
-
|
|
31798
|
-
|
|
32362
|
+
status: "fallback_signed",
|
|
32363
|
+
accountStatus: "confirmation_required",
|
|
32364
|
+
result: {
|
|
32365
|
+
signature,
|
|
32366
|
+
signerAddress: config.fallbackSigner.address,
|
|
32367
|
+
typedData: body.typedData,
|
|
32368
|
+
intent: ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT
|
|
32369
|
+
}
|
|
31799
32370
|
};
|
|
32371
|
+
}
|
|
32372
|
+
throw new Error(
|
|
32373
|
+
`Unsupported Account PS registration signing status: ${String(body.status)}`
|
|
32374
|
+
);
|
|
32375
|
+
}
|
|
32376
|
+
|
|
32377
|
+
// src/account/personal-server-lite-owner-binding.ts
|
|
32378
|
+
var AccountPersonalServerLiteOwnerBindingError = class extends Error {
|
|
32379
|
+
code;
|
|
32380
|
+
details;
|
|
32381
|
+
constructor(input) {
|
|
32382
|
+
super(input.message);
|
|
32383
|
+
this.name = "AccountPersonalServerLiteOwnerBindingError";
|
|
32384
|
+
this.code = input.code;
|
|
32385
|
+
this.details = input.details;
|
|
32386
|
+
}
|
|
32387
|
+
};
|
|
32388
|
+
async function signPersonalServerLiteOwnerBindingWithAccountClient(config) {
|
|
32389
|
+
let address;
|
|
32390
|
+
try {
|
|
32391
|
+
address = await config.client.getAddress();
|
|
32392
|
+
} catch (error) {
|
|
32393
|
+
throw accountOwnerBindingError(error);
|
|
32394
|
+
}
|
|
32395
|
+
if (!address) {
|
|
32396
|
+
throw new AccountPersonalServerLiteOwnerBindingError({
|
|
32397
|
+
message: "Account did not return a wallet address",
|
|
32398
|
+
code: "account_address_required"
|
|
32399
|
+
});
|
|
32400
|
+
}
|
|
32401
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(address);
|
|
32402
|
+
let signature;
|
|
32403
|
+
try {
|
|
32404
|
+
signature = await config.client.signMessage({ message });
|
|
32405
|
+
} catch (error) {
|
|
32406
|
+
throw accountOwnerBindingError(error);
|
|
32407
|
+
}
|
|
32408
|
+
return {
|
|
32409
|
+
signature,
|
|
32410
|
+
signerAddress: address,
|
|
32411
|
+
message,
|
|
32412
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
32413
|
+
};
|
|
32414
|
+
}
|
|
32415
|
+
function accountOwnerBindingError(error) {
|
|
32416
|
+
if (error instanceof AccountPersonalServerLiteOwnerBindingError) {
|
|
32417
|
+
return error;
|
|
32418
|
+
}
|
|
32419
|
+
const rpcError = error;
|
|
32420
|
+
const code = rpcError?.code;
|
|
32421
|
+
const message = typeof rpcError?.message === "string" && rpcError.message.length > 0 ? rpcError.message : "Account PS Lite owner-binding signature failed";
|
|
32422
|
+
return new AccountPersonalServerLiteOwnerBindingError({
|
|
32423
|
+
message,
|
|
32424
|
+
code,
|
|
32425
|
+
details: error
|
|
32426
|
+
});
|
|
32427
|
+
}
|
|
32428
|
+
|
|
32429
|
+
// src/protocol/grants.ts
|
|
32430
|
+
import { verifyTypedData } from "viem";
|
|
32431
|
+
function isHexString(value) {
|
|
32432
|
+
return typeof value === "string" && value.startsWith("0x");
|
|
32433
|
+
}
|
|
32434
|
+
function isDataPortabilityGatewayConfig(value) {
|
|
32435
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
32436
|
+
return false;
|
|
32437
|
+
}
|
|
32438
|
+
const config = value;
|
|
32439
|
+
const contracts = config["contracts"];
|
|
32440
|
+
if (typeof config["chainId"] !== "number" || !Number.isInteger(config["chainId"]) || config["chainId"] <= 0 || contracts === null || typeof contracts !== "object" || Array.isArray(contracts)) {
|
|
32441
|
+
return false;
|
|
32442
|
+
}
|
|
32443
|
+
const c = contracts;
|
|
32444
|
+
return isHexString(c["dataRegistry"]) && isHexString(c["dataPortabilityPermissions"]) && isHexString(c["dataPortabilityServer"]) && isHexString(c["dataPortabilityGrantees"]) && isHexString(c["dataPortabilityEscrow"]);
|
|
32445
|
+
}
|
|
32446
|
+
function toUint256(value) {
|
|
32447
|
+
try {
|
|
32448
|
+
const big = typeof value === "bigint" ? value : BigInt(value);
|
|
32449
|
+
if (big < 0n) return null;
|
|
32450
|
+
return big;
|
|
31800
32451
|
} catch {
|
|
31801
32452
|
return null;
|
|
31802
32453
|
}
|
|
31803
32454
|
}
|
|
31804
32455
|
async function verifyGrantRegistration(input) {
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
|
|
31808
|
-
|
|
31809
|
-
|
|
31810
|
-
};
|
|
32456
|
+
if (!Array.isArray(input.scopes) || input.scopes.length === 0) {
|
|
32457
|
+
return { valid: false, error: "scopes must be a non-empty array" };
|
|
32458
|
+
}
|
|
32459
|
+
if (!input.scopes.every((scope) => typeof scope === "string")) {
|
|
32460
|
+
return { valid: false, error: "scopes must contain only strings" };
|
|
31811
32461
|
}
|
|
31812
|
-
const
|
|
31813
|
-
if (
|
|
31814
|
-
return { valid: false, error: "
|
|
32462
|
+
const grantVersion = toUint256(input.grantVersion);
|
|
32463
|
+
if (grantVersion === null || grantVersion < 1n) {
|
|
32464
|
+
return { valid: false, error: "grantVersion must be a uint256 >= 1" };
|
|
32465
|
+
}
|
|
32466
|
+
const expiresAt = toUint256(input.expiresAt);
|
|
32467
|
+
if (expiresAt === null) {
|
|
32468
|
+
return { valid: false, error: "expiresAt must be a non-negative uint256" };
|
|
31815
32469
|
}
|
|
31816
32470
|
let valid;
|
|
31817
32471
|
try {
|
|
@@ -31823,8 +32477,9 @@ async function verifyGrantRegistration(input) {
|
|
|
31823
32477
|
message: {
|
|
31824
32478
|
grantorAddress: input.grantorAddress,
|
|
31825
32479
|
granteeId: input.granteeId,
|
|
31826
|
-
|
|
31827
|
-
|
|
32480
|
+
scopes: input.scopes,
|
|
32481
|
+
grantVersion,
|
|
32482
|
+
expiresAt
|
|
31828
32483
|
},
|
|
31829
32484
|
signature: input.signature
|
|
31830
32485
|
});
|
|
@@ -31835,19 +32490,69 @@ async function verifyGrantRegistration(input) {
|
|
|
31835
32490
|
return { valid: false, error: "Grant signature does not match grantor" };
|
|
31836
32491
|
}
|
|
31837
32492
|
const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
31838
|
-
if (
|
|
32493
|
+
if (expiresAt > 0n && expiresAt < BigInt(nowSeconds)) {
|
|
31839
32494
|
return { valid: false, error: "Grant has expired" };
|
|
31840
32495
|
}
|
|
31841
|
-
if (payload.user !== void 0 && payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()) {
|
|
31842
|
-
return { valid: false, error: "Grant user does not match grantorAddress" };
|
|
31843
|
-
}
|
|
31844
32496
|
return {
|
|
31845
32497
|
valid: true,
|
|
31846
32498
|
grantorAddress: input.grantorAddress,
|
|
31847
32499
|
granteeId: input.granteeId,
|
|
31848
|
-
|
|
31849
|
-
|
|
31850
|
-
|
|
32500
|
+
scopes: input.scopes,
|
|
32501
|
+
grantVersion: grantVersion.toString(),
|
|
32502
|
+
expiresAt: expiresAt.toString()
|
|
32503
|
+
};
|
|
32504
|
+
}
|
|
32505
|
+
|
|
32506
|
+
// src/protocol/escrow-deposit.ts
|
|
32507
|
+
import { encodeFunctionData } from "viem";
|
|
32508
|
+
var ESCROW_DEPOSIT_ABI = [
|
|
32509
|
+
{
|
|
32510
|
+
type: "function",
|
|
32511
|
+
name: "depositNative",
|
|
32512
|
+
stateMutability: "payable",
|
|
32513
|
+
inputs: [{ name: "account", type: "address" }],
|
|
32514
|
+
outputs: []
|
|
32515
|
+
},
|
|
32516
|
+
{
|
|
32517
|
+
type: "function",
|
|
32518
|
+
name: "depositToken",
|
|
32519
|
+
stateMutability: "nonpayable",
|
|
32520
|
+
inputs: [
|
|
32521
|
+
{ name: "account", type: "address" },
|
|
32522
|
+
{ name: "token", type: "address" },
|
|
32523
|
+
{ name: "amount", type: "uint256" }
|
|
32524
|
+
],
|
|
32525
|
+
outputs: []
|
|
32526
|
+
}
|
|
32527
|
+
];
|
|
32528
|
+
function escrowContractAddress(config) {
|
|
32529
|
+
return config.contracts.dataPortabilityEscrow;
|
|
32530
|
+
}
|
|
32531
|
+
function encodeDepositNativeData(input) {
|
|
32532
|
+
return encodeFunctionData({
|
|
32533
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
32534
|
+
functionName: "depositNative",
|
|
32535
|
+
args: [input.account]
|
|
32536
|
+
});
|
|
32537
|
+
}
|
|
32538
|
+
function encodeDepositTokenData(input) {
|
|
32539
|
+
return encodeFunctionData({
|
|
32540
|
+
abi: ESCROW_DEPOSIT_ABI,
|
|
32541
|
+
functionName: "depositToken",
|
|
32542
|
+
args: [input.account, input.token, input.amount]
|
|
32543
|
+
});
|
|
32544
|
+
}
|
|
32545
|
+
function buildDepositNativeRequest(config, input) {
|
|
32546
|
+
return {
|
|
32547
|
+
to: escrowContractAddress(config),
|
|
32548
|
+
data: encodeDepositNativeData({ account: input.account }),
|
|
32549
|
+
value: input.amount
|
|
32550
|
+
};
|
|
32551
|
+
}
|
|
32552
|
+
function buildDepositTokenRequest(config, input) {
|
|
32553
|
+
return {
|
|
32554
|
+
to: escrowContractAddress(config),
|
|
32555
|
+
data: encodeDepositTokenData(input)
|
|
31851
32556
|
};
|
|
31852
32557
|
}
|
|
31853
32558
|
|
|
@@ -32047,6 +32752,68 @@ function createGatewayClient(baseUrl) {
|
|
|
32047
32752
|
alreadyRegistered: false
|
|
32048
32753
|
};
|
|
32049
32754
|
},
|
|
32755
|
+
async registerBuilder(params) {
|
|
32756
|
+
const res = await fetch(`${base}/v1/builders`, {
|
|
32757
|
+
method: "POST",
|
|
32758
|
+
headers: {
|
|
32759
|
+
"Content-Type": "application/json",
|
|
32760
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
32761
|
+
},
|
|
32762
|
+
body: JSON.stringify({
|
|
32763
|
+
ownerAddress: params.ownerAddress,
|
|
32764
|
+
granteeAddress: params.granteeAddress,
|
|
32765
|
+
publicKey: params.publicKey,
|
|
32766
|
+
appUrl: params.appUrl
|
|
32767
|
+
})
|
|
32768
|
+
});
|
|
32769
|
+
if (res.status === 409) {
|
|
32770
|
+
const body2 = await res.json().catch(() => ({}));
|
|
32771
|
+
return {
|
|
32772
|
+
builderId: getMutationId(
|
|
32773
|
+
body2,
|
|
32774
|
+
"builderId"
|
|
32775
|
+
),
|
|
32776
|
+
alreadyRegistered: true
|
|
32777
|
+
};
|
|
32778
|
+
}
|
|
32779
|
+
if (!res.ok) {
|
|
32780
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32781
|
+
}
|
|
32782
|
+
const body = await res.json().catch(() => ({}));
|
|
32783
|
+
return {
|
|
32784
|
+
builderId: getMutationId(body, "builderId"),
|
|
32785
|
+
alreadyRegistered: false
|
|
32786
|
+
};
|
|
32787
|
+
},
|
|
32788
|
+
async registerDataPoint(params) {
|
|
32789
|
+
const res = await fetch(`${base}/v1/data`, {
|
|
32790
|
+
method: "POST",
|
|
32791
|
+
headers: {
|
|
32792
|
+
"Content-Type": "application/json",
|
|
32793
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
32794
|
+
},
|
|
32795
|
+
body: JSON.stringify({
|
|
32796
|
+
ownerAddress: params.ownerAddress,
|
|
32797
|
+
scope: params.scope,
|
|
32798
|
+
dataHash: params.dataHash,
|
|
32799
|
+
metadataHash: params.metadataHash,
|
|
32800
|
+
expectedVersion: params.expectedVersion
|
|
32801
|
+
})
|
|
32802
|
+
});
|
|
32803
|
+
if (!res.ok) {
|
|
32804
|
+
const body2 = await res.json().catch(() => ({}));
|
|
32805
|
+
const detail = body2.error ?? res.statusText;
|
|
32806
|
+
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
32807
|
+
}
|
|
32808
|
+
const body = await res.json().catch(() => ({}));
|
|
32809
|
+
return {
|
|
32810
|
+
dataPointId: getMutationId(
|
|
32811
|
+
body,
|
|
32812
|
+
"dataPointId"
|
|
32813
|
+
),
|
|
32814
|
+
expectedVersion: body.expectedVersion
|
|
32815
|
+
};
|
|
32816
|
+
},
|
|
32050
32817
|
async registerFile(params) {
|
|
32051
32818
|
const res = await fetch(`${base}/v1/files`, {
|
|
32052
32819
|
method: "POST",
|
|
@@ -32084,8 +32851,9 @@ function createGatewayClient(baseUrl) {
|
|
|
32084
32851
|
body: JSON.stringify({
|
|
32085
32852
|
grantorAddress: params.grantorAddress,
|
|
32086
32853
|
granteeId: params.granteeId,
|
|
32087
|
-
|
|
32088
|
-
|
|
32854
|
+
scopes: params.scopes,
|
|
32855
|
+
grantVersion: params.grantVersion,
|
|
32856
|
+
expiresAt: params.expiresAt
|
|
32089
32857
|
})
|
|
32090
32858
|
});
|
|
32091
32859
|
if (res.status === 409) {
|
|
@@ -32110,13 +32878,71 @@ function createGatewayClient(baseUrl) {
|
|
|
32110
32878
|
Authorization: `Web3Signed ${params.signature}`
|
|
32111
32879
|
},
|
|
32112
32880
|
body: JSON.stringify({
|
|
32113
|
-
grantorAddress: params.grantorAddress
|
|
32881
|
+
grantorAddress: params.grantorAddress,
|
|
32882
|
+
grantVersion: params.grantVersion
|
|
32114
32883
|
})
|
|
32115
32884
|
});
|
|
32116
32885
|
if (res.status === 409) return;
|
|
32117
32886
|
if (!res.ok) {
|
|
32118
32887
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32119
32888
|
}
|
|
32889
|
+
},
|
|
32890
|
+
async getEscrowBalance(account) {
|
|
32891
|
+
const res = await fetch(`${base}/v1/escrow/balance?account=${account}`);
|
|
32892
|
+
if (!res.ok) {
|
|
32893
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32894
|
+
}
|
|
32895
|
+
return await res.json();
|
|
32896
|
+
},
|
|
32897
|
+
async submitEscrowDeposit(params) {
|
|
32898
|
+
const res = await fetch(`${base}/v1/escrow/deposit`, {
|
|
32899
|
+
method: "POST",
|
|
32900
|
+
headers: { "Content-Type": "application/json" },
|
|
32901
|
+
body: JSON.stringify({ txHash: params.txHash })
|
|
32902
|
+
});
|
|
32903
|
+
if (res.status !== 200 && res.status !== 202) {
|
|
32904
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32905
|
+
}
|
|
32906
|
+
return await res.json();
|
|
32907
|
+
},
|
|
32908
|
+
async payForOperation(params) {
|
|
32909
|
+
const body = {
|
|
32910
|
+
payerAddress: params.payerAddress,
|
|
32911
|
+
opType: params.opType,
|
|
32912
|
+
opId: params.opId,
|
|
32913
|
+
asset: params.asset,
|
|
32914
|
+
amount: params.amount,
|
|
32915
|
+
paymentNonce: params.paymentNonce
|
|
32916
|
+
};
|
|
32917
|
+
if (params.accessRecord) {
|
|
32918
|
+
body["accessRecord"] = params.accessRecord;
|
|
32919
|
+
}
|
|
32920
|
+
const res = await fetch(`${base}/v1/escrow/pay`, {
|
|
32921
|
+
method: "POST",
|
|
32922
|
+
headers: {
|
|
32923
|
+
"Content-Type": "application/json",
|
|
32924
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
32925
|
+
},
|
|
32926
|
+
body: JSON.stringify(body)
|
|
32927
|
+
});
|
|
32928
|
+
if (!res.ok) {
|
|
32929
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32930
|
+
}
|
|
32931
|
+
return await res.json();
|
|
32932
|
+
},
|
|
32933
|
+
async settle(params) {
|
|
32934
|
+
const res = await fetch(`${base}/v1/settle`, {
|
|
32935
|
+
method: "POST",
|
|
32936
|
+
headers: { "Content-Type": "application/json" },
|
|
32937
|
+
// The gateway accepts an empty body; only `limit` is recognised.
|
|
32938
|
+
// Always send a JSON body so the gateway's req.body shape parse
|
|
32939
|
+
// doesn't have to deal with an undefined.
|
|
32940
|
+
body: JSON.stringify(params ?? {})
|
|
32941
|
+
});
|
|
32942
|
+
if (!res.ok) {
|
|
32943
|
+
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
32944
|
+
}
|
|
32945
|
+
return await res.json();
|
|
32120
32946
|
}
|
|
32121
32947
|
};
|
|
32122
32948
|
}
|
|
@@ -32146,7 +32972,7 @@ var KNOWN_CODES = /* @__PURE__ */ new Set([
|
|
|
32146
32972
|
"server_not_configured",
|
|
32147
32973
|
"content_too_large"
|
|
32148
32974
|
]);
|
|
32149
|
-
function
|
|
32975
|
+
function isRecord2(value) {
|
|
32150
32976
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
32151
32977
|
}
|
|
32152
32978
|
function normalizeCode(value) {
|
|
@@ -32157,10 +32983,10 @@ function normalizeCode(value) {
|
|
|
32157
32983
|
return KNOWN_CODES.has(code) ? code : null;
|
|
32158
32984
|
}
|
|
32159
32985
|
function extractPSErrorBody(body) {
|
|
32160
|
-
if (!
|
|
32986
|
+
if (!isRecord2(body)) {
|
|
32161
32987
|
return null;
|
|
32162
32988
|
}
|
|
32163
|
-
const nested =
|
|
32989
|
+
const nested = isRecord2(body.error) ? body.error : null;
|
|
32164
32990
|
const code = normalizeCode(
|
|
32165
32991
|
nested?.errorCode ?? nested?.code ?? body.errorCode ?? body.code
|
|
32166
32992
|
);
|
|
@@ -32184,6 +33010,10 @@ async function parsePSError(response) {
|
|
|
32184
33010
|
return errorBody ? new PSError(errorBody.code, errorBody.message) : null;
|
|
32185
33011
|
}
|
|
32186
33012
|
export {
|
|
33013
|
+
ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT,
|
|
33014
|
+
ADD_DATA_TYPES,
|
|
33015
|
+
AccountPersonalServerLiteOwnerBindingError,
|
|
33016
|
+
AccountPersonalServerRegistrationError,
|
|
32187
33017
|
BUILDER_REGISTRATION_TYPES,
|
|
32188
33018
|
BlockchainError,
|
|
32189
33019
|
BrowserECIESUint8Provider as BrowserECIESProvider,
|
|
@@ -32195,8 +33025,10 @@ export {
|
|
|
32195
33025
|
DataFileEnvelopeSchema,
|
|
32196
33026
|
DropboxStorage,
|
|
32197
33027
|
ECIESError,
|
|
33028
|
+
ESCROW_DEPOSIT_ABI,
|
|
32198
33029
|
ExpiredTokenError,
|
|
32199
33030
|
FILE_REGISTRATION_TYPES,
|
|
33031
|
+
GENERIC_PAYMENT_TYPES,
|
|
32200
33032
|
GRANT_REGISTRATION_TYPES,
|
|
32201
33033
|
GRANT_REVOCATION_TYPES,
|
|
32202
33034
|
GoogleDriveStorage,
|
|
@@ -32207,8 +33039,15 @@ export {
|
|
|
32207
33039
|
IpfsStorage,
|
|
32208
33040
|
MASTER_KEY_MESSAGE,
|
|
32209
33041
|
MissingAuthError,
|
|
33042
|
+
NATIVE_VANA_ASSET,
|
|
32210
33043
|
NetworkError,
|
|
32211
33044
|
NonceError,
|
|
33045
|
+
OAuthClient,
|
|
33046
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
33047
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
33048
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
33049
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID,
|
|
33050
|
+
PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT,
|
|
32212
33051
|
PKCE_CHALLENGE_PATTERN,
|
|
32213
33052
|
PKCE_VERIFIER_PATTERN,
|
|
32214
33053
|
PSError,
|
|
@@ -32216,6 +33055,7 @@ export {
|
|
|
32216
33055
|
PersonalServerError,
|
|
32217
33056
|
PinataStorage,
|
|
32218
33057
|
R2Storage,
|
|
33058
|
+
RECORD_DATA_ACCESS_TYPES,
|
|
32219
33059
|
ReadOnlyError,
|
|
32220
33060
|
RelayerError,
|
|
32221
33061
|
SERVER_REGISTRATION_TYPES,
|
|
@@ -32230,6 +33070,12 @@ export {
|
|
|
32230
33070
|
VanaError,
|
|
32231
33071
|
VanaStorage,
|
|
32232
33072
|
assertValidPkceVerifier,
|
|
33073
|
+
buildDepositNativeRequest,
|
|
33074
|
+
buildDepositTokenRequest,
|
|
33075
|
+
buildPersonalServerLiteOwnerBindingMessage,
|
|
33076
|
+
buildPersonalServerLiteOwnerBindingSignature,
|
|
33077
|
+
buildPersonalServerRegistrationSignature,
|
|
33078
|
+
buildPersonalServerRegistrationTypedData,
|
|
32233
33079
|
buildWeb3SignedHeader,
|
|
32234
33080
|
builderRegistrationDomain,
|
|
32235
33081
|
chains,
|
|
@@ -32242,12 +33088,19 @@ export {
|
|
|
32242
33088
|
createGatewayClient,
|
|
32243
33089
|
createPlatformAdapterSafe,
|
|
32244
33090
|
createVanaStorageProvider,
|
|
33091
|
+
createViemPersonalServerLiteOwnerBindingSigner,
|
|
33092
|
+
createViemPersonalServerRegistrationSigner,
|
|
33093
|
+
dataRegistryDomain,
|
|
32245
33094
|
decryptWithPassword,
|
|
32246
33095
|
deriveMasterKey,
|
|
32247
33096
|
deriveScopeKey,
|
|
32248
33097
|
deserializeECIES,
|
|
32249
33098
|
detectPlatform,
|
|
33099
|
+
encodeDepositNativeData,
|
|
33100
|
+
encodeDepositTokenData,
|
|
32250
33101
|
encryptWithPassword,
|
|
33102
|
+
escrowContractAddress,
|
|
33103
|
+
escrowPaymentDomain,
|
|
32251
33104
|
fileRegistrationDomain,
|
|
32252
33105
|
generatePkceVerifier,
|
|
32253
33106
|
getAbi,
|
|
@@ -32267,16 +33120,20 @@ export {
|
|
|
32267
33120
|
moksha,
|
|
32268
33121
|
mokshaServices,
|
|
32269
33122
|
mokshaTestnet2 as mokshaTestnet,
|
|
32270
|
-
parseGrantRegistrationPayload,
|
|
32271
33123
|
parsePSError,
|
|
32272
33124
|
parseScope,
|
|
32273
33125
|
parseWeb3SignedHeader,
|
|
33126
|
+
personalServerRegistrationDomain,
|
|
32274
33127
|
recoverServerOwner,
|
|
33128
|
+
registerPersonalServerSignature,
|
|
32275
33129
|
scopeCoveredByGrant,
|
|
32276
33130
|
scopeMatchesPattern,
|
|
32277
33131
|
scopeToPathSegments,
|
|
32278
33132
|
serializeECIES,
|
|
32279
33133
|
serverRegistrationDomain,
|
|
33134
|
+
signPersonalServerLiteOwnerBinding,
|
|
33135
|
+
signPersonalServerLiteOwnerBindingWithAccountClient,
|
|
33136
|
+
signPersonalServerRegistrationWithAccount,
|
|
32280
33137
|
vanaMainnet2 as vanaMainnet,
|
|
32281
33138
|
verifyGrantRegistration,
|
|
32282
33139
|
verifyPkceChallenge,
|