@bind-protocol/sdk 0.7.0 → 0.9.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 (36) hide show
  1. package/README.md +7 -11
  2. package/dist/{adapter-Cl7HtxU3.d.ts → adapter-J6D9MZJV.d.ts} +2 -2
  3. package/dist/{adapter-zyYSX6_e.d.cts → adapter-qe9f1ll3.d.cts} +2 -2
  4. package/dist/adapters/dimo/index.d.cts +3 -3
  5. package/dist/adapters/dimo/index.d.ts +3 -3
  6. package/dist/adapters/index.cjs +113 -137
  7. package/dist/adapters/index.cjs.map +1 -1
  8. package/dist/adapters/index.d.cts +4 -4
  9. package/dist/adapters/index.d.ts +4 -4
  10. package/dist/adapters/index.js +113 -137
  11. package/dist/adapters/index.js.map +1 -1
  12. package/dist/adapters/zktls/index.cjs +113 -137
  13. package/dist/adapters/zktls/index.cjs.map +1 -1
  14. package/dist/adapters/zktls/index.d.cts +3 -3
  15. package/dist/adapters/zktls/index.d.ts +3 -3
  16. package/dist/adapters/zktls/index.js +113 -137
  17. package/dist/adapters/zktls/index.js.map +1 -1
  18. package/dist/{client-CadOSqx6.d.ts → client-CfYXpFLk.d.cts} +70 -32
  19. package/dist/{client-BkohyCGJ.d.cts → client-CpJ87Xe0.d.ts} +70 -32
  20. package/dist/core/index.cjs +107 -124
  21. package/dist/core/index.cjs.map +1 -1
  22. package/dist/core/index.d.cts +2 -2
  23. package/dist/core/index.d.ts +2 -2
  24. package/dist/core/index.js +107 -124
  25. package/dist/core/index.js.map +1 -1
  26. package/dist/index.cjs +113 -137
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +4 -4
  29. package/dist/index.d.ts +4 -4
  30. package/dist/index.js +113 -137
  31. package/dist/index.js.map +1 -1
  32. package/dist/{types-Cz9q5U3r.d.cts → types-BcPssdQk.d.cts} +32 -174
  33. package/dist/{types-Cz9q5U3r.d.ts → types-BcPssdQk.d.ts} +32 -174
  34. package/dist/{types-Ca_xbN13.d.ts → types-D7Q7ymPa.d.ts} +1 -1
  35. package/dist/{types-DAN8BlbI.d.cts → types-ywkMNwun.d.cts} +1 -1
  36. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { PublicPolicySpec } from '@bind-protocol/policy-spec';
2
- import { B as BindClientOptions, a as ProveJobInputs, V as VerificationMode, f as SubmitProveJobResponse, G as GetProveJobResponse, L as ListProveJobsOptions, g as ListProveJobsResponse, d as ProveJob, q as ListExtractorsResponse, r as ListAttestationsResponse, s as GetAttestationResponse, t as CreateSessionResponse, u as GetSessionResponse, p as ZkTlsSession, j as ListCircuitsResponse, k as GetCircuitResponse, A as ActivateCircuitResponse, w as ShareProofRequest, x as ShareProofResponse, y as ListSharedProofsOptions, z as ListSharedProofsResponse, D as GetSharedProofResponse, R as RevokeSharedProofResponse, J as VerifySharedProofResponse, H as VerifyJobStatusResponse, M as VerifyUploadedProofResponse, O as GetVerificationHistoryOptions, Q as GetVerificationHistoryResponse } from './types-Cz9q5U3r.cjs';
2
+ import { B as BindClientOptions, c as ProveJobInputs, V as VerificationMode, S as SubmitProveJobResult, f as ProveJob, L as ListProveJobsOptions, g as ProveJobSummary, P as Pagination, a as PollOptions, k as ZkTlsExtractor, m as ZkTlsAttestation, n as ZkTlsSession, i as Circuit, A as ActivateCircuitResult, p as ShareProofRequest, o as SharedProof, q as ListSharedProofsOptions, R as RevokeSharedProofResult, s as VerificationResult, r as VerifyJobStatus, G as GetVerificationHistoryOptions, t as VerificationHistoryEntry } from './types-BcPssdQk.js';
3
3
 
