@astrasyncai/verification-gateway 2.0.1 → 2.2.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.
Files changed (83) hide show
  1. package/dist/adapter-interface/interface.d.mts +2 -2
  2. package/dist/adapter-interface/interface.d.ts +2 -2
  3. package/dist/adapters/express.d.mts +2 -2
  4. package/dist/adapters/express.d.ts +2 -2
  5. package/dist/adapters/express.js +42 -20
  6. package/dist/adapters/express.js.map +1 -1
  7. package/dist/adapters/express.mjs +42 -20
  8. package/dist/adapters/express.mjs.map +1 -1
  9. package/dist/adapters/nextjs.d.mts +2 -2
  10. package/dist/adapters/nextjs.d.ts +2 -2
  11. package/dist/adapters/nextjs.js +43 -20
  12. package/dist/adapters/nextjs.js.map +1 -1
  13. package/dist/adapters/nextjs.mjs +43 -20
  14. package/dist/adapters/nextjs.mjs.map +1 -1
  15. package/dist/adapters/sdk.d.mts +2 -2
  16. package/dist/adapters/sdk.d.ts +2 -2
  17. package/dist/adapters/sdk.js +25 -16
  18. package/dist/adapters/sdk.js.map +1 -1
  19. package/dist/adapters/sdk.mjs +25 -16
  20. package/dist/adapters/sdk.mjs.map +1 -1
  21. package/dist/agent/index.d.mts +2 -2
  22. package/dist/agent/index.d.ts +2 -2
  23. package/dist/agent/index.js +100 -1
  24. package/dist/agent/index.js.map +1 -1
  25. package/dist/agent/index.mjs +101 -1
  26. package/dist/agent/index.mjs.map +1 -1
  27. package/dist/browser/background.js +58 -16
  28. package/dist/browser/background.js.map +1 -1
  29. package/dist/browser/background.mjs +61 -16
  30. package/dist/browser/background.mjs.map +1 -1
  31. package/dist/browser/browser-adapter.d.mts +2 -2
  32. package/dist/browser/browser-adapter.d.ts +2 -2
  33. package/dist/cli/index.d.mts +2 -2
  34. package/dist/cli/index.d.ts +2 -2
  35. package/dist/cursor/cursor-adapter.d.mts +2 -2
  36. package/dist/cursor/cursor-adapter.d.ts +2 -2
  37. package/dist/cursor/extension.d.mts +2 -2
  38. package/dist/cursor/extension.d.ts +2 -2
  39. package/dist/cursor/extension.js +58 -16
  40. package/dist/cursor/extension.js.map +1 -1
  41. package/dist/cursor/extension.mjs +61 -16
  42. package/dist/cursor/extension.mjs.map +1 -1
  43. package/dist/{express-CtwDIZyF.d.mts → express-C9KqJNWV.d.mts} +1 -1
  44. package/dist/{express-Bcl-uBUE.d.ts → express-DpwYW08E.d.ts} +1 -1
  45. package/dist/gateway/gateway.d.mts +2 -2
  46. package/dist/gateway/gateway.d.ts +2 -2
  47. package/dist/gateway/gateway.js +58 -16
  48. package/dist/gateway/gateway.js.map +1 -1
  49. package/dist/gateway/gateway.mjs +61 -16
  50. package/dist/gateway/gateway.mjs.map +1 -1
  51. package/dist/git-trigger/git-hooks.d.mts +2 -2
  52. package/dist/git-trigger/git-hooks.d.ts +2 -2
  53. package/dist/{index-BY8yQ8N8.d.mts → index-BMZdjGT4.d.mts} +46 -3
  54. package/dist/index-DlsYN3Et.d.mts +1397 -0
  55. package/dist/{index-CtYSYwn3.d.ts → index-Dm2xA6j1.d.ts} +46 -3
  56. package/dist/index-gM-lgX_X.d.ts +1397 -0
  57. package/dist/index.d.mts +8 -7
  58. package/dist/index.d.ts +8 -7
  59. package/dist/index.js +2489 -66
  60. package/dist/index.js.map +1 -1
  61. package/dist/index.mjs +2492 -66
  62. package/dist/index.mjs.map +1 -1
  63. package/dist/local-evaluator/evaluator.d.mts +2 -2
  64. package/dist/local-evaluator/evaluator.d.ts +2 -2
  65. package/dist/{nextjs-BQyMCSx_.d.mts → nextjs-BEqidT0U.d.mts} +1 -1
  66. package/dist/{nextjs-CEldnIJ9.d.ts → nextjs-yNzimC3a.d.ts} +1 -1
  67. package/dist/{sdk-BhvuJSrH.d.mts → sdk-7fa9H0qa.d.mts} +1 -1
  68. package/dist/{sdk-BlyVSC_S.d.ts → sdk-CP9C9Qu0.d.ts} +1 -1
  69. package/dist/transport/index.d.mts +3 -2
  70. package/dist/transport/index.d.ts +3 -2
  71. package/dist/transport/index.js +2384 -2
  72. package/dist/transport/index.js.map +1 -1
  73. package/dist/transport/index.mjs +2327 -1
  74. package/dist/transport/index.mjs.map +1 -1
  75. package/dist/{types-CxQwJKbd.d.mts → types-CrVMq_Td.d.mts} +30 -3
  76. package/dist/{types-CxQwJKbd.d.ts → types-CrVMq_Td.d.ts} +30 -3
  77. package/dist/{types-jJnPXStc.d.mts → types-DE0ooQJ6.d.mts} +1 -1
  78. package/dist/{types-79qS7aON.d.ts → types-rigu2bH3.d.ts} +1 -1
  79. package/dist/ui/index.d.mts +1 -1
  80. package/dist/ui/index.d.ts +1 -1
  81. package/package.json +17 -3
  82. package/dist/index-B1ThcGZl.d.mts +0 -89
  83. package/dist/index-DnoXfdFd.d.ts +0 -89
