@vess-id/ai-identity 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/agent/agent-did-manager.d.ts +50 -0
  2. package/dist/agent/agent-did-manager.d.ts.map +1 -0
  3. package/dist/auth/auth-provider.d.ts +51 -0
  4. package/dist/auth/auth-provider.d.ts.map +1 -0
  5. package/dist/auth/index.d.ts +2 -0
  6. package/dist/auth/index.d.ts.map +1 -0
  7. package/dist/client.d.ts +80 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/config/index.d.ts +30 -0
  10. package/dist/config/index.d.ts.map +1 -0
  11. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts +56 -0
  12. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts.map +1 -0
  13. package/dist/constraint/constraint-evaluator.d.ts +72 -0
  14. package/dist/constraint/constraint-evaluator.d.ts.map +1 -0
  15. package/dist/constraint/index.d.ts +5 -0
  16. package/dist/constraint/index.d.ts.map +1 -0
  17. package/dist/did/agent.d.ts +52 -0
  18. package/dist/did/agent.d.ts.map +1 -0
  19. package/dist/did/did-utils.d.ts +75 -0
  20. package/dist/did/did-utils.d.ts.map +1 -0
  21. package/dist/did/key-manager.d.ts +19 -0
  22. package/dist/did/key-manager.d.ts.map +1 -0
  23. package/dist/gateway/gateway-client.d.ts +103 -0
  24. package/dist/gateway/gateway-client.d.ts.map +1 -0
  25. package/dist/gateway/index.d.ts +2 -0
  26. package/dist/gateway/index.d.ts.map +1 -0
  27. package/dist/grant/grant-manager.d.ts +140 -0
  28. package/dist/grant/grant-manager.d.ts.map +1 -0
  29. package/dist/grant/index.d.ts +2 -0
  30. package/dist/grant/index.d.ts.map +1 -0
  31. package/dist/identity/device-enroll-manager.d.ts +111 -0
  32. package/dist/identity/device-enroll-manager.d.ts.map +1 -0
  33. package/dist/identity/user-identity-manager.d.ts +69 -0
  34. package/dist/identity/user-identity-manager.d.ts.map +1 -0
  35. package/dist/identity/user-key-pair-manager.d.ts +22 -0
  36. package/dist/identity/user-key-pair-manager.d.ts.map +1 -0
  37. package/dist/index.d.ts +32 -3077
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +351 -45
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +351 -49
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/memory/memory-manager.d.ts +71 -0
  44. package/dist/memory/memory-manager.d.ts.map +1 -0
  45. package/dist/monitoring/metrics-manager.d.ts +74 -0
  46. package/dist/monitoring/metrics-manager.d.ts.map +1 -0
  47. package/dist/organization/disclosure-config-manager.d.ts +61 -0
  48. package/dist/organization/disclosure-config-manager.d.ts.map +1 -0
  49. package/dist/organization/key-rotation-manager.d.ts +63 -0
  50. package/dist/organization/key-rotation-manager.d.ts.map +1 -0
  51. package/dist/organization/organization-manager.d.ts +38 -0
  52. package/dist/organization/organization-manager.d.ts.map +1 -0
  53. package/dist/registry/access-orchestrator.d.ts +183 -0
  54. package/dist/registry/access-orchestrator.d.ts.map +1 -0
  55. package/dist/registry/action-registry-json.d.ts +1363 -0
  56. package/dist/registry/action-registry-json.d.ts.map +1 -0
  57. package/dist/registry/action-registry.d.ts +65 -0
  58. package/dist/registry/action-registry.d.ts.map +1 -0
  59. package/dist/registry/index.d.ts +4 -0
  60. package/dist/registry/index.d.ts.map +1 -0
  61. package/dist/revocation/revocation-manager.d.ts +98 -0
  62. package/dist/revocation/revocation-manager.d.ts.map +1 -0
  63. package/dist/state/index.d.ts +3 -0
  64. package/dist/state/index.d.ts.map +1 -0
  65. package/dist/state/json-state-store.d.ts +24 -0
  66. package/dist/state/json-state-store.d.ts.map +1 -0
  67. package/dist/state/state-store.interface.d.ts +37 -0
  68. package/dist/state/state-store.interface.d.ts.map +1 -0
  69. package/dist/storage/filesystem-key-storage.d.ts +16 -0
  70. package/dist/storage/filesystem-key-storage.d.ts.map +1 -0
  71. package/dist/storage/index.d.ts +4 -0
  72. package/dist/storage/index.d.ts.map +1 -0
  73. package/dist/storage/key-storage.interface.d.ts +42 -0
  74. package/dist/storage/key-storage.interface.d.ts.map +1 -0
  75. package/dist/storage/memory-key-storage.d.ts +17 -0
  76. package/dist/storage/memory-key-storage.d.ts.map +1 -0
  77. package/dist/tool/tool-manager.d.ts +44 -0
  78. package/dist/tool/tool-manager.d.ts.map +1 -0
  79. package/dist/utils/crypto.d.ts +22 -0
  80. package/dist/utils/crypto.d.ts.map +1 -0
  81. package/dist/utils/sdjwt-client.d.ts +168 -0
  82. package/dist/utils/sdjwt-client.d.ts.map +1 -0
  83. package/dist/vc/api-vc-manager.d.ts +40 -0
  84. package/dist/vc/api-vc-manager.d.ts.map +1 -0
  85. package/dist/vc/vc-manager.d.ts +55 -0
  86. package/dist/vc/vc-manager.d.ts.map +1 -0
  87. package/dist/vp/vp-manager.d.ts +40 -0
  88. package/dist/vp/vp-manager.d.ts.map +1 -0
  89. package/package.json +2 -2
  90. package/dist/index.d.mts +0 -3078