4
4
  /**
5
5
  * BindClient - Main client for interacting with the Bind Protocol API
@@ -36,71 +36,85 @@ declare class BindClient {
36
36
  * - 'self_verify': Store in S3, client downloads and verifies locally
37
37
  */
38
38
  verificationMode?: VerificationMode;
39
- }): Promise<SubmitProveJobResponse>;
39
+ }): Promise<SubmitProveJobResult>;
40
40
  /**
41
41
  * Get the status and results of a prove job
42
42
  * @param jobId - The unique job identifier
43
43
  * @returns The job details including status and outputs
44
+ * @throws {ApiError} If the API request fails
44
45
  */
45
- getProveJob(jobId: string): Promise<GetProveJobResponse>;
46
+ getProveJob(jobId: string): Promise<ProveJob>;
46
47
  /**
47
48
  * List prove jobs for the authenticated organization
48
49
  * @param options - Optional filters for status, limit, and offset
49
50
  * @returns Paginated list of prove jobs
51
+ * @throws {ApiError} If the API request fails
50
52
  */
51
- listProveJobs(options?: ListProveJobsOptions): Promise<ListProveJobsResponse>;
53
+ listProveJobs(options?: ListProveJobsOptions): Promise<{
54
+ jobs: ProveJobSummary[];
55
+ pagination: Pagination;
56
+ }>;
52
57
  /**
53
58
  * Poll for prove job completion
54
59
  * @param jobId - The unique job identifier
55
60
  * @param options - Polling options
56
61
  * @returns The completed or failed job
57
62
  * @throws {TimeoutError} If the job doesn't complete within the timeout
63
+ * @throws {ApiError} If the API request fails
58
64
  */
