@bind-protocol/sdk 0.2.0 → 0.4.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/README.md +1 -0
- package/dist/{index-CASjN9Qe.d.ts → adapter-53dB8ogG.d.ts} +3 -67
- package/dist/{index-5j-fuebC.d.cts → adapter-DyAYLtIy.d.cts} +3 -67
- package/dist/adapters/dimo/index.d.cts +3 -2
- package/dist/adapters/dimo/index.d.ts +3 -2
- package/dist/adapters/index.cjs +499 -0
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +6 -2
- package/dist/adapters/index.d.ts +6 -2
- package/dist/adapters/index.js +497 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/zktls/index.cjs +503 -0
- package/dist/adapters/zktls/index.cjs.map +1 -0
- package/dist/adapters/zktls/index.d.cts +117 -0
- package/dist/adapters/zktls/index.d.ts +117 -0
- package/dist/adapters/zktls/index.js +499 -0
- package/dist/adapters/zktls/index.js.map +1 -0
- package/dist/client-BSwO4sTC.d.ts +135 -0
- package/dist/client-Bh8Di-5n.d.cts +135 -0
- package/dist/core/index.cjs +162 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +25 -61
- package/dist/core/index.d.ts +25 -61
- package/dist/core/index.js +159 -2
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +315 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +309 -2
- package/dist/index.js.map +1 -1
- package/dist/types-B6S0axfE.d.cts +200 -0
- package/dist/types-B6S0axfE.d.ts +200 -0
- package/dist/types-Be7Jc5V8.d.cts +68 -0
- package/dist/types-D1-qiyJO.d.ts +68 -0
- package/package.json +10 -2
- package/dist/types-o4sbOK_a.d.cts +0 -101
- package/dist/types-o4sbOK_a.d.ts +0 -101
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the Bind Protocol SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for BindClient
|
|
7
|
+
*/
|
|
8
|
+
interface BindClientOptions {
|
|
9
|
+
/** Your Bind Protocol API key */
|
|
10
|
+
apiKey: string;
|
|
11
|
+
/** API base URL (default: https://api.bindprotocol.com) */
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
type ProveJobStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
15
|
+
type ProveJobInputs = Record<string, string>;
|
|
16
|
+
interface ProveJobOutputs {
|
|
17
|
+
proofKey: string | null;
|
|
18
|
+
vkKey: string | null;
|
|
19
|
+
pubsKey: string | null;
|
|
20
|
+
proofHexKey: string | null;
|
|
21
|
+
vkHexKey: string | null;
|
|
22
|
+
pubsHexKey: string | null;
|
|
23
|
+
}
|
|
24
|
+
interface SubmitProveJobRequest {
|
|
25
|
+
circuitId: string;
|
|
26
|
+
inputs: ProveJobInputs;
|
|
27
|
+
}
|
|
28
|
+
interface ProveJob {
|
|
29
|
+
jobId: string;
|
|
30
|
+
status: ProveJobStatus;
|
|
31
|
+
circuitId: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
startedAt: string | null;
|
|
34
|
+
completedAt: string | null;
|
|
35
|
+
error: string | null;
|
|
36
|
+
outputs?: ProveJobOutputs;
|
|
37
|
+
attestationId?: string;
|
|
38
|
+
zkVerifyTxHash?: string;
|
|
39
|
+
}
|
|
40
|
+
interface ProveJobSummary {
|
|
41
|
+
jobId: string;
|
|
42
|
+
status: ProveJobStatus;
|
|
43
|
+
circuitId: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
startedAt: string | null;
|
|
46
|
+
completedAt: string | null;
|
|
47
|
+
error: string | null;
|
|
48
|
+
}
|
|
49
|
+
interface SubmitProveJobResponse {
|
|
50
|
+
success: boolean;
|
|
51
|
+
data?: {
|
|
52
|
+
jobId: string;
|
|
53
|
+
status: ProveJobStatus;
|
|
54
|
+
circuitId: string;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
};
|
|
57
|
+
error?: string;
|
|
58
|
+
requiredCredits?: number;
|
|
59
|
+
availableCredits?: number;
|
|
60
|
+
}
|
|
61
|
+
interface GetProveJobResponse {
|
|
62
|
+
success: boolean;
|
|
63
|
+
data?: ProveJob;
|
|
64
|
+
error?: string;
|
|
65
|
+
}
|
|
66
|
+
interface ListProveJobsOptions {
|
|
67
|
+
status?: ProveJobStatus;
|
|
68
|
+
limit?: number;
|
|
69
|
+
offset?: number;
|
|
70
|
+
}
|
|
71
|
+
interface ListProveJobsResponse {
|
|
72
|
+
success: boolean;
|
|
73
|
+
data?: {
|
|
74
|
+
jobs: ProveJobSummary[];
|
|
75
|
+
pagination: {
|
|
76
|
+
limit: number;
|
|
77
|
+
offset: number;
|
|
78
|
+
count: number;
|
|
79
|
+
total: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
error?: string;
|
|
83
|
+
}
|
|
84
|
+
type CircuitStatus = 'active' | 'disabled' | 'deprecated';
|
|
85
|
+
type CircuitValidationStatus = 'pending' | 'validating' | 'validated' | 'failed';
|
|
86
|
+
interface Circuit {
|
|
87
|
+
circuitId: string;
|
|
88
|
+
name: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
version: string;
|
|
91
|
+
status: CircuitStatus;
|
|
92
|
+
policyId?: string;
|
|
93
|
+
policyVersion?: string;
|
|
94
|
+
scheme: string;
|
|
95
|
+
validationStatus?: CircuitValidationStatus;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt?: string;
|
|
98
|
+
}
|
|
99
|
+
interface ListCircuitsResponse {
|
|
100
|
+
success: boolean;
|
|
101
|
+
data?: Circuit[];
|
|
102
|
+
error?: string;
|
|
103
|
+
}
|
|
104
|
+
interface GetCircuitResponse {
|
|
105
|
+
success: boolean;
|
|
106
|
+
data?: Circuit;
|
|
107
|
+
error?: string;
|
|
108
|
+
}
|
|
109
|
+
interface ActivateCircuitResponse {
|
|
110
|
+
success: boolean;
|
|
111
|
+
data?: {
|
|
112
|
+
circuitId: string;
|
|
113
|
+
status: CircuitStatus;
|
|
114
|
+
message: string;
|
|
115
|
+
};
|
|
116
|
+
error?: string;
|
|
117
|
+
validationStatus?: CircuitValidationStatus;
|
|
118
|
+
validationErrors?: unknown;
|
|
119
|
+
}
|
|
120
|
+
interface BindCredential {
|
|
121
|
+
/** The policy used to generate this credential */
|
|
122
|
+
policyId: string;
|
|
123
|
+
/** Prove job ID that generated the proof */
|
|
124
|
+
jobId: string;
|
|
125
|
+
/** zkVerify attestation ID (on-chain proof reference) */
|
|
126
|
+
attestationId?: string;
|
|
127
|
+
/** zkVerify transaction hash */
|
|
128
|
+
zkVerifyTxHash?: string;
|
|
129
|
+
/** Disclosed claims (visible to verifiers) */
|
|
130
|
+
claims: Record<string, unknown>;
|
|
131
|
+
/** Credential issuance timestamp */
|
|
132
|
+
issuedAt: string;
|
|
133
|
+
/** Credential expiration timestamp */
|
|
134
|
+
expiresAt?: string;
|
|
135
|
+
}
|
|
136
|
+
type ZkTlsSessionStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
|
|
137
|
+
interface ZkTlsExtractor {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
description: string;
|
|
141
|
+
claims: string[];
|
|
142
|
+
logo?: string;
|
|
143
|
+
enabled: boolean;
|
|
144
|
+
requiresOAuth: boolean;
|
|
145
|
+
oauthProvider?: string;
|
|
146
|
+
}
|
|
147
|
+
interface ZkTlsWitness {
|
|
148
|
+
id: string;
|
|
149
|
+
publicKey: string;
|
|
150
|
+
}
|
|
151
|
+
interface ZkTlsAttestation {
|
|
152
|
+
id: string;
|
|
153
|
+
extractor: string;
|
|
154
|
+
claims: Record<string, unknown>;
|
|
155
|
+
witness: ZkTlsWitness;
|
|
156
|
+
signature: string;
|
|
157
|
+
createdAt: number;
|
|
158
|
+
expiresAt: number;
|
|
159
|
+
url: string;
|
|
160
|
+
method: string;
|
|
161
|
+
}
|
|
162
|
+
interface ZkTlsSession {
|
|
163
|
+
id: string;
|
|
164
|
+
extractor: string;
|
|
165
|
+
status: ZkTlsSessionStatus;
|
|
166
|
+
error?: string;
|
|
167
|
+
attestation?: ZkTlsAttestation;
|
|
168
|
+
createdAt: number;
|
|
169
|
+
updatedAt: number;
|
|
170
|
+
}
|
|
171
|
+
interface ListExtractorsResponse {
|
|
172
|
+
success: boolean;
|
|
173
|
+
data?: ZkTlsExtractor[];
|
|
174
|
+
error?: string;
|
|
175
|
+
}
|
|
176
|
+
interface ListAttestationsResponse {
|
|
177
|
+
success: boolean;
|
|
178
|
+
data?: ZkTlsAttestation[];
|
|
179
|
+
error?: string;
|
|
180
|
+
}
|
|
181
|
+
interface GetAttestationResponse {
|
|
182
|
+
success: boolean;
|
|
183
|
+
data?: ZkTlsAttestation;
|
|
184
|
+
error?: string;
|
|
185
|
+
}
|
|
186
|
+
interface CreateSessionResponse {
|
|
187
|
+
success: boolean;
|
|
188
|
+
data?: {
|
|
189
|
+
sessionId: string;
|
|
190
|
+
authUrl: string;
|
|
191
|
+
};
|
|
192
|
+
error?: string;
|
|
193
|
+
}
|
|
194
|
+
interface GetSessionResponse {
|
|
195
|
+
success: boolean;
|
|
196
|
+
data?: ZkTlsSession;
|
|
197
|
+
error?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export type { ActivateCircuitResponse as A, BindClientOptions as B, CircuitStatus as C, GetProveJobResponse as G, ListProveJobsOptions as L, ProveJobStatus as P, SubmitProveJobRequest as S, ZkTlsSessionStatus as Z, ProveJobInputs as a, ProveJobOutputs as b, ProveJob as c, ProveJobSummary as d, SubmitProveJobResponse as e, ListProveJobsResponse as f, CircuitValidationStatus as g, Circuit as h, ListCircuitsResponse as i, GetCircuitResponse as j, BindCredential as k, ZkTlsExtractor as l, ZkTlsWitness as m, ZkTlsAttestation as n, ZkTlsSession as o, ListExtractorsResponse as p, ListAttestationsResponse as q, GetAttestationResponse as r, CreateSessionResponse as s, GetSessionResponse as t };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the Bind Protocol SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for BindClient
|
|
7
|
+
*/
|
|
8
|
+
interface BindClientOptions {
|
|
9
|
+
/** Your Bind Protocol API key */
|
|
10
|
+
apiKey: string;
|
|
11
|
+
/** API base URL (default: https://api.bindprotocol.com) */
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
type ProveJobStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
15
|
+
type ProveJobInputs = Record<string, string>;
|
|
16
|
+
interface ProveJobOutputs {
|
|
17
|
+
proofKey: string | null;
|
|
18
|
+
vkKey: string | null;
|
|
19
|
+
pubsKey: string | null;
|
|
20
|
+
proofHexKey: string | null;
|
|
21
|
+
vkHexKey: string | null;
|
|
22
|
+
pubsHexKey: string | null;
|
|
23
|
+
}
|
|
24
|
+
interface SubmitProveJobRequest {
|
|
25
|
+
circuitId: string;
|
|
26
|
+
inputs: ProveJobInputs;
|
|
27
|
+
}
|
|
28
|
+
interface ProveJob {
|
|
29
|
+
jobId: string;
|
|
30
|
+
status: ProveJobStatus;
|
|
31
|
+
circuitId: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
startedAt: string | null;
|
|
34
|
+
completedAt: string | null;
|
|
35
|
+
error: string | null;
|
|
36
|
+
outputs?: ProveJobOutputs;
|
|
37
|
+
attestationId?: string;
|
|
38
|
+
zkVerifyTxHash?: string;
|
|
39
|
+
}
|
|
40
|
+
interface ProveJobSummary {
|
|
41
|
+
jobId: string;
|
|
42
|
+
status: ProveJobStatus;
|
|
43
|
+
circuitId: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
startedAt: string | null;
|
|
46
|
+
completedAt: string | null;
|
|
47
|
+
error: string | null;
|
|
48
|
+
}
|
|
49
|
+
interface SubmitProveJobResponse {
|
|
50
|
+
success: boolean;
|
|
51
|
+
data?: {
|
|
52
|
+
jobId: string;
|
|
53
|
+
status: ProveJobStatus;
|
|
54
|
+
circuitId: string;
|
|
55
|
+
createdAt: string;
|
|
56
|
+
};
|
|
57
|
+
error?: string;
|
|
58
|
+
requiredCredits?: number;
|
|
59
|
+
availableCredits?: number;
|
|
60
|
+
}
|
|
61
|
+
interface GetProveJobResponse {
|
|
62
|
+
success: boolean;
|
|
63
|
+
data?: ProveJob;
|
|
64
|
+
error?: string;
|
|
65
|
+
}
|
|
66
|
+
interface ListProveJobsOptions {
|
|
67
|
+
status?: ProveJobStatus;
|
|
68
|
+
limit?: number;
|
|
69
|
+
offset?: number;
|
|
70
|
+
}
|
|
71
|
+
interface ListProveJobsResponse {
|
|
72
|
+
success: boolean;
|
|
73
|
+
data?: {
|
|
74
|
+
jobs: ProveJobSummary[];
|
|
75
|
+
pagination: {
|
|
76
|
+
limit: number;
|
|
77
|
+
offset: number;
|
|
78
|
+
count: number;
|
|
79
|
+
total: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
error?: string;
|
|
83
|
+
}
|
|
84
|
+
type CircuitStatus = 'active' | 'disabled' | 'deprecated';
|
|
85
|
+
type CircuitValidationStatus = 'pending' | 'validating' | 'validated' | 'failed';
|
|
86
|
+
interface Circuit {
|
|
87
|
+
circuitId: string;
|
|
88
|
+
name: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
version: string;
|
|
91
|
+
status: CircuitStatus;
|
|
92
|
+
policyId?: string;
|
|
93
|
+
policyVersion?: string;
|
|
94
|
+
scheme: string;
|
|
95
|
+
validationStatus?: CircuitValidationStatus;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt?: string;
|
|
98
|
+
}
|
|
99
|
+
interface ListCircuitsResponse {
|
|
100
|
+
success: boolean;
|
|
101
|
+
data?: Circuit[];
|
|
102
|
+
error?: string;
|
|
103
|
+
}
|
|
104
|
+
interface GetCircuitResponse {
|
|
105
|
+
success: boolean;
|
|
106
|
+
data?: Circuit;
|
|
107
|
+
error?: string;
|
|
108
|
+
}
|
|
109
|
+
interface ActivateCircuitResponse {
|
|
110
|
+
success: boolean;
|
|
111
|
+
data?: {
|
|
112
|
+
circuitId: string;
|
|
113
|
+
status: CircuitStatus;
|
|
114
|
+
message: string;
|
|
115
|
+
};
|
|
116
|
+
error?: string;
|
|
117
|
+
validationStatus?: CircuitValidationStatus;
|
|
118
|
+
validationErrors?: unknown;
|
|
119
|
+
}
|
|
120
|
+
interface BindCredential {
|
|
121
|
+
/** The policy used to generate this credential */
|
|
122
|
+
policyId: string;
|
|
123
|
+
/** Prove job ID that generated the proof */
|
|
124
|
+
jobId: string;
|
|
125
|
+
/** zkVerify attestation ID (on-chain proof reference) */
|
|
126
|
+
attestationId?: string;
|
|
127
|
+
/** zkVerify transaction hash */
|
|
128
|
+
zkVerifyTxHash?: string;
|
|
129
|
+
/** Disclosed claims (visible to verifiers) */
|
|
130
|
+
claims: Record<string, unknown>;
|
|
131
|
+
/** Credential issuance timestamp */
|
|
132
|
+
issuedAt: string;
|
|
133
|
+
/** Credential expiration timestamp */
|
|
134
|
+
expiresAt?: string;
|
|
135
|
+
}
|
|
136
|
+
type ZkTlsSessionStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
|
|
137
|
+
interface ZkTlsExtractor {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
description: string;
|
|
141
|
+
claims: string[];
|
|
142
|
+
logo?: string;
|
|
143
|
+
enabled: boolean;
|
|
144
|
+
requiresOAuth: boolean;
|
|
145
|
+
oauthProvider?: string;
|
|
146
|
+
}
|
|
147
|
+
interface ZkTlsWitness {
|
|
148
|
+
id: string;
|
|
149
|
+
publicKey: string;
|
|
150
|
+
}
|
|
151
|
+
interface ZkTlsAttestation {
|
|
152
|
+
id: string;
|
|
153
|
+
extractor: string;
|
|
154
|
+
claims: Record<string, unknown>;
|
|
155
|
+
witness: ZkTlsWitness;
|
|
156
|
+
signature: string;
|
|
157
|
+
createdAt: number;
|
|
158
|
+
expiresAt: number;
|
|
159
|
+
url: string;
|
|
160
|
+
method: string;
|
|
161
|
+
}
|
|
162
|
+
interface ZkTlsSession {
|
|
163
|
+
id: string;
|
|
164
|
+
extractor: string;
|
|
165
|
+
status: ZkTlsSessionStatus;
|
|
166
|
+
error?: string;
|
|
167
|
+
attestation?: ZkTlsAttestation;
|
|
168
|
+
createdAt: number;
|
|
169
|
+
updatedAt: number;
|
|
170
|
+
}
|
|
171
|
+
interface ListExtractorsResponse {
|
|
172
|
+
success: boolean;
|
|
173
|
+
data?: ZkTlsExtractor[];
|
|
174
|
+
error?: string;
|
|
175
|
+
}
|
|
176
|
+
interface ListAttestationsResponse {
|
|
177
|
+
success: boolean;
|
|
178
|
+
data?: ZkTlsAttestation[];
|
|
179
|
+
error?: string;
|
|
180
|
+
}
|
|
181
|
+
interface GetAttestationResponse {
|
|
182
|
+
success: boolean;
|
|
183
|
+
data?: ZkTlsAttestation;
|
|
184
|
+
error?: string;
|
|
185
|
+
}
|
|
186
|
+
interface CreateSessionResponse {
|
|
187
|
+
success: boolean;
|
|
188
|
+
data?: {
|
|
189
|
+
sessionId: string;
|
|
190
|
+
authUrl: string;
|
|
191
|
+
};
|
|
192
|
+
error?: string;
|
|
193
|
+
}
|
|
194
|
+
interface GetSessionResponse {
|
|
195
|
+
success: boolean;
|
|
196
|
+
data?: ZkTlsSession;
|
|
197
|
+
error?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export type { ActivateCircuitResponse as A, BindClientOptions as B, CircuitStatus as C, GetProveJobResponse as G, ListProveJobsOptions as L, ProveJobStatus as P, SubmitProveJobRequest as S, ZkTlsSessionStatus as Z, ProveJobInputs as a, ProveJobOutputs as b, ProveJob as c, ProveJobSummary as d, SubmitProveJobResponse as e, ListProveJobsResponse as f, CircuitValidationStatus as g, Circuit as h, ListCircuitsResponse as i, GetCircuitResponse as j, BindCredential as k, ZkTlsExtractor as l, ZkTlsWitness as m, ZkTlsAttestation as n, ZkTlsSession as o, ListExtractorsResponse as p, ListAttestationsResponse as q, GetAttestationResponse as r, CreateSessionResponse as s, GetSessionResponse as t };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { a as ProveJobInputs } from './types-B6S0axfE.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base types for data source adapters
|
|
5
|
+
*
|
|
6
|
+
* Adapters abstract away the data source specifics and provide a uniform
|
|
7
|
+
* interface for fetching data that can be used as circuit inputs.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Base interface for all data source adapters
|
|
12
|
+
* Each adapter knows how to fetch data from a specific source
|
|
13
|
+
* and transform it into circuit inputs.
|
|
14
|
+
*/
|
|
15
|
+
interface DataAdapter<TConfig = unknown, TQuery = unknown, TData = unknown> {
|
|
16
|
+
/** Unique identifier for this adapter */
|
|
17
|
+
readonly id: string;
|
|
18
|
+
/** Human-readable name */
|
|
19
|
+
readonly name: string;
|
|
20
|
+
/** Description of what data source this adapter connects to */
|
|
21
|
+
readonly description: string;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch raw data from the data source
|
|
24
|
+
* @param query - Adapter-specific query parameters
|
|
25
|
+
* @returns Raw data from the source
|
|
26
|
+
*/
|
|
27
|
+
fetchData(query: TQuery): Promise<TData>;
|
|
28
|
+
/**
|
|
29
|
+
* Transform raw data into circuit inputs
|
|
30
|
+
* @param data - Raw data from fetchData
|
|
31
|
+
* @param circuitId - Target circuit ID (adapters may support multiple circuits)
|
|
32
|
+
* @returns Inputs ready for prove job submission
|
|
33
|
+
*/
|
|
34
|
+
toCircuitInputs(data: TData, circuitId: string): ProveJobInputs;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Adapter registration entry
|
|
38
|
+
*/
|
|
39
|
+
interface AdapterRegistration<TConfig = unknown> {
|
|
40
|
+
/** Adapter factory function */
|
|
41
|
+
create: (config: TConfig) => DataAdapter;
|
|
42
|
+
/** Default configuration */
|
|
43
|
+
defaultConfig?: Partial<TConfig>;
|
|
44
|
+
/** Supported circuit IDs */
|
|
45
|
+
supportedCircuits: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Common telemetry data structure that adapters can transform their data into
|
|
49
|
+
*/
|
|
50
|
+
interface TelemetryData {
|
|
51
|
+
/** Array of telemetry signal readings */
|
|
52
|
+
signals: TelemetrySignal[];
|
|
53
|
+
/** Timestamp of the data collection period start */
|
|
54
|
+
periodStart: string;
|
|
55
|
+
/** Timestamp of the data collection period end */
|
|
56
|
+
periodEnd: string;
|
|
57
|
+
/** Subject identifier (e.g., vehicle ID) */
|
|
58
|
+
subjectId: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Individual telemetry signal reading
|
|
62
|
+
*/
|
|
63
|
+
interface TelemetrySignal {
|
|
64
|
+
timestamp: string;
|
|
65
|
+
[key: string]: string | number | boolean | string[] | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type { AdapterRegistration as A, DataAdapter as D, TelemetryData as T, TelemetrySignal as a };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { a as ProveJobInputs } from './types-B6S0axfE.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base types for data source adapters
|
|
5
|
+
*
|
|
6
|
+
* Adapters abstract away the data source specifics and provide a uniform
|
|
7
|
+
* interface for fetching data that can be used as circuit inputs.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Base interface for all data source adapters
|
|
12
|
+
* Each adapter knows how to fetch data from a specific source
|
|
13
|
+
* and transform it into circuit inputs.
|
|
14
|
+
*/
|
|
15
|
+
interface DataAdapter<TConfig = unknown, TQuery = unknown, TData = unknown> {
|
|
16
|
+
/** Unique identifier for this adapter */
|
|
17
|
+
readonly id: string;
|
|
18
|
+
/** Human-readable name */
|
|
19
|
+
readonly name: string;
|
|
20
|
+
/** Description of what data source this adapter connects to */
|
|
21
|
+
readonly description: string;
|
|
22
|
+
/**
|
|
23
|
+
* Fetch raw data from the data source
|
|
24
|
+
* @param query - Adapter-specific query parameters
|
|
25
|
+
* @returns Raw data from the source
|
|
26
|
+
*/
|
|
27
|
+
fetchData(query: TQuery): Promise<TData>;
|
|
28
|
+
/**
|
|
29
|
+
* Transform raw data into circuit inputs
|
|
30
|
+
* @param data - Raw data from fetchData
|
|
31
|
+
* @param circuitId - Target circuit ID (adapters may support multiple circuits)
|
|
32
|
+
* @returns Inputs ready for prove job submission
|
|
33
|
+
*/
|
|
34
|
+
toCircuitInputs(data: TData, circuitId: string): ProveJobInputs;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Adapter registration entry
|
|
38
|
+
*/
|
|
39
|
+
interface AdapterRegistration<TConfig = unknown> {
|
|
40
|
+
/** Adapter factory function */
|
|
41
|
+
create: (config: TConfig) => DataAdapter;
|
|
42
|
+
/** Default configuration */
|
|
43
|
+
defaultConfig?: Partial<TConfig>;
|
|
44
|
+
/** Supported circuit IDs */
|
|
45
|
+
supportedCircuits: string[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Common telemetry data structure that adapters can transform their data into
|
|
49
|
+
*/
|
|
50
|
+
interface TelemetryData {
|
|
51
|
+
/** Array of telemetry signal readings */
|
|
52
|
+
signals: TelemetrySignal[];
|
|
53
|
+
/** Timestamp of the data collection period start */
|
|
54
|
+
periodStart: string;
|
|
55
|
+
/** Timestamp of the data collection period end */
|
|
56
|
+
periodEnd: string;
|
|
57
|
+
/** Subject identifier (e.g., vehicle ID) */
|
|
58
|
+
subjectId: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Individual telemetry signal reading
|
|
62
|
+
*/
|
|
63
|
+
interface TelemetrySignal {
|
|
64
|
+
timestamp: string;
|
|
65
|
+
[key: string]: string | number | boolean | string[] | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type { AdapterRegistration as A, DataAdapter as D, TelemetryData as T, TelemetrySignal as a };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bind-protocol/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "TypeScript SDK for the Bind Protocol - privacy-preserving credential issuance and verification",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"types": "./dist/adapters/dimo/index.d.ts",
|
|
37
37
|
"import": "./dist/adapters/dimo/index.js",
|
|
38
38
|
"require": "./dist/adapters/dimo/index.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./adapters/zktls": {
|
|
41
|
+
"types": "./dist/adapters/zktls/index.d.ts",
|
|
42
|
+
"import": "./dist/adapters/zktls/index.js",
|
|
43
|
+
"require": "./dist/adapters/zktls/index.cjs"
|
|
39
44
|
}
|
|
40
45
|
},
|
|
41
46
|
"files": [
|
|
@@ -46,7 +51,9 @@
|
|
|
46
51
|
"scripts": {
|
|
47
52
|
"build": "tsup",
|
|
48
53
|
"dev": "tsup --watch",
|
|
49
|
-
"test": "vitest",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"test:watch": "vitest",
|
|
56
|
+
"test:coverage": "vitest run --coverage",
|
|
50
57
|
"typecheck": "tsc --noEmit",
|
|
51
58
|
"lint": "eslint src",
|
|
52
59
|
"clean": "rm -rf dist",
|
|
@@ -58,6 +65,7 @@
|
|
|
58
65
|
"devDependencies": {
|
|
59
66
|
"@dimo-network/data-sdk": "^1.4.0",
|
|
60
67
|
"@types/node": "^20.0.0",
|
|
68
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
61
69
|
"tsup": "^8.0.0",
|
|
62
70
|
"typescript": "^5.3.0",
|
|
63
71
|
"vitest": "^1.0.0"
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core types for the Bind Protocol SDK
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Configuration options for BindClient
|
|
7
|
-
*/
|
|
8
|
-
interface BindClientOptions {
|
|
9
|
-
/** Your Bind Protocol API key */
|
|
10
|
-
apiKey: string;
|
|
11
|
-
/** API base URL (default: https://api.bindprotocol.com) */
|
|
12
|
-
baseUrl?: string;
|
|
13
|
-
}
|
|
14
|
-
type ProveJobStatus = 'pending' | 'processing' | 'completed' | 'failed';
|
|
15
|
-
type ProveJobInputs = Record<string, string>;
|
|
16
|
-
interface ProveJobOutputs {
|
|
17
|
-
proofKey: string | null;
|
|
18
|
-
vkKey: string | null;
|
|
19
|
-
pubsKey: string | null;
|
|
20
|
-
proofHexKey: string | null;
|
|
21
|
-
vkHexKey: string | null;
|
|
22
|
-
pubsHexKey: string | null;
|
|
23
|
-
}
|
|
24
|
-
interface SubmitProveJobRequest {
|
|
25
|
-
circuitId: string;
|
|
26
|
-
inputs: ProveJobInputs;
|
|
27
|
-
}
|
|
28
|
-
interface ProveJob {
|
|
29
|
-
jobId: string;
|
|
30
|
-
status: ProveJobStatus;
|
|
31
|
-
circuitId: string;
|
|
32
|
-
createdAt: string;
|
|
33
|
-
startedAt: string | null;
|
|
34
|
-
completedAt: string | null;
|
|
35
|
-
error: string | null;
|
|
36
|
-
outputs?: ProveJobOutputs;
|
|
37
|
-
attestationId?: string;
|
|
38
|
-
zkVerifyTxHash?: string;
|
|
39
|
-
}
|
|
40
|
-
interface ProveJobSummary {
|
|
41
|
-
jobId: string;
|
|
42
|
-
status: ProveJobStatus;
|
|
43
|
-
circuitId: string;
|
|
44
|
-
createdAt: string;
|
|
45
|
-
startedAt: string | null;
|
|
46
|
-
completedAt: string | null;
|
|
47
|
-
error: string | null;
|
|
48
|
-
}
|
|
49
|
-
interface SubmitProveJobResponse {
|
|
50
|
-
success: boolean;
|
|
51
|
-
data?: {
|
|
52
|
-
jobId: string;
|
|
53
|
-
status: ProveJobStatus;
|
|
54
|
-
circuitId: string;
|
|
55
|
-
createdAt: string;
|
|
56
|
-
};
|
|
57
|
-
error?: string;
|
|
58
|
-
requiredCredits?: number;
|
|
59
|
-
availableCredits?: number;
|
|
60
|
-
}
|
|
61
|
-
interface GetProveJobResponse {
|
|
62
|
-
success: boolean;
|
|
63
|
-
data?: ProveJob;
|
|
64
|
-
error?: string;
|
|
65
|
-
}
|
|
66
|
-
interface ListProveJobsOptions {
|
|
67
|
-
status?: ProveJobStatus;
|
|
68
|
-
limit?: number;
|
|
69
|
-
offset?: number;
|
|
70
|
-
}
|
|
71
|
-
interface ListProveJobsResponse {
|
|
72
|
-
success: boolean;
|
|
73
|
-
data?: {
|
|
74
|
-
jobs: ProveJobSummary[];
|
|
75
|
-
pagination: {
|
|
76
|
-
limit: number;
|
|
77
|
-
offset: number;
|
|
78
|
-
count: number;
|
|
79
|
-
total: number;
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
error?: string;
|
|
83
|
-
}
|
|
84
|
-
interface BindCredential {
|
|
85
|
-
/** The policy used to generate this credential */
|
|
86
|
-
policyId: string;
|
|
87
|
-
/** Prove job ID that generated the proof */
|
|
88
|
-
jobId: string;
|
|
89
|
-
/** zkVerify attestation ID (on-chain proof reference) */
|
|
90
|
-
attestationId?: string;
|
|
91
|
-
/** zkVerify transaction hash */
|
|
92
|
-
zkVerifyTxHash?: string;
|
|
93
|
-
/** Disclosed claims (visible to verifiers) */
|
|
94
|
-
claims: Record<string, unknown>;
|
|
95
|
-
/** Credential issuance timestamp */
|
|
96
|
-
issuedAt: string;
|
|
97
|
-
/** Credential expiration timestamp */
|
|
98
|
-
expiresAt?: string;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export type { BindClientOptions as B, GetProveJobResponse as G, ListProveJobsOptions as L, ProveJobStatus as P, SubmitProveJobRequest as S, ProveJobInputs as a, ProveJobOutputs as b, ProveJob as c, ProveJobSummary as d, SubmitProveJobResponse as e, ListProveJobsResponse as f, BindCredential as g };
|