@@ -1,4 +1,4 @@
1
- import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-CxQwJKbd.js';
1
+ import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-CrVMq_Td.js';
2
2
 
3
3
  /**
4
4
  * AgentClient — Credential Presentation
@@ -12,6 +12,10 @@ interface AgentClientConfig {
12
12
  verifyUrl?: string;
13
13
  challengeUrl?: string;
14
14
  pdlss?: AstraSyncCredentials['pdlss'];
15
+ /** Base URL for AstraSync API (used for ownership check). Defaults to api.astrasync.ai */
16
+ apiBaseUrl?: string;
17
+ /** API key used to authenticate ownership check + other authenticated calls. */
18
+ apiKey?: string;
15
19
  }
16
20
  interface FetchOptions extends RequestInit {
17
21
  purpose?: string;
@@ -19,7 +23,25 @@ interface FetchOptions extends RequestInit {
19
23
  }
20
24
  declare class AgentClient {
21
25
  private credentials;
26
+ private apiBaseUrl;
27
+ private apiKey;
22
28
  constructor(config: AgentClientConfig);
29
+ /**
30
+ * Async factory that validates the API key's account owns the configured
31
+ * ASTRA-id before returning a usable client. Refuses to initialise on
32
+ * mismatch so a stolen ASTRA-id cannot be paired with a valid (different)
33
+ * API key.
34
+ *
35
+ * Set env `ASTRASYNC_SKIP_OWNERSHIP_CHECK=true` to bypass — intended for
36
+ * test environments only.
37
+ */
38
+ static create(config: AgentClientConfig): Promise<AgentClient>;
39
+ /**
40
+ * Calls GET /api/agents/:astraId/ownership with the configured API key.
41
+ * Returns true only when the backend confirms this API key's account
42
+ * owns the configured agent.
43
+ */
44
+ private verifyOwnership;
23
45
  /**
24
46
  * Make an HTTP request with AstraSync headers automatically injected.
25
47
  */
@@ -183,6 +205,23 @@ interface RecordDecisionResult {
183
205
  */
184
206
  declare function recordDecision(config: GatewayConfig, params: RecordDecisionParams): Promise<RecordDecisionResult>;
185
207
 
208
+ /**
209
+ * Agent-side SDK errors.
210
+ */
211
+ declare class AstraSyncSdkError extends Error {
212
+ readonly code: string;
213
+ constructor(code: string, message: string);
214
+ }
215
+ /**
216
+ * Thrown when the API key used to initialise AgentClient is not owned by
217
+ * the same account that registered the configured ASTRA-id. Blocks the
218
+ * client from doing anything under a mismatched identity.
219
+ */
220
+ declare class OwnershipMismatchError extends AstraSyncSdkError {
221
+ readonly astraId: string;
222
+ constructor(astraId: string);
223
+ }
224
+
186
225
  /**
187
226
  * Agent-Side SDK Module
188
227
  *
@@ -192,15 +231,19 @@ declare function recordDecision(config: GatewayConfig, params: RecordDecisionPar
192
231
 
193
232
  type index_AgentClient = AgentClient;
194
233
  declare const index_AgentClient: typeof AgentClient;
234
+ type index_AstraSyncSdkError = AstraSyncSdkError;
235
+ declare const index_AstraSyncSdkError: typeof AstraSyncSdkError;
195
236
  type index_ChallengeHandler = ChallengeHandler;
196
237
  declare const index_ChallengeHandler: typeof ChallengeHandler;
238
+ type index_OwnershipMismatchError = OwnershipMismatchError;
239
+ declare const index_OwnershipMismatchError: typeof OwnershipMismatchError;
197
240
  type index_PDLSSConfig = PDLSSConfig;
198
241
  type index_TransportPDLSS = TransportPDLSS;
199
242
  declare const index_formatPDLSSForTransport: typeof formatPDLSSForTransport;
200
243
  declare const index_parsePDLSSFromTransport: typeof parsePDLSSFromTransport;
201
244
  declare const index_recordDecision: typeof recordDecision;
202
245
  declare namespace index {
203
- export { index_AgentClient as AgentClient, index_ChallengeHandler as ChallengeHandler, type index_PDLSSConfig as PDLSSConfig, type index_TransportPDLSS as TransportPDLSS, index_formatPDLSSForTransport as formatPDLSSForTransport, index_parsePDLSSFromTransport as parsePDLSSFromTransport, index_recordDecision as recordDecision };
246
+ export { index_AgentClient as AgentClient, index_AstraSyncSdkError as AstraSyncSdkError, index_ChallengeHandler as ChallengeHandler, index_OwnershipMismatchError as OwnershipMismatchError, type index_PDLSSConfig as PDLSSConfig, type index_TransportPDLSS as TransportPDLSS, index_formatPDLSSForTransport as formatPDLSSForTransport, index_parsePDLSSFromTransport as parsePDLSSFromTransport, index_recordDecision as recordDecision };
204
247
  }
205
248
 
206
- export { AgentClient as A, ChallengeHandler as C, type PDLSSConfig as P, type TransportPDLSS as T, formatPDLSSForTransport as f, index as i, parsePDLSSFromTransport as p, recordDecision as r };
249
+ export { AgentClient as A, ChallengeHandler as C, OwnershipMismatchError as O, type PDLSSConfig as P, type TransportPDLSS as T, AstraSyncSdkError as a, formatPDLSSForTransport as f, index as i, parsePDLSSFromTransport as p, recordDecision as r };