package/dist/index.mjs CHANGED
@@ -32,26 +32,26 @@ function configure(config) {
32
32
  function getConfig() {
33
33
  return globalConfig;
34
34
  }
35
- function getDidApiUrl(path3) {
35
+ function getDidApiUrl(path4) {
36
36
  const baseUrl = globalConfig.didApi?.baseUrl || process.env.DID_API_BASE_URL;
37
37
  if (!baseUrl) {
38
38
  throw new Error("DID API base URL not configured");
39
39
  }
40
- return `${baseUrl}${path3}`;
40
+ return `${baseUrl}${path4}`;
41
41
  }
42
- function getIssuerApiUrl(path3) {
42
+ function getIssuerApiUrl(path4) {
43
43
  const baseUrl = globalConfig.issuerApi?.baseUrl || process.env.ISSUER_API_BASE_URL;
44
44
  if (!baseUrl) {
45
45
  throw new Error("Issuer API base URL not configured");
46
46
  }
47
- return `${baseUrl}${path3}`;
47
+ return `${baseUrl}${path4}`;
48
48
  }
49
- function getVerifierApiUrl(path3) {
49
+ function getVerifierApiUrl(path4) {
50
50
  const baseUrl = globalConfig.verifierApi?.baseUrl || process.env.VERIFIER_API_BASE_URL;
51
51
  if (!baseUrl) {
52
52
  throw new Error("Verifier API base URL not configured");
53
53
  }
54
- return `${baseUrl}${path3}`;
54
+ return `${baseUrl}${path4}`;
55
55
  }
56
56
  function getApiHeaders(apiType) {
57
57
  const headers = {
@@ -898,12 +898,12 @@ var AgentDIDManager = class {
898
898
  * List all agent DIDs
899
899
  */
900
900
  async listAgentDIDs() {
901
- const fs3 = await import("fs/promises");
902
- const path3 = await import("path");
903
- const os2 = await import("os");
904
- const mappingDir = path3.join(os2.homedir(), ".vess-aidentity", "agent-dids");
901
+ const fs4 = await import("fs/promises");
902
+ const path4 = await import("path");
903
+ const os3 = await import("os");
904
+ const mappingDir = path4.join(os3.homedir(), ".vess-aidentity", "agent-dids");
905
905
  try {
906
- const files = await fs3.readdir(mappingDir);
906
+ const files = await fs4.readdir(mappingDir);
907
907
  const results = [];
908
908
  for (const file of files) {
909
909
  if (file.endsWith(".did")) {
@@ -924,24 +924,24 @@ var AgentDIDManager = class {
924
924
  * Save agent ID -> DID mapping to persistent storage
925
925
  */
926
926
  async saveAgentDIDMapping(agentId, did) {
927
- const fs3 = await import("fs/promises");
928
- const path3 = await import("path");
929
- const os2 = await import("os");
930
- const mappingDir = path3.join(os2.homedir(), ".vess-aidentity", "agent-dids");
931
- await fs3.mkdir(mappingDir, { recursive: true });
932
- const mappingFile = path3.join(mappingDir, `${agentId}.did`);
933
- await fs3.writeFile(mappingFile, did, "utf-8");
927
+ const fs4 = await import("fs/promises");
928
+ const path4 = await import("path");
929
+ const os3 = await import("os");
930
+ const mappingDir = path4.join(os3.homedir(), ".vess-aidentity", "agent-dids");
931
+ await fs4.mkdir(mappingDir, { recursive: true });
932
+ const mappingFile = path4.join(mappingDir, `${agentId}.did`);
933
+ await fs4.writeFile(mappingFile, did, "utf-8");
934
934
  }
935
935
  /**
936
936
  * Load agent ID -> DID mapping from persistent storage
937
937
  */
938
938
  async loadAgentDIDMapping(agentId) {
939
- const fs3 = await import("fs/promises");
940
- const path3 = await import("path");
941
- const os2 = await import("os");
942
- const mappingFile = path3.join(os2.homedir(), ".vess", "agent-dids", `${agentId}.did`);
939
+ const fs4 = await import("fs/promises");
940
+ const path4 = await import("path");
941
+ const os3 = await import("os");
942
+ const mappingFile = path4.join(os3.homedir(), ".vess", "agent-dids", `${agentId}.did`);
943
943
  try {
944
- return await fs3.readFile(mappingFile, "utf-8");
944
+ return await fs4.readFile(mappingFile, "utf-8");
945
945
  } catch {
946
946
  return null;
947
947
  }
@@ -950,12 +950,12 @@ var AgentDIDManager = class {
950
950
  * Delete agent ID -> DID mapping from persistent storage
951
951
  */
952
952
  async deleteAgentDIDMapping(agentId) {
953
- const fs3 = await import("fs/promises");
954
- const path3 = await import("path");
955
- const os2 = await import("os");
956
- const mappingFile = path3.join(os2.homedir(), ".vess", "agent-dids", `${agentId}.did`);
953
+ const fs4 = await import("fs/promises");
954
+ const path4 = await import("path");
955
+ const os3 = await import("os");
956
+ const mappingFile = path4.join(os3.homedir(), ".vess", "agent-dids", `${agentId}.did`);
957
957
  try {
958
- await fs3.unlink(mappingFile);
958
+ await fs4.unlink(mappingFile);
959
959
  } catch {
960
960
  }
961
961
  }
@@ -1227,24 +1227,24 @@ var UserIdentityManager = class {
1227
1227
  * Save current user DID to persistent storage
1228
1228
  */
1229
1229
  async saveUserDID(did) {
1230
- const fs3 = await import("fs/promises");
1231
- const path3 = await import("path");
1232
- const os2 = await import("os");
1233
- const configDir = path3.join(os2.homedir(), ".vess-aidentity");
1234
- await fs3.mkdir(configDir, { recursive: true });
1235
- const userDIDFile = path3.join(configDir, "user-did.txt");
1236
- await fs3.writeFile(userDIDFile, did, "utf-8");
1230
+ const fs4 = await import("fs/promises");
1231
+ const path4 = await import("path");
1232
+ const os3 = await import("os");
1233
+ const configDir = path4.join(os3.homedir(), ".vess-aidentity");
1234
+ await fs4.mkdir(configDir, { recursive: true });
1235
+ const userDIDFile = path4.join(configDir, "user-did.txt");
1236
+ await fs4.writeFile(userDIDFile, did, "utf-8");
1237
1237
  }
1238
1238
  /**
1239
1239
  * Load current user DID from persistent storage
1240
1240
  */
1241
1241
  async loadUserDID() {
1242
- const fs3 = await import("fs/promises");
1243
- const path3 = await import("path");
1244
- const os2 = await import("os");
1245
- const userDIDFile = path3.join(os2.homedir(), ".vess-aidentity", "user-did.txt");
1242
+ const fs4 = await import("fs/promises");
1243
+ const path4 = await import("path");
1244
+ const os3 = await import("os");
1245
+ const userDIDFile = path4.join(os3.homedir(), ".vess-aidentity", "user-did.txt");
1246
1246
  try {
1247
- return await fs3.readFile(userDIDFile, "utf-8");
1247
+ return await fs4.readFile(userDIDFile, "utf-8");
1248
1248
  } catch {
1249
1249
  return null;
1250
1250
  }
@@ -1253,12 +1253,12 @@ var UserIdentityManager = class {
1253
1253
  * Clear saved user DID
1254
1254
  */
1255
1255
  async clearUserDID() {
1256
- const fs3 = await import("fs/promises");
1257
- const path3 = await import("path");
1258
- const os2 = await import("os");
1259
- const userDIDFile = path3.join(os2.homedir(), ".vess-aidentity", "user-did.txt");
1256
+ const fs4 = await import("fs/promises");
1257
+ const path4 = await import("path");
1258
+ const os3 = await import("os");
1259
+ const userDIDFile = path4.join(os3.homedir(), ".vess-aidentity", "user-did.txt");
1260
1260
  try {
1261
- await fs3.unlink(userDIDFile);
1261
+ await fs4.unlink(userDIDFile);
1262
1262
  } catch {
1263
1263
  }
1264
1264
  }
@@ -1533,6 +1533,7 @@ var VPManager = class {
1533
1533
  presentationFrame[key] = true;
1534
1534
  });
1535
1535
  const kbJwtPayload = {
1536
+ iss: options.holderDid,
1536
1537
  aud: options.domain,
1537
1538
  nonce: options.challenge,
1538
1539
  iat: Math.floor(Date.now() / 1e3)
@@ -3962,11 +3963,308 @@ function evaluateConstraints(constraints, context, currentInvocations, expiresAt
3962
3963
  return defaultConstraintEvaluator.evaluate(constraints, context, currentInvocations, expiresAt);
3963
3964
  }
3964
3965
 
3966
+ // src/state/json-state-store.ts
3967
+ import * as fs2 from "fs/promises";
3968
+ import * as path2 from "path";
3969
+ import * as os2 from "os";
3970
+ var JsonStateStore = class {
3971
+ filePath;
3972
+ data = null;
3973
+ constructor(filePath) {
3974
+ this.filePath = filePath || path2.join(os2.homedir(), ".vess", "state.json");
3975
+ }
3976
+ async get(key) {
3977
+ const data = await this.load();
3978
+ return getNestedValue(data, key);
3979
+ }
3980
+ async set(key, value) {
3981
+ const data = await this.load();
3982
+ setNestedValue(data, key, value);
3983
+ await this.save(data);
3984
+ }
3985
+ async delete(key) {
3986
+ const data = await this.load();
3987
+ const existed = getNestedValue(data, key) !== void 0;
3988
+ if (existed) {
3989
+ deleteNestedValue(data, key);
3990
+ await this.save(data);
3991
+ }
3992
+ return existed;
3993
+ }
3994
+ async has(key) {
3995
+ const data = await this.load();
3996
+ return getNestedValue(data, key) !== void 0;
3997
+ }
3998
+ async getAll() {
3999
+ return { ...await this.load() };
4000
+ }
4001
+ async clear() {
4002
+ this.data = {};
4003
+ await this.save(this.data);
4004
+ }
4005
+ /**
4006
+ * Get the file path used by this store (useful for diagnostics)
4007
+ */
4008
+ getFilePath() {
4009
+ return this.filePath;
4010
+ }
4011
+ async load() {
4012
+ if (this.data !== null) {
4013
+ return this.data;
4014
+ }
4015
+ try {
4016
+ const raw = await fs2.readFile(this.filePath, "utf-8");
4017
+ this.data = JSON.parse(raw);
4018
+ } catch (err) {
4019
+ if (err.code === "ENOENT") {
4020
+ this.data = {};
4021
+ } else if (err instanceof SyntaxError) {
4022
+ this.data = {};
4023
+ } else {
4024
+ throw err;
4025
+ }
4026
+ }
4027
+ return this.data;
4028
+ }
4029
+ async save(data) {
4030
+ this.data = data;
4031
+ const dir = path2.dirname(this.filePath);
4032
+ await fs2.mkdir(dir, { recursive: true, mode: 448 });
4033
+ const tmpPath = this.filePath + ".tmp";
4034
+ await fs2.writeFile(tmpPath, JSON.stringify(data, null, 2), { encoding: "utf-8", mode: 384 });
4035
+ await fs2.rename(tmpPath, this.filePath);
4036
+ }
4037
+ };
4038
+ function getNestedValue(obj, key) {
4039
+ const parts = key.split(".");
4040
+ let current = obj;
4041
+ for (const part of parts) {
4042
+ if (current === null || current === void 0 || typeof current !== "object") {
4043
+ return void 0;
4044
+ }
4045
+ current = current[part];
4046
+ }
4047
+ return current;
4048
+ }
4049
+ function setNestedValue(obj, key, value) {
4050
+ const parts = key.split(".");
4051
+ let current = obj;
4052
+ for (let i = 0; i < parts.length - 1; i++) {
4053
+ const part = parts[i];
4054
+ if (current[part] === void 0 || current[part] === null || typeof current[part] !== "object") {
4055
+ current[part] = {};
4056
+ }
4057
+ current = current[part];
4058
+ }
4059
+ current[parts[parts.length - 1]] = value;
4060
+ }
4061
+ function deleteNestedValue(obj, key) {
4062
+ const parts = key.split(".");
4063
+ let current = obj;
4064
+ for (let i = 0; i < parts.length - 1; i++) {
4065
+ const part = parts[i];
4066
+ if (current[part] === void 0 || typeof current[part] !== "object") {
4067
+ return;
4068
+ }
4069
+ current = current[part];
4070
+ }
4071
+ delete current[parts[parts.length - 1]];
4072
+ }
4073
+
4074
+ // src/gateway/gateway-client.ts
4075
+ var GatewayClient = class {
4076
+ baseUrl;
4077
+ stateStore;
4078
+ apiKey;
4079
+ sessionToken;
4080
+ constructor(options) {
4081
+ this.baseUrl = options.baseUrl.replace(/\/+$/, "").replace(/\/v1$/, "");
4082
+ this.stateStore = options.stateStore;
4083
+ this.apiKey = options.apiKey;
4084
+ this.sessionToken = options.sessionToken;
4085
+ }
4086
+ /**
4087
+ * Set session token for authenticated requests
4088
+ */
4089
+ setSessionToken(token) {
4090
+ this.sessionToken = token;
4091
+ }
4092
+ /**
4093
+ * Fetch events from the Gateway.
4094
+ * If cursor is not provided, attempts to load it from StateStore.
4095
+ *
4096
+ * NOTE: The /events long-poll endpoint may not be implemented on the API server yet.
4097
+ * This client is designed to work once the endpoint is available.
4098
+ */
4099
+ async getEvents(options = {}) {
4100
+ let cursor = options.cursor;
4101
+ if (!cursor && this.stateStore) {
4102
+ cursor = await this.stateStore.get("events.cursor");
4103
+ }
4104
+ const params = new URLSearchParams();
4105
+ if (cursor) params.set("cursor", cursor);
4106
+ if (options.limit) params.set("limit", String(options.limit));
4107
+ if (options.waitSeconds !== void 0) params.set("wait", String(options.waitSeconds));
4108
+ const url = `${this.baseUrl}/api/v1/events?${params.toString()}`;
4109
+ const response = await fetch(url, {
4110
+ method: "GET",
4111
+ headers: this.buildHeaders()
4112
+ });
4113
+ if (!response.ok) {
4114
+ const body = await response.text().catch(() => "");
4115
+ throw new GatewayError(
4116
+ `getEvents failed: ${response.status} ${response.statusText}`,
4117
+ response.status,
4118
+ body
4119
+ );
4120
+ }
4121
+ const result = await response.json();
4122
+ if (result.cursor && this.stateStore) {
4123
+ await this.stateStore.set("events.cursor", result.cursor);
4124
+ }
4125
+ return result;
4126
+ }
4127
+ /**
4128
+ * Acknowledge an event (mark as processed).
4129
+ *
4130
+ * NOTE: The /events/:id/ack endpoint may not be implemented on the API server yet.
4131
+ */
4132
+ async ackEvent(eventId) {
4133
+ const url = `${this.baseUrl}/api/v1/events/${encodeURIComponent(eventId)}/ack`;
4134
+ const response = await fetch(url, {
4135
+ method: "POST",
4136
+ headers: this.buildHeaders()
4137
+ });
4138
+ if (!response.ok) {
4139
+ const body = await response.text().catch(() => "");
4140
+ throw new GatewayError(
4141
+ `ackEvent failed: ${response.status} ${response.statusText}`,
4142
+ response.status,
4143
+ body
4144
+ );
4145
+ }
4146
+ return await response.json();
4147
+ }
4148
+ /**
4149
+ * Validate an API key against the Gateway.
4150
+ *
4151
+ * @param apiKey API key to validate
4152
+ * @param projectId Optional project scope
4153
+ * @param requiredScopes Scopes the caller needs — callers should pass the
4154
+ * scopes relevant to their context (e.g. MCP passes
4155
+ * ['mcp:tools:*', 'mcp:memory:*']).
4156
+ */
4157
+ async validateApiKey(apiKey, projectId, requiredScopes) {
4158
+ const url = `${this.baseUrl}/api/mcp/api-keys/validate`;
4159
+ const body = { projectId };
4160
+ if (requiredScopes && requiredScopes.length > 0) {
4161
+ body.requiredScopes = requiredScopes;
4162
+ }
4163
+ const response = await fetch(url, {
4164
+ method: "POST",
4165
+ headers: {
4166
+ "Content-Type": "application/json",
4167
+ "X-API-Key": apiKey
4168
+ },
4169
+ body: JSON.stringify(body)
4170
+ });
4171
+ if (!response.ok) {
4172
+ return { valid: false };
4173
+ }
4174
+ return await response.json();
4175
+ }
4176
+ buildHeaders() {
4177
+ const headers = {
4178
+ "Content-Type": "application/json"
4179
+ };
4180
+ if (this.apiKey) {
4181
+ headers["X-API-Key"] = this.apiKey;
4182
+ }
4183
+ if (this.sessionToken) {
4184
+ headers["Authorization"] = `Bearer ${this.sessionToken}`;
4185
+ }
4186
+ return headers;
4187
+ }
4188
+ };
4189
+ var GatewayError = class extends Error {
4190
+ constructor(message, statusCode, responseBody) {
4191
+ super(message);
4192
+ this.statusCode = statusCode;
4193
+ this.responseBody = responseBody;
4194
+ this.name = "GatewayError";
4195
+ }
4196
+ };
4197
+
4198
+ // src/auth/auth-provider.ts
4199
+ var AuthProvider = class {
4200
+ stateStore;
4201
+ gatewayClient;
4202
+ constructor(stateStore, gatewayClient) {
4203
+ this.stateStore = stateStore;
4204
+ this.gatewayClient = gatewayClient;
4205
+ }
4206
+ /**
4207
+ * Authenticate with an API key. Validates against the Gateway and
4208
+ * persists the result in the StateStore.
4209
+ *
4210
+ * @returns The validation result
4211
+ */
4212
+ async login(apiKey, apiUrl, projectId) {
4213
+ const result = await this.gatewayClient.validateApiKey(apiKey, projectId);
4214
+ if (result.valid) {
4215
+ const authState = {
4216
+ apiKey,
4217
+ apiUrl,
4218
+ userId: result.userId,
4219
+ projectId: result.projectId || projectId,
4220
+ scopes: result.scopes,
4221
+ authenticatedAt: (/* @__PURE__ */ new Date()).toISOString()
4222
+ };
4223
+ await this.stateStore.set("auth", authState);
4224
+ }
4225
+ return result;
4226
+ }
4227
+ /**
4228
+ * Get the current auth state from the StateStore.
4229
+ * Returns undefined if not authenticated.
4230
+ */
4231
+ async getAuthState() {
4232
+ return this.stateStore.get("auth");
4233
+ }
4234
+ /**
4235
+ * Check if we have stored auth credentials
4236
+ */
4237
+ async isAuthenticated() {
4238
+ const auth = await this.getAuthState();
4239
+ return auth !== void 0 && auth.apiKey !== void 0;
4240
+ }
4241
+ /**
4242
+ * Clear auth state (logout)
4243
+ */
4244
+ async logout() {
4245
+ await this.stateStore.delete("auth");
4246
+ }
4247
+ /**
4248
+ * Get the stored API key, or undefined if not authenticated
4249
+ */
4250
+ async getApiKey() {
4251
+ const auth = await this.getAuthState();
4252
+ return auth?.apiKey;
4253
+ }
4254
+ /**
4255
+ * Get the stored API URL, or undefined if not authenticated
4256
+ */
4257
+ async getApiUrl() {
4258
+ const auth = await this.getAuthState();
4259
+ return auth?.apiUrl;
4260
+ }
4261
+ };
4262
+
3965
4263
  // src/registry/action-registry.ts
3966
4264
  import Ajv from "ajv";
3967
4265
  import addFormats from "ajv-formats";
3968
- import fs2 from "fs/promises";
3969
- import path2 from "path";
4266
+ import fs3 from "fs/promises";
4267
+ import path3 from "path";
3970
4268
  var actionMetaSchema = {
3971
4269
  $id: "https://vess.ai/schemas/action-meta.json",
3972
4270
  type: "object",
@@ -4111,8 +4409,8 @@ function formatAjvErrors(errors) {
4111
4409
  });
4112
4410
  }
4113
4411
  async function loadActionRegistryFromFile(filePath) {
4114
- const abs = path2.resolve(filePath);
4115
- const raw = await fs2.readFile(abs, "utf8");
4412
+ const abs = path3.resolve(filePath);
4413
+ const raw = await fs3.readFile(abs, "utf8");
4116
4414
  const json = JSON.parse(raw);
4117
4415
  const result = validateRegistryObject(json);
4118
4416
  if (!result.ok) {
@@ -4831,12 +5129,16 @@ export {
4831
5129
  AgentDIDManager,
4832
5130
  AgentManager,
4833
5131
  AllowAllAbac,
5132
+ AuthProvider,
4834
5133
  ConstraintEvaluator,
4835
5134
  DeviceEnrollManager,
4836
5135
  DisclosureConfigManager,
4837
5136
  DummyCreds,
4838
5137
  DummyVpVerifier,
4839
5138
  FilesystemKeyStorage,
5139
+ GatewayClient,
5140
+ GatewayError,
5141
+ JsonStateStore,
4840
5142
  KeyManager,
4841
5143
  KeyRotationManager,
4842
5144
  MemoryKeyStorage,