@opendatalabs/vana-sdk 3.17.0 → 3.18.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/dist/direct/personal-server-read.cjs +20 -1
- package/dist/direct/personal-server-read.cjs.map +1 -1
- package/dist/direct/personal-server-read.js +23 -1
- package/dist/direct/personal-server-read.js.map +1 -1
- package/dist/errors.cjs +27 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +67 -0
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.browser.d.ts +2 -1
- package/dist/index.browser.js +724 -309
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +736 -311
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +2 -1
- package/dist/index.node.js +724 -309
- package/dist/index.node.js.map +4 -4
- package/dist/protocol/data-point-deletion.cjs +220 -0
- package/dist/protocol/data-point-deletion.cjs.map +1 -0
- package/dist/protocol/data-point-deletion.d.ts +180 -0
- package/dist/protocol/data-point-deletion.js +193 -0
- package/dist/protocol/data-point-deletion.js.map +1 -0
- package/dist/protocol/data-point-deletion.test.d.ts +1 -0
- package/dist/protocol/gateway.cjs +145 -32
- package/dist/protocol/gateway.cjs.map +1 -1
- package/dist/protocol/gateway.d.ts +42 -3
- package/dist/protocol/gateway.js +156 -32
- package/dist/protocol/gateway.js.map +1 -1
- package/dist/protocol/personal-server-data.cjs +20 -1
- package/dist/protocol/personal-server-data.cjs.map +1 -1
- package/dist/protocol/personal-server-data.js +23 -1
- package/dist/protocol/personal-server-data.js.map +1 -1
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/providers/vana-storage.cjs +66 -0
- package/dist/storage/providers/vana-storage.cjs.map +1 -1
- package/dist/storage/providers/vana-storage.d.ts +26 -0
- package/dist/storage/providers/vana-storage.js +66 -0
- package/dist/storage/providers/vana-storage.js.map +1 -1
- package/dist/utils/response-body.cjs +46 -0
- package/dist/utils/response-body.cjs.map +1 -0
- package/dist/utils/response-body.d.ts +26 -0
- package/dist/utils/response-body.js +20 -0
- package/dist/utils/response-body.js.map +1 -0
- package/dist/utils/response-body.test.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -1349,6 +1349,27 @@ var LineageReadError = class extends VanaError {
|
|
|
1349
1349
|
errorCode;
|
|
1350
1350
|
details;
|
|
1351
1351
|
};
|
|
1352
|
+
var DataPointDeletedError = class extends VanaError {
|
|
1353
|
+
constructor(message, details = {}) {
|
|
1354
|
+
super(message, "DATA_POINT_DELETED");
|
|
1355
|
+
this.details = details;
|
|
1356
|
+
}
|
|
1357
|
+
details;
|
|
1358
|
+
};
|
|
1359
|
+
var DataPointNotFoundError = class extends VanaError {
|
|
1360
|
+
constructor(message, details = {}) {
|
|
1361
|
+
super(message, "DATA_POINT_NOT_FOUND");
|
|
1362
|
+
this.details = details;
|
|
1363
|
+
}
|
|
1364
|
+
details;
|
|
1365
|
+
};
|
|
1366
|
+
var DataPointVersionConflictError = class extends VanaError {
|
|
1367
|
+
constructor(message, details = {}) {
|
|
1368
|
+
super(message, "DATA_POINT_VERSION_CONFLICT");
|
|
1369
|
+
this.details = details;
|
|
1370
|
+
}
|
|
1371
|
+
details;
|
|
1372
|
+
};
|
|
1352
1373
|
|
|
1353
1374
|
// src/contracts/contractController.ts
|
|
1354
1375
|
import {
|
|
@@ -29111,6 +29132,22 @@ function getProtocolNetworkChainId(network) {
|
|
|
29111
29132
|
return PROTOCOL_NETWORK_CHAIN_IDS[network];
|
|
29112
29133
|
}
|
|
29113
29134
|
|
|
29135
|
+
// src/utils/response-body.ts
|
|
29136
|
+
function isPlainObject(value) {
|
|
29137
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29138
|
+
}
|
|
29139
|
+
async function readJsonValue(res) {
|
|
29140
|
+
try {
|
|
29141
|
+
return await res.json();
|
|
29142
|
+
} catch {
|
|
29143
|
+
return null;
|
|
29144
|
+
}
|
|
29145
|
+
}
|
|
29146
|
+
async function readJsonObject(res) {
|
|
29147
|
+
const value = await readJsonValue(res);
|
|
29148
|
+
return isPlainObject(value) ? value : {};
|
|
29149
|
+
}
|
|
29150
|
+
|
|
29114
29151
|
// src/storage/providers/vana-storage.ts
|
|
29115
29152
|
var DEFAULT_ENDPOINT = "https://storage.vana.org";
|
|
29116
29153
|
var LEGACY_BLOB_PATH_PREFIX = "/v1/blobs";
|
|
@@ -29282,6 +29319,65 @@ var VanaStorage = class {
|
|
|
29282
29319
|
}
|
|
29283
29320
|
return true;
|
|
29284
29321
|
}
|
|
29322
|
+
/**
|
|
29323
|
+
* Delete every version's blob under `(owner, scope)` --
|
|
29324
|
+
* `DELETE {prefix}/{owner}/{scope}` on vana-storage, signed with the same
|
|
29325
|
+
* Web3Signed header as uploads (aud = endpoint origin, empty bodyHash).
|
|
29326
|
+
* The worker accepts the owner's own signature or a personal server the
|
|
29327
|
+
* owner registered with the gateway.
|
|
29328
|
+
*
|
|
29329
|
+
* @param ownerAddress - Must equal the provider's configured owner; a
|
|
29330
|
+
* mismatch throws before anything is signed so this wallet can never be
|
|
29331
|
+
* induced to sign a delete for another namespace.
|
|
29332
|
+
* @param scope - The scope segment, e.g. `"instagram.profile"`.
|
|
29333
|
+
*/
|
|
29334
|
+
async deleteScope(ownerAddress, scope) {
|
|
29335
|
+
if (ownerAddress.toLowerCase() !== this.ownerAddress) {
|
|
29336
|
+
throw new StorageError(
|
|
29337
|
+
`deleteScope owner '${ownerAddress}' does not match the configured owner '${this.ownerAddress}'`,
|
|
29338
|
+
"INVALID_OWNER",
|
|
29339
|
+
"vana-storage"
|
|
29340
|
+
);
|
|
29341
|
+
}
|
|
29342
|
+
if (scope.length === 0 || scope.includes("/") || isTraversalSegment(scope)) {
|
|
29343
|
+
throw new StorageError(
|
|
29344
|
+
`scope must be a single non-empty path segment, got '${scope}'`,
|
|
29345
|
+
"INVALID_SCOPE",
|
|
29346
|
+
"vana-storage"
|
|
29347
|
+
);
|
|
29348
|
+
}
|
|
29349
|
+
const path = `${this.blobPathPrefix}/${this.ownerAddress}/${encodeURIComponent(scope)}`;
|
|
29350
|
+
const header = await this.signRequest("DELETE", path);
|
|
29351
|
+
let response;
|
|
29352
|
+
try {
|
|
29353
|
+
response = await this.fetchImpl(`${this.endpoint}${path}`, {
|
|
29354
|
+
method: "DELETE",
|
|
29355
|
+
headers: { authorization: header }
|
|
29356
|
+
});
|
|
29357
|
+
} catch (cause) {
|
|
29358
|
+
throw new StorageError(
|
|
29359
|
+
`vana-storage scope delete network error: ${describe(cause)}`,
|
|
29360
|
+
"DELETE_ERROR",
|
|
29361
|
+
"vana-storage",
|
|
29362
|
+
{ cause: cause instanceof Error ? cause : void 0 }
|
|
29363
|
+
);
|
|
29364
|
+
}
|
|
29365
|
+
if (!response.ok) {
|
|
29366
|
+
const responseText = await safeText(response);
|
|
29367
|
+
throw new StorageError(
|
|
29368
|
+
`vana-storage scope delete failed: ${response.status} ${response.statusText} - ${responseText}`,
|
|
29369
|
+
"DELETE_FAILED",
|
|
29370
|
+
"vana-storage"
|
|
29371
|
+
);
|
|
29372
|
+
}
|
|
29373
|
+
const body = await readJsonObject(response);
|
|
29374
|
+
return {
|
|
29375
|
+
deleted: typeof body["deleted"] === "boolean" ? body["deleted"] : true,
|
|
29376
|
+
scope: typeof body["scope"] === "string" ? body["scope"] : scope,
|
|
29377
|
+
count: nonNegativeInteger(body["count"]) ?? 0,
|
|
29378
|
+
totalBytes: nonNegativeInteger(body["totalBytes"]) ?? 0
|
|
29379
|
+
};
|
|
29380
|
+
}
|
|
29285
29381
|
getConfig() {
|
|
29286
29382
|
return {
|
|
29287
29383
|
name: "vana-storage",
|
|
@@ -29410,6 +29506,12 @@ function encodeRelativePath(filename) {
|
|
|
29410
29506
|
}
|
|
29411
29507
|
return parts.map((p) => encodeURIComponent(p)).join("/");
|
|
29412
29508
|
}
|
|
29509
|
+
function isTraversalSegment(segment) {
|
|
29510
|
+
return segment === "." || segment === "..";
|
|
29511
|
+
}
|
|
29512
|
+
function nonNegativeInteger(value) {
|
|
29513
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
29514
|
+
}
|
|
29413
29515
|
function describe(value) {
|
|
29414
29516
|
if (value instanceof Error) return value.message;
|
|
29415
29517
|
return String(value);
|
|
@@ -32905,266 +33007,13 @@ function buildMarkDataPointUnavailableRequest(config, input) {
|
|
|
32905
33007
|
});
|
|
32906
33008
|
}
|
|
32907
33009
|
|
|
32908
|
-
// src/protocol/data-
|
|
32909
|
-
import {
|
|
32910
|
-
|
|
32911
|
-
|
|
32912
|
-
|
|
32913
|
-
|
|
32914
|
-
|
|
32915
|
-
collectedAt: z.string().datetime(),
|
|
32916
|
-
data: z.record(z.string(), z.unknown())
|
|
32917
|
-
});
|
|
32918
|
-
function createDataFileEnvelope(scope, collectedAt, data, schemaUrl, schemaId) {
|
|
32919
|
-
return {
|
|
32920
|
-
...schemaUrl !== void 0 && { $schema: schemaUrl },
|
|
32921
|
-
...schemaId !== void 0 && { schemaId },
|
|
32922
|
-
version: "1.0",
|
|
32923
|
-
scope,
|
|
32924
|
-
collectedAt,
|
|
32925
|
-
data
|
|
32926
|
-
};
|
|
32927
|
-
}
|
|
32928
|
-
var IngestResponseSchema = z.object({
|
|
32929
|
-
scope: z.string(),
|
|
32930
|
-
collectedAt: z.string().datetime(),
|
|
32931
|
-
status: z.enum(["stored", "syncing"])
|
|
32932
|
-
});
|
|
32933
|
-
|
|
32934
|
-
// src/protocol/personal-server-data.ts
|
|
32935
|
-
function personalServerDataReadPath(scope) {
|
|
32936
|
-
return `/v1/data/${encodeURIComponent(scope)}`;
|
|
32937
|
-
}
|
|
32938
|
-
async function buildPersonalServerDataReadRequest(params) {
|
|
32939
|
-
const path = personalServerDataReadPath(params.scope);
|
|
32940
|
-
const baseUrl = params.personalServerUrl.replace(/\/+$/, "");
|
|
32941
|
-
const audience = params.audience ?? baseUrl;
|
|
32942
|
-
const headers = new Headers(params.headers);
|
|
32943
|
-
headers.set(
|
|
32944
|
-
"Authorization",
|
|
32945
|
-
await buildWeb3SignedHeader({
|
|
32946
|
-
aud: audience,
|
|
32947
|
-
grantId: params.grantId,
|
|
32948
|
-
method: "GET",
|
|
32949
|
-
signMessage: params.signMessage,
|
|
32950
|
-
uri: path
|
|
32951
|
-
})
|
|
32952
|
-
);
|
|
32953
|
-
return new Request(`${baseUrl}${path}`, {
|
|
32954
|
-
headers,
|
|
32955
|
-
method: "GET"
|
|
32956
|
-
});
|
|
32957
|
-
}
|
|
32958
|
-
async function readPersonalServerData(params) {
|
|
32959
|
-
const fetchFn = params.fetch ?? globalThis.fetch;
|
|
32960
|
-
if (fetchFn === void 0) {
|
|
32961
|
-
throw new Error("No fetch implementation available");
|
|
32962
|
-
}
|
|
32963
|
-
const request = await buildPersonalServerDataReadRequest(params);
|
|
32964
|
-
const response = await fetchFn(request);
|
|
32965
|
-
if (!response.ok) {
|
|
32966
|
-
throw new Error(
|
|
32967
|
-
`Personal Server data read failed: ${response.status} ${response.statusText}`
|
|
32968
|
-
);
|
|
32969
|
-
}
|
|
32970
|
-
return DataFileEnvelopeSchema.parse(await response.json());
|
|
32971
|
-
}
|
|
32972
|
-
|
|
32973
|
-
// src/protocol/scopes.ts
|
|
32974
|
-
import { z as z2 } from "zod";
|
|
32975
|
-
var SOURCE_RE = /^[a-z0-9][a-z0-9_]*$/;
|
|
32976
|
-
var TAIL_SEGMENT_RE = /^[a-zA-Z0-9][a-zA-Z0-9_]*$/;
|
|
32977
|
-
var ScopeSchema = z2.string().refine(
|
|
32978
|
-
(scope) => {
|
|
32979
|
-
const parts = scope.split(".");
|
|
32980
|
-
if (parts.length < 2 || parts.length > 3) return false;
|
|
32981
|
-
const [source, ...tail] = parts;
|
|
32982
|
-
return SOURCE_RE.test(source) && tail.every((part) => TAIL_SEGMENT_RE.test(part));
|
|
32983
|
-
},
|
|
32984
|
-
{
|
|
32985
|
-
message: "Scope must be {source}.{category}[.{subcategory}]; source lowercase, tail may keep the historical camelCase form (e.g. spotify.savedTracks)"
|
|
32986
|
-
}
|
|
32987
|
-
);
|
|
32988
|
-
function parseScope(scope) {
|
|
32989
|
-
const validated = ScopeSchema.parse(scope);
|
|
32990
|
-
const parts = validated.split(".");
|
|
32991
|
-
return {
|
|
32992
|
-
source: parts[0],
|
|
32993
|
-
category: parts[1],
|
|
32994
|
-
subcategory: parts[2],
|
|
32995
|
-
raw: validated
|
|
32996
|
-
};
|
|
32997
|
-
}
|
|
32998
|
-
function scopeToPathSegments(scope) {
|
|
32999
|
-
const parsed = parseScope(scope);
|
|
33000
|
-
const segments = [parsed.source, parsed.category];
|
|
33001
|
-
if (parsed.subcategory) {
|
|
33002
|
-
segments.push(parsed.subcategory);
|
|
33003
|
-
}
|
|
33004
|
-
return segments;
|
|
33005
|
-
}
|
|
33006
|
-
function scopeMatchesPattern(requestedScope, grantPattern) {
|
|
33007
|
-
if (grantPattern === "*") return true;
|
|
33008
|
-
if (grantPattern.endsWith(".*")) {
|
|
33009
|
-
const prefix = grantPattern.slice(0, -1);
|
|
33010
|
-
return requestedScope.startsWith(prefix);
|
|
33011
|
-
}
|
|
33012
|
-
return requestedScope === grantPattern;
|
|
33013
|
-
}
|
|
33014
|
-
function scopeCoveredByGrant(requestedScope, grantedScopes) {
|
|
33015
|
-
return grantedScopes.some(
|
|
33016
|
-
(pattern) => scopeMatchesPattern(requestedScope, pattern)
|
|
33017
|
-
);
|
|
33018
|
-
}
|
|
33019
|
-
|
|
33020
|
-
// src/protocol/scope-actions.ts
|
|
33021
|
-
var SCOPE_ACTIONS = ["read", "write"];
|
|
33022
|
-
var InvalidScopeEntryError = class extends Error {
|
|
33023
|
-
/** The offending entry, verbatim (unknown because it may not be a string). */
|
|
33024
|
-
entry;
|
|
33025
|
-
constructor(entry, reason) {
|
|
33026
|
-
super(`Invalid scope entry ${describeValue(entry)}: ${reason}`);
|
|
33027
|
-
this.name = "InvalidScopeEntryError";
|
|
33028
|
-
this.entry = entry;
|
|
33029
|
-
}
|
|
33030
|
-
};
|
|
33031
|
-
var OPERATION_SEPARATOR = ":";
|
|
33032
|
-
function describeValue(value) {
|
|
33033
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
33034
|
-
if (value === null) return "null";
|
|
33035
|
-
return `[${typeof value}]`;
|
|
33036
|
-
}
|
|
33037
|
-
var OPERATION_BY_PREFIX = {
|
|
33038
|
-
write: "write"
|
|
33039
|
-
};
|
|
33040
|
-
function assertScopePart(entry, scope) {
|
|
33041
|
-
if (scope.length === 0) {
|
|
33042
|
-
throw new InvalidScopeEntryError(entry, "scope part is empty");
|
|
33043
|
-
}
|
|
33044
|
-
if (scope.includes(OPERATION_SEPARATOR)) {
|
|
33045
|
-
throw new InvalidScopeEntryError(
|
|
33046
|
-
entry,
|
|
33047
|
-
`scope part must not contain "${OPERATION_SEPARATOR}"`
|
|
33048
|
-
);
|
|
33049
|
-
}
|
|
33050
|
-
}
|
|
33051
|
-
function parseScopeEntry(entry) {
|
|
33052
|
-
const raw = entry;
|
|
33053
|
-
if (typeof raw !== "string") {
|
|
33054
|
-
throw new InvalidScopeEntryError(raw, "entry must be a string");
|
|
33055
|
-
}
|
|
33056
|
-
const separatorIndex = entry.indexOf(OPERATION_SEPARATOR);
|
|
33057
|
-
if (separatorIndex === -1) {
|
|
33058
|
-
assertScopePart(entry, entry);
|
|
33059
|
-
return { scope: entry, action: "read" };
|
|
33060
|
-
}
|
|
33061
|
-
const prefix = entry.slice(0, separatorIndex);
|
|
33062
|
-
const scope = entry.slice(separatorIndex + 1);
|
|
33063
|
-
const action = Object.hasOwn(OPERATION_BY_PREFIX, prefix) ? OPERATION_BY_PREFIX[prefix] : void 0;
|
|
33064
|
-
if (action === void 0) {
|
|
33065
|
-
throw new InvalidScopeEntryError(
|
|
33066
|
-
entry,
|
|
33067
|
-
`unknown operation "${prefix}" (known: ${Object.keys(OPERATION_BY_PREFIX).join(", ")}; read has no prefix)`
|
|
33068
|
-
);
|
|
33069
|
-
}
|
|
33070
|
-
assertScopePart(entry, scope);
|
|
33071
|
-
return { scope, action };
|
|
33072
|
-
}
|
|
33073
|
-
function formatScopeEntry(parsed) {
|
|
33074
|
-
const { scope, action } = parsed;
|
|
33075
|
-
assertScopePart(scope, scope);
|
|
33076
|
-
if (action === "read") return scope;
|
|
33077
|
-
const prefix = Object.entries(OPERATION_BY_PREFIX).find(
|
|
33078
|
-
([, candidate]) => candidate === action
|
|
33079
|
-
)?.[0];
|
|
33080
|
-
if (prefix === void 0) {
|
|
33081
|
-
throw new InvalidScopeEntryError(
|
|
33082
|
-
scope,
|
|
33083
|
-
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33084
|
-
);
|
|
33085
|
-
}
|
|
33086
|
-
return `${prefix}${OPERATION_SEPARATOR}${scope}`;
|
|
33087
|
-
}
|
|
33088
|
-
function compareScopes(a, b) {
|
|
33089
|
-
if (a < b) return -1;
|
|
33090
|
-
if (a > b) return 1;
|
|
33091
|
-
return 0;
|
|
33092
|
-
}
|
|
33093
|
-
function sortActions(actions) {
|
|
33094
|
-
const present = new Set(actions);
|
|
33095
|
-
return SCOPE_ACTIONS.filter((action) => present.has(action));
|
|
33096
|
-
}
|
|
33097
|
-
function grantPermissions(scopes) {
|
|
33098
|
-
const byScope = /* @__PURE__ */ new Map();
|
|
33099
|
-
for (const entry of scopes) {
|
|
33100
|
-
const { scope, action } = parseScopeEntry(entry);
|
|
33101
|
-
let actions = byScope.get(scope);
|
|
33102
|
-
if (actions === void 0) {
|
|
33103
|
-
actions = /* @__PURE__ */ new Set();
|
|
33104
|
-
byScope.set(scope, actions);
|
|
33105
|
-
}
|
|
33106
|
-
actions.add(action);
|
|
33107
|
-
}
|
|
33108
|
-
return [...byScope.keys()].sort(compareScopes).map((scope) => ({
|
|
33109
|
-
scope,
|
|
33110
|
-
actions: sortActions(byScope.get(scope) ?? [])
|
|
33111
|
-
}));
|
|
33112
|
-
}
|
|
33113
|
-
function permissionsToScopes(permissions) {
|
|
33114
|
-
const byScope = /* @__PURE__ */ new Map();
|
|
33115
|
-
for (const { scope, actions } of permissions) {
|
|
33116
|
-
let merged = byScope.get(scope);
|
|
33117
|
-
if (merged === void 0) {
|
|
33118
|
-
merged = /* @__PURE__ */ new Set();
|
|
33119
|
-
byScope.set(scope, merged);
|
|
33120
|
-
}
|
|
33121
|
-
for (const action of actions) {
|
|
33122
|
-
if (!SCOPE_ACTIONS.includes(action)) {
|
|
33123
|
-
throw new InvalidScopeEntryError(
|
|
33124
|
-
scope,
|
|
33125
|
-
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33126
|
-
);
|
|
33127
|
-
}
|
|
33128
|
-
merged.add(action);
|
|
33129
|
-
}
|
|
33130
|
-
}
|
|
33131
|
-
const entries = [];
|
|
33132
|
-
for (const scope of [...byScope.keys()].sort(compareScopes)) {
|
|
33133
|
-
for (const action of sortActions(byScope.get(scope) ?? [])) {
|
|
33134
|
-
entries.push(formatScopeEntry({ scope, action }));
|
|
33135
|
-
}
|
|
33136
|
-
}
|
|
33137
|
-
return entries;
|
|
33138
|
-
}
|
|
33139
|
-
function hasAction(scopes, scope, action) {
|
|
33140
|
-
if (scope.includes(OPERATION_SEPARATOR)) return false;
|
|
33141
|
-
for (const entry of scopes) {
|
|
33142
|
-
let parsed;
|
|
33143
|
-
try {
|
|
33144
|
-
parsed = parseScopeEntry(entry);
|
|
33145
|
-
} catch (error) {
|
|
33146
|
-
if (error instanceof InvalidScopeEntryError) continue;
|
|
33147
|
-
throw error;
|
|
33148
|
-
}
|
|
33149
|
-
if (parsed.action === action && scopeMatchesPattern(scope, parsed.scope)) {
|
|
33150
|
-
return true;
|
|
33151
|
-
}
|
|
33152
|
-
}
|
|
33153
|
-
return false;
|
|
33154
|
-
}
|
|
33155
|
-
function tryGrantPermissions(scopes) {
|
|
33156
|
-
try {
|
|
33157
|
-
return grantPermissions(scopes);
|
|
33158
|
-
} catch (error) {
|
|
33159
|
-
if (error instanceof InvalidScopeEntryError) return void 0;
|
|
33160
|
-
throw error;
|
|
33161
|
-
}
|
|
33162
|
-
}
|
|
33163
|
-
|
|
33164
|
-
// src/protocol/personal-server-write.ts
|
|
33165
|
-
import { sha256 as sha2565 } from "@noble/hashes/sha2";
|
|
33166
|
-
import { bytesToHex as bytesToHex2, isAddress as isAddress5 } from "viem";
|
|
33167
|
-
import { z as z4 } from "zod";
|
|
33010
|
+
// src/protocol/data-point-deletion.ts
|
|
33011
|
+
import {
|
|
33012
|
+
isAddress as isAddress5,
|
|
33013
|
+
keccak256 as keccak2562,
|
|
33014
|
+
maxUint256,
|
|
33015
|
+
stringToBytes as stringToBytes3
|
|
33016
|
+
} from "viem";
|
|
33168
33017
|
|
|
33169
33018
|
// src/protocol/lineage.ts
|
|
33170
33019
|
import {
|
|
@@ -33172,7 +33021,7 @@ import {
|
|
|
33172
33021
|
isAddress as isAddress4,
|
|
33173
33022
|
keccak256
|
|
33174
33023
|
} from "viem";
|
|
33175
|
-
import { z
|
|
33024
|
+
import { z } from "zod";
|
|
33176
33025
|
|
|
33177
33026
|
// src/protocol/personal-server-error-body.ts
|
|
33178
33027
|
function isRecord2(value) {
|
|
@@ -33264,10 +33113,10 @@ function deriveDataPointId(ownerAddress, scope) {
|
|
|
33264
33113
|
)
|
|
33265
33114
|
);
|
|
33266
33115
|
}
|
|
33267
|
-
var DataPointIdSchema =
|
|
33116
|
+
var DataPointIdSchema = z.string().regex(DATA_POINT_ID_PATTERN).transform((value) => value.toLowerCase());
|
|
33268
33117
|
var VERSION_PATTERN = /^[1-9]\d*$/;
|
|
33269
33118
|
var NODE_VERSION_PATTERN = /^(0|[1-9]\d*)$/;
|
|
33270
|
-
var VersionSchema =
|
|
33119
|
+
var VersionSchema = z.union([z.string(), z.number()]).transform(String).refine((value) => NODE_VERSION_PATTERN.test(value), {
|
|
33271
33120
|
message: "version must be a decimal integer"
|
|
33272
33121
|
});
|
|
33273
33122
|
var ViewVersionSchema = VersionSchema.refine(
|
|
@@ -33291,41 +33140,41 @@ function assertDerivedScopeNaming(derivedScope, sourceScopes) {
|
|
|
33291
33140
|
}
|
|
33292
33141
|
}
|
|
33293
33142
|
}
|
|
33294
|
-
var LineageNodeSchema =
|
|
33143
|
+
var LineageNodeSchema = z.object({
|
|
33295
33144
|
dataPointId: DataPointIdSchema,
|
|
33296
|
-
scope:
|
|
33145
|
+
scope: z.string(),
|
|
33297
33146
|
/**
|
|
33298
33147
|
* The node's current version, decimal string; `"0"` for a source that no
|
|
33299
33148
|
* longer resolves to a registered data point.
|
|
33300
33149
|
*/
|
|
33301
33150
|
version: VersionSchema,
|
|
33302
33151
|
/** The node's tombstone time, or `null` when live. */
|
|
33303
|
-
deletedAt:
|
|
33152
|
+
deletedAt: z.string().nullable()
|
|
33304
33153
|
});
|
|
33305
|
-
var RedactedLineageNodeSchema =
|
|
33154
|
+
var RedactedLineageNodeSchema = z.object({
|
|
33306
33155
|
dataPointId: DataPointIdSchema,
|
|
33307
|
-
redacted:
|
|
33156
|
+
redacted: z.literal(true)
|
|
33308
33157
|
});
|
|
33309
|
-
var LineageEntrySchema =
|
|
33158
|
+
var LineageEntrySchema = z.union([
|
|
33310
33159
|
RedactedLineageNodeSchema,
|
|
33311
33160
|
LineageNodeSchema
|
|
33312
33161
|
]);
|
|
33313
|
-
var LineageGraphSchema =
|
|
33162
|
+
var LineageGraphSchema = z.object({
|
|
33314
33163
|
dataPointId: DataPointIdSchema,
|
|
33315
33164
|
/** The data point owner; every node in the view belongs to it. */
|
|
33316
|
-
ownerAddress:
|
|
33317
|
-
scope:
|
|
33165
|
+
ownerAddress: z.string().optional(),
|
|
33166
|
+
scope: z.string(),
|
|
33318
33167
|
/**
|
|
33319
33168
|
* The derived record's version whose lineage is shown: the requested one,
|
|
33320
33169
|
* else the current one, else (current is a tombstone) the last version
|
|
33321
33170
|
* that carried lineage.
|
|
33322
33171
|
*/
|
|
33323
33172
|
version: ViewVersionSchema,
|
|
33324
|
-
deletedAt:
|
|
33325
|
-
sources:
|
|
33326
|
-
derivatives:
|
|
33173
|
+
deletedAt: z.string().nullable(),
|
|
33174
|
+
sources: z.array(LineageEntrySchema),
|
|
33175
|
+
derivatives: z.array(LineageEntrySchema),
|
|
33327
33176
|
/** `true` when `derivatives` was cut at the server's cap (1000). */
|
|
33328
|
-
derivativesTruncated:
|
|
33177
|
+
derivativesTruncated: z.boolean().optional()
|
|
33329
33178
|
});
|
|
33330
33179
|
function isRedactedLineageNode(entry) {
|
|
33331
33180
|
return "redacted" in entry && entry.redacted === true;
|
|
@@ -33470,7 +33319,449 @@ function getLineage(params) {
|
|
|
33470
33319
|
return "personalServerUrl" in params ? getPersonalServerLineage(params) : getGatewayLineage(params);
|
|
33471
33320
|
}
|
|
33472
33321
|
|
|
33322
|
+
// src/protocol/data-point-deletion.ts
|
|
33323
|
+
var TOMBSTONE_DATA_HASH_PREIMAGE = "vana.data-point.tombstone.v1";
|
|
33324
|
+
var TOMBSTONE_METADATA_HASH_PREIMAGE = "vana.data-point.tombstone.metadata.v1";
|
|
33325
|
+
var TOMBSTONE_DATA_HASH = "0x30c45ee72fe56d1927701316925ab7ceacd3b6f9267061735d59396f075c6222";
|
|
33326
|
+
var TOMBSTONE_METADATA_HASH = "0xc5255a141acd6a2ae55971b62c0a85977c2511989dc114ad2abc2b7644f57d90";
|
|
33327
|
+
function computeTombstoneHash(preimage) {
|
|
33328
|
+
return keccak2562(stringToBytes3(preimage));
|
|
33329
|
+
}
|
|
33330
|
+
function isTombstoneHashes(dataHash, metadataHash) {
|
|
33331
|
+
return typeof dataHash === "string" && typeof metadataHash === "string" && dataHash.toLowerCase() === TOMBSTONE_DATA_HASH && metadataHash.toLowerCase() === TOMBSTONE_METADATA_HASH;
|
|
33332
|
+
}
|
|
33333
|
+
function isDataPointTombstone(value) {
|
|
33334
|
+
if (!isPlainObject(value)) return false;
|
|
33335
|
+
if (typeof value["deletedAt"] === "string") return true;
|
|
33336
|
+
return isTombstoneHashes(
|
|
33337
|
+
typeof value["dataHash"] === "string" ? value["dataHash"] : void 0,
|
|
33338
|
+
typeof value["metadataHash"] === "string" ? value["metadataHash"] : void 0
|
|
33339
|
+
);
|
|
33340
|
+
}
|
|
33341
|
+
function tombstoneDeletedAt(value) {
|
|
33342
|
+
if (!isPlainObject(value)) return null;
|
|
33343
|
+
const deletedAt = value["deletedAt"];
|
|
33344
|
+
return typeof deletedAt === "string" ? deletedAt : null;
|
|
33345
|
+
}
|
|
33346
|
+
function assertAddress4(value, name) {
|
|
33347
|
+
if (!isAddress5(value)) {
|
|
33348
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
33349
|
+
}
|
|
33350
|
+
}
|
|
33351
|
+
function assertUint256(value, name) {
|
|
33352
|
+
if (value < 0n || value > maxUint256) {
|
|
33353
|
+
throw new Error(`${name} must fit in uint256, got ${value}`);
|
|
33354
|
+
}
|
|
33355
|
+
}
|
|
33356
|
+
function getAccountAddress3(account) {
|
|
33357
|
+
if (!account) return void 0;
|
|
33358
|
+
return typeof account === "string" ? account : account.address;
|
|
33359
|
+
}
|
|
33360
|
+
function isDataPointDeletionSigner(source) {
|
|
33361
|
+
return "address" in source && typeof source.signTypedData === "function";
|
|
33362
|
+
}
|
|
33363
|
+
function createViemDataPointDeletionSigner(source, options = {}) {
|
|
33364
|
+
if (isDataPointDeletionSigner(source)) {
|
|
33365
|
+
return source;
|
|
33366
|
+
}
|
|
33367
|
+
const accountAddress2 = getAccountAddress3(options.account) ?? getAccountAddress3(source.account);
|
|
33368
|
+
if (accountAddress2) {
|
|
33369
|
+
return {
|
|
33370
|
+
address: accountAddress2,
|
|
33371
|
+
signTypedData: (typedData) => source.signTypedData({
|
|
33372
|
+
...typedData,
|
|
33373
|
+
account: options.account ?? source.account ?? accountAddress2
|
|
33374
|
+
})
|
|
33375
|
+
};
|
|
33376
|
+
}
|
|
33377
|
+
throw new Error(
|
|
33378
|
+
"Viem wallet client requires an account option or account property"
|
|
33379
|
+
);
|
|
33380
|
+
}
|
|
33381
|
+
function buildDataPointDeletionTypedData(input) {
|
|
33382
|
+
assertAddress4(input.ownerAddress, "ownerAddress");
|
|
33383
|
+
if (input.scope.length === 0) {
|
|
33384
|
+
throw new Error("scope must be a non-empty string");
|
|
33385
|
+
}
|
|
33386
|
+
if (input.expectedVersion <= 0n) {
|
|
33387
|
+
throw new Error("expectedVersion must be a positive version number");
|
|
33388
|
+
}
|
|
33389
|
+
assertUint256(input.expectedVersion, "expectedVersion");
|
|
33390
|
+
return {
|
|
33391
|
+
domain: dataRegistryDomain(input.config),
|
|
33392
|
+
types: ADD_DATA_TYPES,
|
|
33393
|
+
primaryType: "AddData",
|
|
33394
|
+
message: {
|
|
33395
|
+
ownerAddress: input.ownerAddress,
|
|
33396
|
+
scope: input.scope,
|
|
33397
|
+
dataHash: TOMBSTONE_DATA_HASH,
|
|
33398
|
+
metadataHash: TOMBSTONE_METADATA_HASH,
|
|
33399
|
+
expectedVersion: input.expectedVersion
|
|
33400
|
+
}
|
|
33401
|
+
};
|
|
33402
|
+
}
|
|
33403
|
+
async function buildDataPointDeletionSignature(input) {
|
|
33404
|
+
const typedData = buildDataPointDeletionTypedData({
|
|
33405
|
+
ownerAddress: input.signer.address,
|
|
33406
|
+
scope: input.scope,
|
|
33407
|
+
expectedVersion: input.expectedVersion,
|
|
33408
|
+
config: input.config
|
|
33409
|
+
});
|
|
33410
|
+
const signature = await input.signer.signTypedData(typedData);
|
|
33411
|
+
return {
|
|
33412
|
+
signature,
|
|
33413
|
+
signerAddress: input.signer.address,
|
|
33414
|
+
typedData
|
|
33415
|
+
};
|
|
33416
|
+
}
|
|
33417
|
+
function toError(value) {
|
|
33418
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
33419
|
+
}
|
|
33420
|
+
function parseExpectedVersion(value) {
|
|
33421
|
+
if (typeof value !== "string" || !/^\d+$/.test(value)) {
|
|
33422
|
+
throw new Error(
|
|
33423
|
+
`Gateway returned a malformed expectedVersion: ${JSON.stringify(value)}`
|
|
33424
|
+
);
|
|
33425
|
+
}
|
|
33426
|
+
const parsed = BigInt(value);
|
|
33427
|
+
assertUint256(parsed, "Gateway expectedVersion");
|
|
33428
|
+
return parsed;
|
|
33429
|
+
}
|
|
33430
|
+
async function deleteDataPoint(input) {
|
|
33431
|
+
const ownerAddress = input.signer.address;
|
|
33432
|
+
const dataPointId = deriveDataPointId(ownerAddress, input.scope);
|
|
33433
|
+
let currentVersion = input.currentVersion;
|
|
33434
|
+
if (currentVersion === void 0) {
|
|
33435
|
+
const record = await input.gateway.getDataPoint(dataPointId);
|
|
33436
|
+
if (record === null) {
|
|
33437
|
+
throw new DataPointNotFoundError(
|
|
33438
|
+
`No data point registered for scope '${input.scope}' owned by ${ownerAddress}`,
|
|
33439
|
+
{ dataPointId, scope: input.scope, ownerAddress }
|
|
33440
|
+
);
|
|
33441
|
+
}
|
|
33442
|
+
if (isDataPointTombstone(record)) {
|
|
33443
|
+
throw new DataPointDeletedError(
|
|
33444
|
+
`Data point ${dataPointId} (scope '${input.scope}') is already deleted`,
|
|
33445
|
+
{
|
|
33446
|
+
dataPointId,
|
|
33447
|
+
scope: input.scope,
|
|
33448
|
+
ownerAddress,
|
|
33449
|
+
deletedAt: tombstoneDeletedAt(record)
|
|
33450
|
+
}
|
|
33451
|
+
);
|
|
33452
|
+
}
|
|
33453
|
+
currentVersion = parseExpectedVersion(record.expectedVersion);
|
|
33454
|
+
}
|
|
33455
|
+
if (currentVersion < 0n || currentVersion >= maxUint256) {
|
|
33456
|
+
throw new Error(
|
|
33457
|
+
`currentVersion ${currentVersion} cannot be incremented to a uint256 tombstone version`
|
|
33458
|
+
);
|
|
33459
|
+
}
|
|
33460
|
+
const tombstoneVersion = currentVersion + 1n;
|
|
33461
|
+
const signed = await buildDataPointDeletionSignature({
|
|
33462
|
+
signer: input.signer,
|
|
33463
|
+
scope: input.scope,
|
|
33464
|
+
expectedVersion: tombstoneVersion,
|
|
33465
|
+
config: input.config
|
|
33466
|
+
});
|
|
33467
|
+
const tombstone = await input.gateway.deleteDataPoint({
|
|
33468
|
+
ownerAddress,
|
|
33469
|
+
scope: input.scope,
|
|
33470
|
+
expectedVersion: tombstoneVersion.toString(),
|
|
33471
|
+
signature: signed.signature
|
|
33472
|
+
});
|
|
33473
|
+
const base = {
|
|
33474
|
+
dataPointId,
|
|
33475
|
+
ownerAddress,
|
|
33476
|
+
scope: input.scope,
|
|
33477
|
+
version: tombstoneVersion.toString(),
|
|
33478
|
+
signature: signed.signature,
|
|
33479
|
+
tombstone
|
|
33480
|
+
};
|
|
33481
|
+
try {
|
|
33482
|
+
const storage = await input.storage.deleteScope(ownerAddress, input.scope);
|
|
33483
|
+
return { ...base, status: "deleted", storage };
|
|
33484
|
+
} catch (cause) {
|
|
33485
|
+
return { ...base, status: "partial", storageError: toError(cause) };
|
|
33486
|
+
}
|
|
33487
|
+
}
|
|
33488
|
+
|
|
33489
|
+
// src/protocol/data-file.ts
|
|
33490
|
+
import { z as z2 } from "zod";
|
|
33491
|
+
var DataFileEnvelopeSchema = z2.object({
|
|
33492
|
+
$schema: z2.string().url().optional(),
|
|
33493
|
+
version: z2.literal("1.0"),
|
|
33494
|
+
scope: z2.string(),
|
|
33495
|
+
schemaId: z2.string().optional(),
|
|
33496
|
+
collectedAt: z2.string().datetime(),
|
|
33497
|
+
data: z2.record(z2.string(), z2.unknown())
|
|
33498
|
+
});
|
|
33499
|
+
function createDataFileEnvelope(scope, collectedAt, data, schemaUrl, schemaId) {
|
|
33500
|
+
return {
|
|
33501
|
+
...schemaUrl !== void 0 && { $schema: schemaUrl },
|
|
33502
|
+
...schemaId !== void 0 && { schemaId },
|
|
33503
|
+
version: "1.0",
|
|
33504
|
+
scope,
|
|
33505
|
+
collectedAt,
|
|
33506
|
+
data
|
|
33507
|
+
};
|
|
33508
|
+
}
|
|
33509
|
+
var IngestResponseSchema = z2.object({
|
|
33510
|
+
scope: z2.string(),
|
|
33511
|
+
collectedAt: z2.string().datetime(),
|
|
33512
|
+
status: z2.enum(["stored", "syncing"])
|
|
33513
|
+
});
|
|
33514
|
+
|
|
33515
|
+
// src/protocol/personal-server-data.ts
|
|
33516
|
+
function personalServerDataReadPath(scope) {
|
|
33517
|
+
return `/v1/data/${encodeURIComponent(scope)}`;
|
|
33518
|
+
}
|
|
33519
|
+
async function buildPersonalServerDataReadRequest(params) {
|
|
33520
|
+
const path = personalServerDataReadPath(params.scope);
|
|
33521
|
+
const baseUrl = params.personalServerUrl.replace(/\/+$/, "");
|
|
33522
|
+
const audience = params.audience ?? baseUrl;
|
|
33523
|
+
const headers = new Headers(params.headers);
|
|
33524
|
+
headers.set(
|
|
33525
|
+
"Authorization",
|
|
33526
|
+
await buildWeb3SignedHeader({
|
|
33527
|
+
aud: audience,
|
|
33528
|
+
grantId: params.grantId,
|
|
33529
|
+
method: "GET",
|
|
33530
|
+
signMessage: params.signMessage,
|
|
33531
|
+
uri: path
|
|
33532
|
+
})
|
|
33533
|
+
);
|
|
33534
|
+
return new Request(`${baseUrl}${path}`, {
|
|
33535
|
+
headers,
|
|
33536
|
+
method: "GET"
|
|
33537
|
+
});
|
|
33538
|
+
}
|
|
33539
|
+
async function readPersonalServerData(params) {
|
|
33540
|
+
const fetchFn = params.fetch ?? globalThis.fetch;
|
|
33541
|
+
if (fetchFn === void 0) {
|
|
33542
|
+
throw new Error("No fetch implementation available");
|
|
33543
|
+
}
|
|
33544
|
+
const request = await buildPersonalServerDataReadRequest(params);
|
|
33545
|
+
const response = await fetchFn(request);
|
|
33546
|
+
if (response.status === 410) {
|
|
33547
|
+
throw new DataPointDeletedError(
|
|
33548
|
+
`Personal Server scope '${params.scope}' has been deleted`,
|
|
33549
|
+
{
|
|
33550
|
+
scope: params.scope,
|
|
33551
|
+
deletedAt: tombstoneDeletedAt(await readJsonValue(response))
|
|
33552
|
+
}
|
|
33553
|
+
);
|
|
33554
|
+
}
|
|
33555
|
+
if (!response.ok) {
|
|
33556
|
+
throw new Error(
|
|
33557
|
+
`Personal Server data read failed: ${response.status} ${response.statusText}`
|
|
33558
|
+
);
|
|
33559
|
+
}
|
|
33560
|
+
const body = await response.json();
|
|
33561
|
+
if (isDataPointTombstone(body)) {
|
|
33562
|
+
throw new DataPointDeletedError(
|
|
33563
|
+
`Personal Server scope '${params.scope}' has been deleted`,
|
|
33564
|
+
{ scope: params.scope, deletedAt: tombstoneDeletedAt(body) }
|
|
33565
|
+
);
|
|
33566
|
+
}
|
|
33567
|
+
return DataFileEnvelopeSchema.parse(body);
|
|
33568
|
+
}
|
|
33569
|
+
|
|
33570
|
+
// src/protocol/scopes.ts
|
|
33571
|
+
import { z as z3 } from "zod";
|
|
33572
|
+
var SOURCE_RE = /^[a-z0-9][a-z0-9_]*$/;
|
|
33573
|
+
var TAIL_SEGMENT_RE = /^[a-zA-Z0-9][a-zA-Z0-9_]*$/;
|
|
33574
|
+
var ScopeSchema = z3.string().refine(
|
|
33575
|
+
(scope) => {
|
|
33576
|
+
const parts = scope.split(".");
|
|
33577
|
+
if (parts.length < 2 || parts.length > 3) return false;
|
|
33578
|
+
const [source, ...tail] = parts;
|
|
33579
|
+
return SOURCE_RE.test(source) && tail.every((part) => TAIL_SEGMENT_RE.test(part));
|
|
33580
|
+
},
|
|
33581
|
+
{
|
|
33582
|
+
message: "Scope must be {source}.{category}[.{subcategory}]; source lowercase, tail may keep the historical camelCase form (e.g. spotify.savedTracks)"
|
|
33583
|
+
}
|
|
33584
|
+
);
|
|
33585
|
+
function parseScope(scope) {
|
|
33586
|
+
const validated = ScopeSchema.parse(scope);
|
|
33587
|
+
const parts = validated.split(".");
|
|
33588
|
+
return {
|
|
33589
|
+
source: parts[0],
|
|
33590
|
+
category: parts[1],
|
|
33591
|
+
subcategory: parts[2],
|
|
33592
|
+
raw: validated
|
|
33593
|
+
};
|
|
33594
|
+
}
|
|
33595
|
+
function scopeToPathSegments(scope) {
|
|
33596
|
+
const parsed = parseScope(scope);
|
|
33597
|
+
const segments = [parsed.source, parsed.category];
|
|
33598
|
+
if (parsed.subcategory) {
|
|
33599
|
+
segments.push(parsed.subcategory);
|
|
33600
|
+
}
|
|
33601
|
+
return segments;
|
|
33602
|
+
}
|
|
33603
|
+
function scopeMatchesPattern(requestedScope, grantPattern) {
|
|
33604
|
+
if (grantPattern === "*") return true;
|
|
33605
|
+
if (grantPattern.endsWith(".*")) {
|
|
33606
|
+
const prefix = grantPattern.slice(0, -1);
|
|
33607
|
+
return requestedScope.startsWith(prefix);
|
|
33608
|
+
}
|
|
33609
|
+
return requestedScope === grantPattern;
|
|
33610
|
+
}
|
|
33611
|
+
function scopeCoveredByGrant(requestedScope, grantedScopes) {
|
|
33612
|
+
return grantedScopes.some(
|
|
33613
|
+
(pattern) => scopeMatchesPattern(requestedScope, pattern)
|
|
33614
|
+
);
|
|
33615
|
+
}
|
|
33616
|
+
|
|
33617
|
+
// src/protocol/scope-actions.ts
|
|
33618
|
+
var SCOPE_ACTIONS = ["read", "write"];
|
|
33619
|
+
var InvalidScopeEntryError = class extends Error {
|
|
33620
|
+
/** The offending entry, verbatim (unknown because it may not be a string). */
|
|
33621
|
+
entry;
|
|
33622
|
+
constructor(entry, reason) {
|
|
33623
|
+
super(`Invalid scope entry ${describeValue(entry)}: ${reason}`);
|
|
33624
|
+
this.name = "InvalidScopeEntryError";
|
|
33625
|
+
this.entry = entry;
|
|
33626
|
+
}
|
|
33627
|
+
};
|
|
33628
|
+
var OPERATION_SEPARATOR = ":";
|
|
33629
|
+
function describeValue(value) {
|
|
33630
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
33631
|
+
if (value === null) return "null";
|
|
33632
|
+
return `[${typeof value}]`;
|
|
33633
|
+
}
|
|
33634
|
+
var OPERATION_BY_PREFIX = {
|
|
33635
|
+
write: "write"
|
|
33636
|
+
};
|
|
33637
|
+
function assertScopePart(entry, scope) {
|
|
33638
|
+
if (scope.length === 0) {
|
|
33639
|
+
throw new InvalidScopeEntryError(entry, "scope part is empty");
|
|
33640
|
+
}
|
|
33641
|
+
if (scope.includes(OPERATION_SEPARATOR)) {
|
|
33642
|
+
throw new InvalidScopeEntryError(
|
|
33643
|
+
entry,
|
|
33644
|
+
`scope part must not contain "${OPERATION_SEPARATOR}"`
|
|
33645
|
+
);
|
|
33646
|
+
}
|
|
33647
|
+
}
|
|
33648
|
+
function parseScopeEntry(entry) {
|
|
33649
|
+
const raw = entry;
|
|
33650
|
+
if (typeof raw !== "string") {
|
|
33651
|
+
throw new InvalidScopeEntryError(raw, "entry must be a string");
|
|
33652
|
+
}
|
|
33653
|
+
const separatorIndex = entry.indexOf(OPERATION_SEPARATOR);
|
|
33654
|
+
if (separatorIndex === -1) {
|
|
33655
|
+
assertScopePart(entry, entry);
|
|
33656
|
+
return { scope: entry, action: "read" };
|
|
33657
|
+
}
|
|
33658
|
+
const prefix = entry.slice(0, separatorIndex);
|
|
33659
|
+
const scope = entry.slice(separatorIndex + 1);
|
|
33660
|
+
const action = Object.hasOwn(OPERATION_BY_PREFIX, prefix) ? OPERATION_BY_PREFIX[prefix] : void 0;
|
|
33661
|
+
if (action === void 0) {
|
|
33662
|
+
throw new InvalidScopeEntryError(
|
|
33663
|
+
entry,
|
|
33664
|
+
`unknown operation "${prefix}" (known: ${Object.keys(OPERATION_BY_PREFIX).join(", ")}; read has no prefix)`
|
|
33665
|
+
);
|
|
33666
|
+
}
|
|
33667
|
+
assertScopePart(entry, scope);
|
|
33668
|
+
return { scope, action };
|
|
33669
|
+
}
|
|
33670
|
+
function formatScopeEntry(parsed) {
|
|
33671
|
+
const { scope, action } = parsed;
|
|
33672
|
+
assertScopePart(scope, scope);
|
|
33673
|
+
if (action === "read") return scope;
|
|
33674
|
+
const prefix = Object.entries(OPERATION_BY_PREFIX).find(
|
|
33675
|
+
([, candidate]) => candidate === action
|
|
33676
|
+
)?.[0];
|
|
33677
|
+
if (prefix === void 0) {
|
|
33678
|
+
throw new InvalidScopeEntryError(
|
|
33679
|
+
scope,
|
|
33680
|
+
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33681
|
+
);
|
|
33682
|
+
}
|
|
33683
|
+
return `${prefix}${OPERATION_SEPARATOR}${scope}`;
|
|
33684
|
+
}
|
|
33685
|
+
function compareScopes(a, b) {
|
|
33686
|
+
if (a < b) return -1;
|
|
33687
|
+
if (a > b) return 1;
|
|
33688
|
+
return 0;
|
|
33689
|
+
}
|
|
33690
|
+
function sortActions(actions) {
|
|
33691
|
+
const present = new Set(actions);
|
|
33692
|
+
return SCOPE_ACTIONS.filter((action) => present.has(action));
|
|
33693
|
+
}
|
|
33694
|
+
function grantPermissions(scopes) {
|
|
33695
|
+
const byScope = /* @__PURE__ */ new Map();
|
|
33696
|
+
for (const entry of scopes) {
|
|
33697
|
+
const { scope, action } = parseScopeEntry(entry);
|
|
33698
|
+
let actions = byScope.get(scope);
|
|
33699
|
+
if (actions === void 0) {
|
|
33700
|
+
actions = /* @__PURE__ */ new Set();
|
|
33701
|
+
byScope.set(scope, actions);
|
|
33702
|
+
}
|
|
33703
|
+
actions.add(action);
|
|
33704
|
+
}
|
|
33705
|
+
return [...byScope.keys()].sort(compareScopes).map((scope) => ({
|
|
33706
|
+
scope,
|
|
33707
|
+
actions: sortActions(byScope.get(scope) ?? [])
|
|
33708
|
+
}));
|
|
33709
|
+
}
|
|
33710
|
+
function permissionsToScopes(permissions) {
|
|
33711
|
+
const byScope = /* @__PURE__ */ new Map();
|
|
33712
|
+
for (const { scope, actions } of permissions) {
|
|
33713
|
+
let merged = byScope.get(scope);
|
|
33714
|
+
if (merged === void 0) {
|
|
33715
|
+
merged = /* @__PURE__ */ new Set();
|
|
33716
|
+
byScope.set(scope, merged);
|
|
33717
|
+
}
|
|
33718
|
+
for (const action of actions) {
|
|
33719
|
+
if (!SCOPE_ACTIONS.includes(action)) {
|
|
33720
|
+
throw new InvalidScopeEntryError(
|
|
33721
|
+
scope,
|
|
33722
|
+
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33723
|
+
);
|
|
33724
|
+
}
|
|
33725
|
+
merged.add(action);
|
|
33726
|
+
}
|
|
33727
|
+
}
|
|
33728
|
+
const entries = [];
|
|
33729
|
+
for (const scope of [...byScope.keys()].sort(compareScopes)) {
|
|
33730
|
+
for (const action of sortActions(byScope.get(scope) ?? [])) {
|
|
33731
|
+
entries.push(formatScopeEntry({ scope, action }));
|
|
33732
|
+
}
|
|
33733
|
+
}
|
|
33734
|
+
return entries;
|
|
33735
|
+
}
|
|
33736
|
+
function hasAction(scopes, scope, action) {
|
|
33737
|
+
if (scope.includes(OPERATION_SEPARATOR)) return false;
|
|
33738
|
+
for (const entry of scopes) {
|
|
33739
|
+
let parsed;
|
|
33740
|
+
try {
|
|
33741
|
+
parsed = parseScopeEntry(entry);
|
|
33742
|
+
} catch (error) {
|
|
33743
|
+
if (error instanceof InvalidScopeEntryError) continue;
|
|
33744
|
+
throw error;
|
|
33745
|
+
}
|
|
33746
|
+
if (parsed.action === action && scopeMatchesPattern(scope, parsed.scope)) {
|
|
33747
|
+
return true;
|
|
33748
|
+
}
|
|
33749
|
+
}
|
|
33750
|
+
return false;
|
|
33751
|
+
}
|
|
33752
|
+
function tryGrantPermissions(scopes) {
|
|
33753
|
+
try {
|
|
33754
|
+
return grantPermissions(scopes);
|
|
33755
|
+
} catch (error) {
|
|
33756
|
+
if (error instanceof InvalidScopeEntryError) return void 0;
|
|
33757
|
+
throw error;
|
|
33758
|
+
}
|
|
33759
|
+
}
|
|
33760
|
+
|
|
33473
33761
|
// src/protocol/personal-server-write.ts
|
|
33762
|
+
import { sha256 as sha2565 } from "@noble/hashes/sha2";
|
|
33763
|
+
import { bytesToHex as bytesToHex2, isAddress as isAddress6 } from "viem";
|
|
33764
|
+
import { z as z4 } from "zod";
|
|
33474
33765
|
var WRITE_SESSION_PATH = "/v1/write/session";
|
|
33475
33766
|
var WRITE_SIGNATURE_HEADER = "X-Vana-Write-Signature";
|
|
33476
33767
|
var WRITE_METADATA_HEADER = "X-Vana-Metadata";
|
|
@@ -33773,7 +34064,7 @@ function normalizeLineage(lineage, derivedScope) {
|
|
|
33773
34064
|
for (const entry of lineage) {
|
|
33774
34065
|
let id;
|
|
33775
34066
|
if (isLineagePair(entry)) {
|
|
33776
|
-
if (!
|
|
34067
|
+
if (!isAddress6(entry.ownerAddress, { strict: false })) {
|
|
33777
34068
|
throw new WriteRequestError(
|
|
33778
34069
|
"lineage source ownerAddress must be an EVM address",
|
|
33779
34070
|
{ ownerAddress: entry.ownerAddress }
|
|
@@ -34035,14 +34326,44 @@ function withGrantPermissions(grant) {
|
|
|
34035
34326
|
}
|
|
34036
34327
|
function createGatewayClient(baseUrl) {
|
|
34037
34328
|
const base = baseUrl.replace(/\/+$/, "");
|
|
34329
|
+
function malformedBody(res) {
|
|
34330
|
+
return new Error(
|
|
34331
|
+
`Gateway error: ${res.status} malformed response body (expected a JSON envelope)`
|
|
34332
|
+
);
|
|
34333
|
+
}
|
|
34334
|
+
async function readEnvelope(res) {
|
|
34335
|
+
const envelope = await readJsonValue(res);
|
|
34336
|
+
if (!isPlainObject(envelope) || !("data" in envelope)) {
|
|
34337
|
+
throw malformedBody(res);
|
|
34338
|
+
}
|
|
34339
|
+
return envelope;
|
|
34340
|
+
}
|
|
34038
34341
|
async function unwrapEnvelope(res) {
|
|
34039
|
-
|
|
34040
|
-
return envelope.data;
|
|
34342
|
+
return (await readEnvelope(res)).data;
|
|
34041
34343
|
}
|
|
34042
34344
|
function getMutationId(body, key) {
|
|
34345
|
+
if (!isPlainObject(body)) return void 0;
|
|
34043
34346
|
const value = body[key] ?? body["id"];
|
|
34044
34347
|
return typeof value === "string" ? value : void 0;
|
|
34045
34348
|
}
|
|
34349
|
+
async function readBody(res) {
|
|
34350
|
+
const raw = await readJsonObject(res);
|
|
34351
|
+
const data = raw["data"];
|
|
34352
|
+
if (isPlainObject(data) && "proof" in raw) {
|
|
34353
|
+
return data;
|
|
34354
|
+
}
|
|
34355
|
+
return raw;
|
|
34356
|
+
}
|
|
34357
|
+
function stringOrUndefined(value) {
|
|
34358
|
+
return typeof value === "string" ? value : void 0;
|
|
34359
|
+
}
|
|
34360
|
+
async function deletedError(res, details) {
|
|
34361
|
+
const body = await readBody(res);
|
|
34362
|
+
return new DataPointDeletedError(
|
|
34363
|
+
`Data point ${details.dataPointId ?? details.scope ?? ""} has been deleted`,
|
|
34364
|
+
{ ...details, deletedAt: tombstoneDeletedAt(body) }
|
|
34365
|
+
);
|
|
34366
|
+
}
|
|
34046
34367
|
return {
|
|
34047
34368
|
async isRegisteredBuilder(address) {
|
|
34048
34369
|
const builder = await this.getBuilder(address);
|
|
@@ -34099,13 +34420,29 @@ function createGatewayClient(baseUrl) {
|
|
|
34099
34420
|
}
|
|
34100
34421
|
return await res.json();
|
|
34101
34422
|
},
|
|
34102
|
-
async getDataPoint(dataPointId) {
|
|
34103
|
-
const
|
|
34423
|
+
async getDataPoint(dataPointId, options) {
|
|
34424
|
+
const query = options?.includeDeleted ? "?includeDeleted=true" : "";
|
|
34425
|
+
const res = await fetch(`${base}/v1/data/${dataPointId}${query}`);
|
|
34104
34426
|
if (res.status === 404) return null;
|
|
34427
|
+
if (res.status === 410) {
|
|
34428
|
+
throw await deletedError(res, { dataPointId });
|
|
34429
|
+
}
|
|
34105
34430
|
if (!res.ok) {
|
|
34106
34431
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34107
34432
|
}
|
|
34108
|
-
|
|
34433
|
+
const record = await unwrapEnvelope(res);
|
|
34434
|
+
if (!options?.includeDeleted && isDataPointTombstone(record)) {
|
|
34435
|
+
throw new DataPointDeletedError(
|
|
34436
|
+
`Data point ${dataPointId} has been deleted`,
|
|
34437
|
+
{
|
|
34438
|
+
dataPointId,
|
|
34439
|
+
scope: record.scope,
|
|
34440
|
+
ownerAddress: record.ownerAddress,
|
|
34441
|
+
deletedAt: tombstoneDeletedAt(record)
|
|
34442
|
+
}
|
|
34443
|
+
);
|
|
34444
|
+
}
|
|
34445
|
+
return record;
|
|
34109
34446
|
},
|
|
34110
34447
|
async listDataPointsByOwner(owner, cursor, options) {
|
|
34111
34448
|
const params = new URLSearchParams({ user: owner });
|
|
@@ -34118,14 +34455,24 @@ function createGatewayClient(baseUrl) {
|
|
|
34118
34455
|
if (options?.limit !== void 0) {
|
|
34119
34456
|
params.set("limit", String(options.limit));
|
|
34120
34457
|
}
|
|
34458
|
+
if (options?.includeDeleted) {
|
|
34459
|
+
params.set("includeDeleted", "true");
|
|
34460
|
+
}
|
|
34121
34461
|
const res = await fetch(`${base}/v1/data?${params.toString()}`);
|
|
34122
34462
|
if (!res.ok) {
|
|
34123
34463
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34124
34464
|
}
|
|
34125
|
-
const envelope = await res
|
|
34126
|
-
|
|
34465
|
+
const envelope = await readEnvelope(res);
|
|
34466
|
+
if (!isPlainObject(envelope.data) || !Array.isArray(envelope.data["dataPoints"])) {
|
|
34467
|
+
throw malformedBody(res);
|
|
34468
|
+
}
|
|
34469
|
+
const rows = envelope.data["dataPoints"];
|
|
34470
|
+
const pagination = isPlainObject(envelope["pagination"]) ? envelope["pagination"] : void 0;
|
|
34471
|
+
const rawCursor = pagination?.["nextCursor"];
|
|
34472
|
+
const nextCursor = pagination?.["hasMore"] === false || typeof rawCursor !== "string" ? null : rawCursor;
|
|
34473
|
+
const dataPoints = options?.includeDeleted ? rows : rows.filter((row) => !isDataPointTombstone(row));
|
|
34127
34474
|
return {
|
|
34128
|
-
dataPoints
|
|
34475
|
+
dataPoints,
|
|
34129
34476
|
cursor: nextCursor
|
|
34130
34477
|
};
|
|
34131
34478
|
},
|
|
@@ -34152,7 +34499,7 @@ function createGatewayClient(baseUrl) {
|
|
|
34152
34499
|
})
|
|
34153
34500
|
});
|
|
34154
34501
|
if (res.status === 409) {
|
|
34155
|
-
const body2 = await res
|
|
34502
|
+
const body2 = await readJsonObject(res);
|
|
34156
34503
|
return {
|
|
34157
34504
|
serverId: getMutationId(body2, "serverId"),
|
|
34158
34505
|
alreadyRegistered: true
|
|
@@ -34161,7 +34508,7 @@ function createGatewayClient(baseUrl) {
|
|
|
34161
34508
|
if (!res.ok) {
|
|
34162
34509
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34163
34510
|
}
|
|
34164
|
-
const body = await res
|
|
34511
|
+
const body = await readJsonObject(res);
|
|
34165
34512
|
return {
|
|
34166
34513
|
serverId: getMutationId(body, "serverId"),
|
|
34167
34514
|
alreadyRegistered: false
|
|
@@ -34182,19 +34529,16 @@ function createGatewayClient(baseUrl) {
|
|
|
34182
34529
|
})
|
|
34183
34530
|
});
|
|
34184
34531
|
if (res.status === 409) {
|
|
34185
|
-
const body2 = await res
|
|
34532
|
+
const body2 = await readJsonObject(res);
|
|
34186
34533
|
return {
|
|
34187
|
-
builderId: getMutationId(
|
|
34188
|
-
body2,
|
|
34189
|
-
"builderId"
|
|
34190
|
-
),
|
|
34534
|
+
builderId: getMutationId(body2, "builderId"),
|
|
34191
34535
|
alreadyRegistered: true
|
|
34192
34536
|
};
|
|
34193
34537
|
}
|
|
34194
34538
|
if (!res.ok) {
|
|
34195
34539
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34196
34540
|
}
|
|
34197
|
-
const body = await res
|
|
34541
|
+
const body = await readJsonObject(res);
|
|
34198
34542
|
return {
|
|
34199
34543
|
builderId: getMutationId(body, "builderId"),
|
|
34200
34544
|
alreadyRegistered: false
|
|
@@ -34216,17 +34560,77 @@ function createGatewayClient(baseUrl) {
|
|
|
34216
34560
|
})
|
|
34217
34561
|
});
|
|
34218
34562
|
if (!res.ok) {
|
|
34219
|
-
const body2 = await res
|
|
34220
|
-
const detail = body2
|
|
34563
|
+
const body2 = await readJsonObject(res);
|
|
34564
|
+
const detail = stringOrUndefined(body2["error"]) ?? res.statusText;
|
|
34565
|
+
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
34566
|
+
}
|
|
34567
|
+
const body = await readJsonObject(res);
|
|
34568
|
+
return {
|
|
34569
|
+
dataPointId: getMutationId(body, "dataPointId"),
|
|
34570
|
+
expectedVersion: stringOrUndefined(body["expectedVersion"])
|
|
34571
|
+
};
|
|
34572
|
+
},
|
|
34573
|
+
async deleteDataPoint(params) {
|
|
34574
|
+
const dataPointId = deriveDataPointId(
|
|
34575
|
+
params.ownerAddress,
|
|
34576
|
+
params.scope
|
|
34577
|
+
);
|
|
34578
|
+
const details = {
|
|
34579
|
+
dataPointId,
|
|
34580
|
+
scope: params.scope,
|
|
34581
|
+
ownerAddress: params.ownerAddress
|
|
34582
|
+
};
|
|
34583
|
+
const res = await fetch(`${base}/v1/data/${dataPointId}`, {
|
|
34584
|
+
method: "DELETE",
|
|
34585
|
+
headers: {
|
|
34586
|
+
"Content-Type": "application/json",
|
|
34587
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
34588
|
+
},
|
|
34589
|
+
body: JSON.stringify({
|
|
34590
|
+
ownerAddress: params.ownerAddress,
|
|
34591
|
+
scope: params.scope,
|
|
34592
|
+
expectedVersion: params.expectedVersion,
|
|
34593
|
+
signature: params.signature
|
|
34594
|
+
})
|
|
34595
|
+
});
|
|
34596
|
+
if (res.status === 404) {
|
|
34597
|
+
throw new DataPointNotFoundError(
|
|
34598
|
+
`Data point ${dataPointId} (scope '${params.scope}') is not registered`,
|
|
34599
|
+
details
|
|
34600
|
+
);
|
|
34601
|
+
}
|
|
34602
|
+
if (res.status === 409) {
|
|
34603
|
+
const body2 = await readBody(res);
|
|
34604
|
+
const currentExpectedVersion = stringOrUndefined(
|
|
34605
|
+
body2["currentExpectedVersion"]
|
|
34606
|
+
);
|
|
34607
|
+
const detail = stringOrUndefined(body2["error"]) ?? res.statusText;
|
|
34608
|
+
throw new DataPointVersionConflictError(
|
|
34609
|
+
`Gateway error: 409 ${detail}`,
|
|
34610
|
+
{
|
|
34611
|
+
...details,
|
|
34612
|
+
expectedVersion: params.expectedVersion,
|
|
34613
|
+
currentExpectedVersion
|
|
34614
|
+
}
|
|
34615
|
+
);
|
|
34616
|
+
}
|
|
34617
|
+
if (res.status === 410) {
|
|
34618
|
+
throw await deletedError(res, details);
|
|
34619
|
+
}
|
|
34620
|
+
if (!res.ok) {
|
|
34621
|
+
const body2 = await readBody(res);
|
|
34622
|
+
const detail = stringOrUndefined(body2["error"]) ?? res.statusText;
|
|
34221
34623
|
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
34222
34624
|
}
|
|
34223
|
-
const body = await res
|
|
34625
|
+
const body = await readBody(res);
|
|
34224
34626
|
return {
|
|
34225
|
-
dataPointId: getMutationId(
|
|
34226
|
-
|
|
34227
|
-
|
|
34228
|
-
),
|
|
34229
|
-
|
|
34627
|
+
dataPointId: getMutationId(body, "dataPointId") ?? dataPointId,
|
|
34628
|
+
ownerAddress: stringOrUndefined(body["ownerAddress"]),
|
|
34629
|
+
scope: stringOrUndefined(body["scope"]),
|
|
34630
|
+
dataHash: stringOrUndefined(body["dataHash"]),
|
|
34631
|
+
metadataHash: stringOrUndefined(body["metadataHash"]),
|
|
34632
|
+
expectedVersion: stringOrUndefined(body["expectedVersion"]),
|
|
34633
|
+
deletedAt: tombstoneDeletedAt(body)
|
|
34230
34634
|
};
|
|
34231
34635
|
},
|
|
34232
34636
|
async createGrant(params) {
|
|
@@ -34245,18 +34649,14 @@ function createGatewayClient(baseUrl) {
|
|
|
34245
34649
|
})
|
|
34246
34650
|
});
|
|
34247
34651
|
if (res.status === 409) {
|
|
34248
|
-
const body2 = await res
|
|
34249
|
-
return {
|
|
34250
|
-
grantId: getMutationId(body2, "grantId")
|
|
34251
|
-
};
|
|
34652
|
+
const body2 = await readJsonObject(res);
|
|
34653
|
+
return { grantId: getMutationId(body2, "grantId") };
|
|
34252
34654
|
}
|
|
34253
34655
|
if (!res.ok) {
|
|
34254
34656
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34255
34657
|
}
|
|
34256
|
-
const body = await res
|
|
34257
|
-
return {
|
|
34258
|
-
grantId: getMutationId(body, "grantId")
|
|
34259
|
-
};
|
|
34658
|
+
const body = await readJsonObject(res);
|
|
34659
|
+
return { grantId: getMutationId(body, "grantId") };
|
|
34260
34660
|
},
|
|
34261
34661
|
async revokeGrant(params) {
|
|
34262
34662
|
const res = await fetch(`${base}/v1/grants/${params.grantId}`, {
|
|
@@ -34526,7 +34926,10 @@ export {
|
|
|
34526
34926
|
ContractNotFoundError,
|
|
34527
34927
|
DATA_REGISTRY_STATUS_ABI,
|
|
34528
34928
|
DataFileEnvelopeSchema,
|
|
34929
|
+
DataPointDeletedError,
|
|
34930
|
+
DataPointNotFoundError,
|
|
34529
34931
|
DataPointStatus,
|
|
34932
|
+
DataPointVersionConflictError,
|
|
34530
34933
|
DropboxStorage,
|
|
34531
34934
|
ECIESError,
|
|
34532
34935
|
ESCROW_DEPOSIT_ABI2 as ESCROW_DEPOSIT_ABI,
|
|
@@ -34583,6 +34986,10 @@ export {
|
|
|
34583
34986
|
SignatureError,
|
|
34584
34987
|
StorageError,
|
|
34585
34988
|
StorageManager,
|
|
34989
|
+
TOMBSTONE_DATA_HASH,
|
|
34990
|
+
TOMBSTONE_DATA_HASH_PREIMAGE,
|
|
34991
|
+
TOMBSTONE_METADATA_HASH,
|
|
34992
|
+
TOMBSTONE_METADATA_HASH_PREIMAGE,
|
|
34586
34993
|
TransactionPendingError,
|
|
34587
34994
|
UserRejectedRequestError,
|
|
34588
34995
|
VanaError,
|
|
@@ -34605,6 +35012,8 @@ export {
|
|
|
34605
35012
|
assertDerivedScopeNaming,
|
|
34606
35013
|
assertValidPkceVerifier,
|
|
34607
35014
|
binaryWriteSignedBytes,
|
|
35015
|
+
buildDataPointDeletionSignature,
|
|
35016
|
+
buildDataPointDeletionTypedData,
|
|
34608
35017
|
buildDepositNativeRequest,
|
|
34609
35018
|
buildDepositTokenRequest,
|
|
34610
35019
|
buildMarkDataPointUnavailableRequest,
|
|
@@ -34620,6 +35029,7 @@ export {
|
|
|
34620
35029
|
clearContractCache,
|
|
34621
35030
|
computeBodyHash,
|
|
34622
35031
|
computePkceChallenge,
|
|
35032
|
+
computeTombstoneHash,
|
|
34623
35033
|
contractCacheForTesting,
|
|
34624
35034
|
createBrowserPlatformAdapter,
|
|
34625
35035
|
createDataFileEnvelope,
|
|
@@ -34627,11 +35037,13 @@ export {
|
|
|
34627
35037
|
createGatewayClient,
|
|
34628
35038
|
createPlatformAdapterSafe,
|
|
34629
35039
|
createVanaStorageProvider,
|
|
35040
|
+
createViemDataPointDeletionSigner,
|
|
34630
35041
|
createViemPersonalServerLiteOwnerBindingSigner,
|
|
34631
35042
|
createViemPersonalServerRegistrationSigner,
|
|
34632
35043
|
dataRegistryContractAddress,
|
|
34633
35044
|
dataRegistryDomain,
|
|
34634
35045
|
decryptWithPassword,
|
|
35046
|
+
deleteDataPoint,
|
|
34635
35047
|
deriveDataPointId,
|
|
34636
35048
|
deriveMasterKey,
|
|
34637
35049
|
deriveScopeKey,
|
|
@@ -34667,10 +35079,12 @@ export {
|
|
|
34667
35079
|
grantRevocationDomain,
|
|
34668
35080
|
hasAction,
|
|
34669
35081
|
isDataPointId,
|
|
35082
|
+
isDataPointTombstone,
|
|
34670
35083
|
isDataPortabilityGatewayConfig,
|
|
34671
35084
|
isECIESEncrypted,
|
|
34672
35085
|
isPlatformSupported,
|
|
34673
35086
|
isRedactedLineageNode,
|
|
35087
|
+
isTombstoneHashes,
|
|
34674
35088
|
mainnetServices,
|
|
34675
35089
|
moksha,
|
|
34676
35090
|
mokshaServices,
|
|
@@ -34700,6 +35114,7 @@ export {
|
|
|
34700
35114
|
signPersonalServerLiteOwnerBinding,
|
|
34701
35115
|
signPersonalServerLiteOwnerBindingWithAccountClient,
|
|
34702
35116
|
signPersonalServerRegistrationWithAccount,
|
|
35117
|
+
tombstoneDeletedAt,
|
|
34703
35118
|
tryGrantPermissions,
|
|
34704
35119
|
vanaMainnet2 as vanaMainnet,
|
|
34705
35120
|
verifyGrantRegistration,
|