59
- waitForProveJob(jobId: string, options?: {
60
- intervalMs?: number;
61
- timeoutMs?: number;
65
+ waitForProveJob(jobId: string, options?: PollOptions & {
62
66
  onProgress?: (job: ProveJob) => void;
63
67
  }): Promise<ProveJob>;
64
68
  /**
65
69
  * List all available public policies
66
70
  * @returns Array of public policy specifications
71
+ * @throws {ApiError} If the API request fails
67
72
  */
68
73
  listPolicies(): Promise<PublicPolicySpec[]>;
69
74
  /**
70
75
  * Get a specific policy by ID
71
76
  * @param policyId - The unique policy identifier
72
77
  * @returns The public policy specification, or null if not found
78
+ * @throws {ApiError} If the API request fails (except 404)
73
79
  */
74
80
  getPolicy(policyId: string): Promise<PublicPolicySpec | null>;
75
81
  /**
76
82
  * List available zkTLS extractors (data sources)
77
83
  * @returns Array of available extractors
84
+ * @throws {ApiError} If the API request fails
78
85
  */
79
- listExtractors(): Promise<ListExtractorsResponse>;
86
+ listExtractors(): Promise<ZkTlsExtractor[]>;
80
87
  /**
81
88
  * List zkTLS attestations for the authenticated organization
82
89
  * @returns Array of attestations
90
+ * @throws {ApiError} If the API request fails
83
91
  */
84
- listAttestations(): Promise<ListAttestationsResponse>;
92
+ listAttestations(): Promise<ZkTlsAttestation[]>;
85
93
  /**
86
94
  * Get a specific attestation by ID
87
95
  * @param attestationId - The attestation UUID
88
- * @returns The attestation or null if not found
96
+ * @returns The attestation details
97
+ * @throws {ApiError} If the API request fails
89
98
  */
90
- getAttestation(attestationId: string): Promise<GetAttestationResponse>;
99
+ getAttestation(attestationId: string): Promise<ZkTlsAttestation>;
91
100
  /**
92
101
  * Create a new zkTLS session for data attestation
93
102
  * @param extractorId - The extractor to use (e.g., "coinbase")
94
103
  * @param callbackUrl - URL to redirect to after authentication
95
104
  * @returns Session ID and auth URL to redirect user to
105
+ * @throws {ApiError} If the API request fails
96
106
  */
97
- createZkTlsSession(extractorId: string, callbackUrl: string): Promise<CreateSessionResponse>;
107
+ createZkTlsSession(extractorId: string, callbackUrl: string): Promise<{
108
+ sessionId: string;
109
+ authUrl: string;
110
+ }>;
98
111
  /**
99
112
  * Get the status of a zkTLS session
100
113
  * @param sessionId - The session UUID
101
114
  * @returns Session status and attestation if completed
115
+ * @throws {ApiError} If the API request fails
102
116
  */
103
- getZkTlsSession(sessionId: string): Promise<GetSessionResponse>;
117
+ getZkTlsSession(sessionId: string): Promise<ZkTlsSession>;
104
118
  /**
105
119
  * Wait for a zkTLS session to complete
106
120
  * @param sessionId - The session UUID
@@ -109,57 +123,66 @@ declare class BindClient {
109
123
  * @throws {ZkTlsSessionExpiredError} If session expires
110
124
  * @throws {ZkTlsSessionFailedError} If session fails
111
125
  * @throws {TimeoutError} If timeout is reached
126
+ * @throws {ApiError} If the API request fails
112
127
  */
113
- waitForZkTlsSession(sessionId: string, options?: {
114
- intervalMs?: number;
115
- timeoutMs?: number;
128
+ waitForZkTlsSession(sessionId: string, options?: PollOptions & {
116
129
  onProgress?: (session: ZkTlsSession) => void;
117
130
  }): Promise<ZkTlsSession>;
118
131
  /**
119
132
  * List available circuits
120
133
  * @param options - Optional filters
121
134
  * @returns Array of circuits
135
+ * @throws {ApiError} If the API request fails
122
136
  */
123
137
  listCircuits(options?: {
124
138
  status?: 'active' | 'all';
125
139
  policyId?: string;
126
- }): Promise<ListCircuitsResponse>;
140
+ }): Promise<Circuit[]>;
127
141
  /**
128
142
  * Get a specific circuit by ID
129
143
  * @param circuitId - The circuit identifier
130
- * @returns The circuit details or null if not found
144
+ * @returns The circuit details
145
+ * @throws {ApiError} If the API request fails
131
146
  */
132
- getCircuit(circuitId: string): Promise<GetCircuitResponse>;
147
+ getCircuit(circuitId: string): Promise<Circuit>;
133
148
  /**
134
149
  * Activate a circuit (requires validation to have passed)
135
150
  * @param circuitId - The circuit identifier to activate
136
151
  * @returns The activation result
152
+ * @throws {ApiError} If the API request fails
137
153
  */
138
- activateCircuit(circuitId: string): Promise<ActivateCircuitResponse>;
154
+ activateCircuit(circuitId: string): Promise<ActivateCircuitResult>;
139
155
  /**
140
156
  * Share a completed proof with a verifier organization
141
157
  * @param request - Share proof request with proveJobId and verifierOrgId
142
158
  * @returns The created shared proof
159
+ * @throws {ApiError} If the API request fails
143
160
  */
144
- shareProof(request: ShareProofRequest): Promise<ShareProofResponse>;
161
+ shareProof(request: ShareProofRequest): Promise<SharedProof>;
145
162
  /**
146
163
  * List shared proofs (outgoing or incoming)
147
164
  * @param options - Filter by direction, pagination, and inclusion options
148
165
  * @returns Paginated list of shared proofs
166
+ * @throws {ApiError} If the API request fails
149
167
  */
150
- listSharedProofs(options?: ListSharedProofsOptions): Promise<ListSharedProofsResponse>;
168
+ listSharedProofs(options?: ListSharedProofsOptions): Promise<{
169
+ shares: SharedProof[];
170
+ pagination: Pagination;
171
+ }>;
151
172
  /**
152
173
  * Get a specific shared proof by ID
153
174
  * @param sharedProofId - The shared proof ID
154
175
  * @returns The shared proof details
176
+ * @throws {ApiError} If the API request fails
155
177
  */
156
- getSharedProof(sharedProofId: string): Promise<GetSharedProofResponse>;
178
+ getSharedProof(sharedProofId: string): Promise<SharedProof>;
157
179
  /**
158
180
  * Revoke a shared proof. Only the sharing organization can revoke.
159
181
  * @param sharedProofId - The shared proof ID to revoke
160
182
  * @returns The revocation result
183
+ * @throws {ApiError} If the API request fails
161
184
  */
162
- revokeSharedProof(sharedProofId: string): Promise<RevokeSharedProofResponse>;
185
+ revokeSharedProof(sharedProofId: string): Promise<RevokeSharedProofResult>;
163
186
  /**
164
187
  * Verify a shared proof
165
188
  *
@@ -169,31 +192,46 @@ declare class BindClient {
169
192
  * @param sharedProofId - The shared proof ID to verify
170
193
  * @param options - Optional polling configuration
171
194
  * @returns The verification result
195
+ * @throws {ApiError} If the API request fails
196
+ * @throws {TimeoutError} If verification doesn't complete within the timeout
172
197
  */
173
- verifySharedProof(sharedProofId: string, options?: {
174
- pollIntervalMs?: number;
175
- maxWaitMs?: number;
176
- }): Promise<VerifySharedProofResponse>;
198
+ verifySharedProof(sharedProofId: string, options?: PollOptions): Promise<VerificationResult>;
177
199
  /**
178
200
  * Get the status of a verification job
179
201
  * @param jobId - The verification job ID
180
- * @returns The job status
202
+ * @returns The job status data
203
+ * @throws {ApiError} If the API request fails
181
204
  */
182
- getVerifyJobStatus(jobId: string): Promise<VerifyJobStatusResponse>;
205
+ getVerifyJobStatus(jobId: string): Promise<{
206
+ status: VerifyJobStatus;
207
+ isValid?: boolean;
208
+ error?: string;
209
+ verificationTimeMs?: number;
210
+ creditsCharged: number;
211
+ verificationResultId?: string;
212
+ publicInputs?: string[];
213
+ publicInputsMatch?: boolean;
214
+ }>;
183
215
  /**
184
216
  * Verify an uploaded proof
185
217
  * @param proofBuffer - The proof binary as ArrayBuffer, Uint8Array, or Buffer
186
218
  * @param vkBuffer - The verification key binary as ArrayBuffer, Uint8Array, or Buffer
187
219
  * @returns The verification result
220
+ * @throws {ApiError} If the API request fails
188
221
  */
189
- verifyUploadedProof(proofBuffer: ArrayBuffer | Uint8Array, vkBuffer: ArrayBuffer | Uint8Array): Promise<VerifyUploadedProofResponse>;
222
+ verifyUploadedProof(proofBuffer: ArrayBuffer | Uint8Array, vkBuffer: ArrayBuffer | Uint8Array): Promise<VerificationResult>;
190
223
  /**
191
224
  * Get verification history for the authenticated organization
192
225
  * @param options - Pagination options
193
226
  * @returns Paginated list of verification results
227
+ * @throws {ApiError} If the API request fails
194
228
  */
195
- getVerificationHistory(options?: GetVerificationHistoryOptions): Promise<GetVerificationHistoryResponse>;
229
+ getVerificationHistory(options?: GetVerificationHistoryOptions): Promise<{
230
+ results: VerificationHistoryEntry[];
231
+ pagination: Pagination;
232
+ }>;
196
233
  private fetch;
234
+ private fetchJson;
197
235
  private sleep;
198
236
  }
199
237