@enactprotocol/api 2.0.0 → 2.0.1

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.
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Trust configuration management (v2)
3
+ * Functions for managing user trust settings
4
+ */
5
+ import type { EnactApiClient } from "./client";
6
+ import type { UserTrustConfig } from "./types";
7
+ /**
8
+ * Get a user's trust configuration (v2)
9
+ *
10
+ * This is public information - anyone can see which auditors a user trusts.
11
+ *
12
+ * @param client - API client instance
13
+ * @param username - Username to look up
14
+ * @returns User's trust configuration
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const trustConfig = await getUserTrust(client, "alice");
19
+ * console.log(`Alice trusts ${trustConfig.trusted_auditors.length} auditors`);
20
+ * ```
21
+ */
22
+ export declare function getUserTrust(client: EnactApiClient, username: string): Promise<UserTrustConfig>;
23
+ /**
24
+ * Update current user's trust configuration (v2)
25
+ *
26
+ * Replace the entire list of trusted auditors.
27
+ *
28
+ * @param client - API client instance (must be authenticated)
29
+ * @param trustedAuditors - Array of auditor emails to trust
30
+ * @returns Updated trust configuration
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const updated = await updateMyTrust(client, [
35
+ * "security@example.com",
36
+ * "bob@github.com",
37
+ * "audit-team@company.com"
38
+ * ]);
39
+ * console.log(`Now trusting ${updated.trusted_auditors.length} auditors`);
40
+ * ```
41
+ */
42
+ export declare function updateMyTrust(client: EnactApiClient, trustedAuditors: string[]): Promise<{
43
+ trustedAuditors: Array<{
44
+ identity: string;
45
+ addedAt: Date;
46
+ }>;
47
+ updatedAt: Date;
48
+ }>;
49
+ /**
50
+ * Add an auditor to the current user's trust list
51
+ *
52
+ * This is a convenience wrapper that fetches current trust config,
53
+ * adds the auditor if not already present, and updates.
54
+ *
55
+ * @param client - API client instance (must be authenticated)
56
+ * @param auditorEmail - Auditor email to trust
57
+ * @returns Updated trust configuration
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * await addTrustedAuditor(client, "new-auditor@example.com");
62
+ * ```
63
+ */
64
+ export declare function addTrustedAuditor(client: EnactApiClient, auditorEmail: string): Promise<{
65
+ trustedAuditors: Array<{
66
+ identity: string;
67
+ addedAt: Date;
68
+ }>;
69
+ updatedAt: Date;
70
+ }>;
71
+ /**
72
+ * Remove an auditor from the current user's trust list
73
+ *
74
+ * This is a convenience wrapper that fetches current trust config,
75
+ * removes the auditor if present, and updates.
76
+ *
77
+ * @param client - API client instance (must be authenticated)
78
+ * @param auditorEmail - Auditor email to remove
79
+ * @returns Updated trust configuration
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await removeTrustedAuditor(client, "old-auditor@example.com");
84
+ * ```
85
+ */
86
+ export declare function removeTrustedAuditor(client: EnactApiClient, auditorEmail: string): Promise<{
87
+ trustedAuditors: Array<{
88
+ identity: string;
89
+ addedAt: Date;
90
+ }>;
91
+ updatedAt: Date;
92
+ }>;
93
+ /**
94
+ * Check if a user trusts a specific auditor
95
+ *
96
+ * @param client - API client instance
97
+ * @param username - Username to check
98
+ * @param auditorEmail - Auditor email to check
99
+ * @returns True if the user trusts this auditor
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const trusts = await userTrustsAuditor(client, "alice", "security@example.com");
104
+ * if (trusts) {
105
+ * console.log("Alice trusts this auditor");
106
+ * }
107
+ * ```
108
+ */
109
+ export declare function userTrustsAuditor(client: EnactApiClient, username: string, auditorEmail: string): Promise<boolean>;
110
+ /**
111
+ * Get list of auditors trusted by the current user
112
+ *
113
+ * @param client - API client instance (must be authenticated)
114
+ * @returns Array of trusted auditor emails
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const auditors = await getMyTrustedAuditors(client);
119
+ * console.log(`You trust: ${auditors.join(", ")}`);
120
+ * ```
121
+ */
122
+ export declare function getMyTrustedAuditors(client: EnactApiClient): Promise<string[]>;
123
+ //# sourceMappingURL=trust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.d.ts","sourceRoot":"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B,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASpF"}
package/dist/trust.js ADDED
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Trust configuration management (v2)
3
+ * Functions for managing user trust settings
4
+ */
5
+ /**
6
+ * Get a user's trust configuration (v2)
7
+ *
8
+ * This is public information - anyone can see which auditors a user trusts.
9
+ *
10
+ * @param client - API client instance
11
+ * @param username - Username to look up
12
+ * @returns User's trust configuration
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const trustConfig = await getUserTrust(client, "alice");
17
+ * console.log(`Alice trusts ${trustConfig.trusted_auditors.length} auditors`);
18
+ * ```
19
+ */
20
+ export async function getUserTrust(client, username) {
21
+ const response = await client.get(`/users/${username}/trust`);
22
+ return response.data;
23
+ }
24
+ /**
25
+ * Update current user's trust configuration (v2)
26
+ *
27
+ * Replace the entire list of trusted auditors.
28
+ *
29
+ * @param client - API client instance (must be authenticated)
30
+ * @param trustedAuditors - Array of auditor emails to trust
31
+ * @returns Updated trust configuration
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const updated = await updateMyTrust(client, [
36
+ * "security@example.com",
37
+ * "bob@github.com",
38
+ * "audit-team@company.com"
39
+ * ]);
40
+ * console.log(`Now trusting ${updated.trusted_auditors.length} auditors`);
41
+ * ```
42
+ */
43
+ export async function updateMyTrust(client, trustedAuditors) {
44
+ const response = await client.put("/users/me/trust", {
45
+ trusted_auditors: trustedAuditors,
46
+ });
47
+ return {
48
+ trustedAuditors: response.data.trusted_auditors.map((ta) => ({
49
+ identity: ta.identity,
50
+ addedAt: new Date(ta.added_at),
51
+ })),
52
+ updatedAt: new Date(response.data.updated_at),
53
+ };
54
+ }
55
+ /**
56
+ * Add an auditor to the current user's trust list
57
+ *
58
+ * This is a convenience wrapper that fetches current trust config,
59
+ * adds the auditor if not already present, and updates.
60
+ *
61
+ * @param client - API client instance (must be authenticated)
62
+ * @param auditorEmail - Auditor email to trust
63
+ * @returns Updated trust configuration
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * await addTrustedAuditor(client, "new-auditor@example.com");
68
+ * ```
69
+ */
70
+ export async function addTrustedAuditor(client, auditorEmail) {
71
+ // First get current user to know their username
72
+ const currentUser = await client.get("/auth/me");
73
+ const username = currentUser.data.username;
74
+ // Get current trust config
75
+ const currentTrust = await getUserTrust(client, username);
76
+ // Add new auditor if not already present
77
+ const currentAuditors = currentTrust.trusted_auditors.map((ta) => ta.identity);
78
+ if (!currentAuditors.includes(auditorEmail)) {
79
+ currentAuditors.push(auditorEmail);
80
+ }
81
+ // Update trust config
82
+ return updateMyTrust(client, currentAuditors);
83
+ }
84
+ /**
85
+ * Remove an auditor from the current user's trust list
86
+ *
87
+ * This is a convenience wrapper that fetches current trust config,
88
+ * removes the auditor if present, and updates.
89
+ *
90
+ * @param client - API client instance (must be authenticated)
91
+ * @param auditorEmail - Auditor email to remove
92
+ * @returns Updated trust configuration
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * await removeTrustedAuditor(client, "old-auditor@example.com");
97
+ * ```
98
+ */
99
+ export async function removeTrustedAuditor(client, auditorEmail) {
100
+ // First get current user to know their username
101
+ const currentUser = await client.get("/auth/me");
102
+ const username = currentUser.data.username;
103
+ // Get current trust config
104
+ const currentTrust = await getUserTrust(client, username);
105
+ // Remove auditor
106
+ const updatedAuditors = currentTrust.trusted_auditors
107
+ .map((ta) => ta.identity)
108
+ .filter((email) => email !== auditorEmail);
109
+ // Update trust config
110
+ return updateMyTrust(client, updatedAuditors);
111
+ }
112
+ /**
113
+ * Check if a user trusts a specific auditor
114
+ *
115
+ * @param client - API client instance
116
+ * @param username - Username to check
117
+ * @param auditorEmail - Auditor email to check
118
+ * @returns True if the user trusts this auditor
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const trusts = await userTrustsAuditor(client, "alice", "security@example.com");
123
+ * if (trusts) {
124
+ * console.log("Alice trusts this auditor");
125
+ * }
126
+ * ```
127
+ */
128
+ export async function userTrustsAuditor(client, username, auditorEmail) {
129
+ const trustConfig = await getUserTrust(client, username);
130
+ return trustConfig.trusted_auditors.some((ta) => ta.identity === auditorEmail);
131
+ }
132
+ /**
133
+ * Get list of auditors trusted by the current user
134
+ *
135
+ * @param client - API client instance (must be authenticated)
136
+ * @returns Array of trusted auditor emails
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * const auditors = await getMyTrustedAuditors(client);
141
+ * console.log(`You trust: ${auditors.join(", ")}`);
142
+ * ```
143
+ */
144
+ export async function getMyTrustedAuditors(client) {
145
+ // First get current user to know their username
146
+ const currentUser = await client.get("/auth/me");
147
+ const username = currentUser.data.username;
148
+ // Get trust config
149
+ const trustConfig = await getUserTrust(client, username);
150
+ return trustConfig.trusted_auditors.map((ta) => ta.identity);
151
+ }
152
+ //# sourceMappingURL=trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.js","sourceRoot":"","sources":["../src/trust.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAsB,EACtB,QAAgB;IAEhB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAkB,UAAU,QAAQ,QAAQ,CAAC,CAAC;IAC/E,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAsB,EACtB,eAAyB;IAQzB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAA4B,iBAAiB,EAAE;QAC9E,gBAAgB,EAAE,eAAe;KACN,CAAC,CAAC;IAE/B,OAAO;QACL,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CA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C;IAE1D,iBAAiB;IACjB,MAAM,eAAe,GAAG,YAAY,CAAC,gBAAgB;SAClD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;IAE7C,sBAAsB;IACtB,OAAO,aAAa,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAsB,EACtB,QAAgB,EAChB,YAAoB;IAEpB,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,OAAO,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC;AACjF,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAsB;IAC/D,gDAAgD;IAChD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,GAAG,CAAuB,UAAU,CAAC,CAAC;IACvE,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC;IAE3C,mBAAmB;IACnB,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEzD,OAAO,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,421 @@
1
+ /**
2
+ * TypeScript types for Enact Registry API v2
3
+ * Based on docs/API.md and docs/REGISTRY-SPEC.md specification
4
+ */
5
+ /**
6
+ * API error response
7
+ */
8
+ export interface ApiError {
9
+ error: {
10
+ code: string;
11
+ message: string;
12
+ details?: Record<string, unknown> | undefined;
13
+ };
14
+ }
15
+ /**
16
+ * OAuth provider types
17
+ */
18
+ export type OAuthProvider = "github" | "google" | "microsoft";
19
+ /**
20
+ * Author/user information from API
21
+ */
22
+ export interface ApiAuthor {
23
+ username: string;
24
+ avatar_url?: string | undefined;
25
+ }
26
+ /**
27
+ * Version metadata object (v2)
28
+ */
29
+ export interface VersionMetadata {
30
+ /** Version string (e.g., "1.2.0") */
31
+ version: string;
32
+ /** Publication timestamp */
33
+ published_at: string;
34
+ /** Download count for this version */
35
+ downloads: number;
36
+ /** SHA-256 hash of bundle */
37
+ bundle_hash: string;
38
+ /** Bundle size in bytes */
39
+ bundle_size?: number | undefined;
40
+ /** Whether this version is yanked */
41
+ yanked: boolean;
42
+ /** Attestation summary (optional) */
43
+ attestation_summary?: {
44
+ auditor_count: number;
45
+ } | undefined;
46
+ }
47
+ /**
48
+ * Tool search result item
49
+ */
50
+ export interface ToolSearchResult {
51
+ /** Tool name (e.g., "alice/utils/greeter") */
52
+ name: string;
53
+ /** Tool description */
54
+ description: string;
55
+ /** Tool tags */
56
+ tags: string[];
57
+ /** Latest published version */
58
+ version: string;
59
+ /** Tool author */
60
+ author: ApiAuthor;
61
+ /** Total downloads */
62
+ downloads: number;
63
+ /** Trust status */
64
+ trust_status?: {
65
+ auditor_count: number;
66
+ } | undefined;
67
+ }
68
+ /**
69
+ * Tool metadata from GET /tools/{name}
70
+ */
71
+ export interface ToolMetadata {
72
+ /** Tool name */
73
+ name: string;
74
+ /** Tool description */
75
+ description: string;
76
+ /** Tool tags */
77
+ tags: string[];
78
+ /** SPDX license identifier */
79
+ license: string;
80
+ /** Tool author */
81
+ author: ApiAuthor;
82
+ /** Repository URL */
83
+ repository?: string | undefined;
84
+ /** Homepage URL */
85
+ homepage?: string | undefined;
86
+ /** Creation timestamp */
87
+ created_at: string;
88
+ /** Last update timestamp */
89
+ updated_at: string;
90
+ /** Latest version */
91
+ latest_version: string;
92
+ /** Version list (paginated) */
93
+ versions: VersionMetadata[];
94
+ /** Total number of versions */
95
+ versions_total: number;
96
+ /** Total downloads across all versions */
97
+ total_downloads: number;
98
+ }
99
+ /**
100
+ * Bundle information
101
+ */
102
+ export interface BundleInfo {
103
+ /** SHA-256 hash */
104
+ hash: string;
105
+ /** Size in bytes */
106
+ size: number;
107
+ /** Download URL */
108
+ download_url: string;
109
+ }
110
+ /**
111
+ * Tool version details from GET /tools/{name}/versions/{version}
112
+ */
113
+ export interface ToolVersionDetails {
114
+ /** Tool name */
115
+ name: string;
116
+ /** Version */
117
+ version: string;
118
+ /** Tool description */
119
+ description: string;
120
+ /** SPDX license identifier */
121
+ license: string;
122
+ /** Whether this version is yanked */
123
+ yanked: boolean;
124
+ /** Yank reason (if yanked) */
125
+ yank_reason?: string | undefined;
126
+ /** Replacement version (if yanked) */
127
+ yank_replacement?: string | undefined;
128
+ /** When it was yanked */
129
+ yanked_at?: string | undefined;
130
+ /** Full manifest object */
131
+ manifest: Record<string, unknown>;
132
+ /** Bundle information */
133
+ bundle: BundleInfo;
134
+ /** List of attestations */
135
+ attestations: Attestation[];
136
+ /** Who published this version */
137
+ published_by: ApiAuthor;
138
+ /** Publication timestamp */
139
+ published_at: string;
140
+ /** Download count for this version */
141
+ downloads: number;
142
+ }
143
+ /**
144
+ * Single attestation record (v2 - auditor-only)
145
+ */
146
+ export interface Attestation {
147
+ /** Auditor email (from Sigstore certificate) */
148
+ auditor: string;
149
+ /** OAuth provider used for attestation */
150
+ auditor_provider: string;
151
+ /** Signing timestamp */
152
+ signed_at: string;
153
+ /** Rekor transparency log ID */
154
+ rekor_log_id: string;
155
+ /** Rekor transparency log index */
156
+ rekor_log_index?: number | undefined;
157
+ /** Verification status */
158
+ verification?: {
159
+ verified: boolean;
160
+ verified_at: string;
161
+ rekor_verified: boolean;
162
+ certificate_verified: boolean;
163
+ signature_verified: boolean;
164
+ } | undefined;
165
+ }
166
+ /**
167
+ * Feedback aggregates from GET /tools/{name}/feedback
168
+ */
169
+ export interface FeedbackAggregates {
170
+ /** Average rating (1-5) */
171
+ rating: number;
172
+ /** Number of ratings */
173
+ rating_count: number;
174
+ /** Total downloads */
175
+ downloads: number;
176
+ }
177
+ /**
178
+ * User profile from GET /users/{username}
179
+ */
180
+ export interface UserProfile {
181
+ /** Username */
182
+ username: string;
183
+ /** Display name */
184
+ display_name?: string | undefined;
185
+ /** Avatar URL */
186
+ avatar_url?: string | undefined;
187
+ /** Account creation date */
188
+ created_at: string;
189
+ /** Number of tools published */
190
+ tools_count?: number | undefined;
191
+ }
192
+ /**
193
+ * Current user info from GET /auth/me (v2)
194
+ */
195
+ export interface CurrentUser {
196
+ /** User ID */
197
+ id: string;
198
+ /** Username */
199
+ username: string;
200
+ /** Email address */
201
+ email: string;
202
+ /** Namespaces the user owns */
203
+ namespaces: string[];
204
+ /** Account creation date */
205
+ created_at: string;
206
+ }
207
+ /**
208
+ * OAuth login request
209
+ */
210
+ export interface OAuthLoginRequest {
211
+ /** OAuth provider */
212
+ provider: OAuthProvider;
213
+ /** Redirect URI for callback */
214
+ redirect_uri: string;
215
+ }
216
+ /**
217
+ * OAuth login response
218
+ */
219
+ export interface OAuthLoginResponse {
220
+ /** Authorization URL to redirect user to */
221
+ auth_url: string;
222
+ }
223
+ /**
224
+ * OAuth callback request
225
+ */
226
+ export interface OAuthCallbackRequest {
227
+ /** OAuth provider */
228
+ provider: OAuthProvider;
229
+ /** Authorization code from OAuth provider */
230
+ code: string;
231
+ }
232
+ /**
233
+ * OAuth token response
234
+ */
235
+ export interface OAuthTokenResponse {
236
+ /** Access token (JWT) */
237
+ access_token: string;
238
+ /** Refresh token */
239
+ refresh_token: string;
240
+ /** Token expiration in seconds */
241
+ expires_in: number;
242
+ /** User information */
243
+ user: {
244
+ id: string;
245
+ username: string;
246
+ email: string;
247
+ };
248
+ }
249
+ /**
250
+ * Refresh token request
251
+ */
252
+ export interface RefreshTokenRequest {
253
+ /** Refresh token */
254
+ refresh_token: string;
255
+ }
256
+ /**
257
+ * Refresh token response
258
+ */
259
+ export interface RefreshTokenResponse {
260
+ /** New access token */
261
+ access_token: string;
262
+ /** Token expiration in seconds */
263
+ expires_in: number;
264
+ }
265
+ /**
266
+ * Publish response from POST /tools/{name} (v2 - single POST)
267
+ */
268
+ export interface PublishResponse {
269
+ /** Tool name */
270
+ name: string;
271
+ /** Published version */
272
+ version: string;
273
+ /** Bundle hash */
274
+ bundle_hash: string;
275
+ /** Bundle size */
276
+ bundle_size: number;
277
+ /** Download URL */
278
+ download_url: string;
279
+ /** Publication timestamp */
280
+ published_at: string;
281
+ }
282
+ /**
283
+ * Yank version request
284
+ */
285
+ export interface YankVersionRequest {
286
+ /** Reason for yanking */
287
+ reason?: string | undefined;
288
+ /** Replacement version to recommend */
289
+ replacement_version?: string | undefined;
290
+ }
291
+ /**
292
+ * Yank version response
293
+ */
294
+ export interface YankVersionResponse {
295
+ /** Whether version is yanked */
296
+ yanked: true;
297
+ /** Version that was yanked */
298
+ version: string;
299
+ /** Reason for yanking */
300
+ reason?: string | undefined;
301
+ /** Replacement version */
302
+ replacement_version?: string | undefined;
303
+ /** When it was yanked */
304
+ yanked_at: string;
305
+ /** Informational message */
306
+ message?: string | undefined;
307
+ }
308
+ /**
309
+ * Unyank version response
310
+ */
311
+ export interface UnyankVersionResponse {
312
+ /** Whether version is yanked */
313
+ yanked: false;
314
+ /** Version that was unyanked */
315
+ version: string;
316
+ /** When it was unyanked */
317
+ unyanked_at: string;
318
+ }
319
+ /**
320
+ * Submit attestation response (v2)
321
+ */
322
+ export interface AttestationResponse {
323
+ /** Auditor email */
324
+ auditor: string;
325
+ /** OAuth provider */
326
+ auditor_provider: string;
327
+ /** Signing timestamp */
328
+ signed_at: string;
329
+ /** Rekor log ID */
330
+ rekor_log_id: string;
331
+ /** Rekor log index */
332
+ rekor_log_index?: number | undefined;
333
+ /** Verification result */
334
+ verification: {
335
+ verified: boolean;
336
+ verified_at: string;
337
+ rekor_verified: boolean;
338
+ certificate_verified: boolean;
339
+ signature_verified: boolean;
340
+ };
341
+ }
342
+ /**
343
+ * Revoke attestation response
344
+ */
345
+ export interface RevokeAttestationResponse {
346
+ /** Auditor email */
347
+ auditor: string;
348
+ /** Whether revocation succeeded */
349
+ revoked: true;
350
+ /** When it was revoked */
351
+ revoked_at: string;
352
+ }
353
+ /**
354
+ * Trusted auditor entry
355
+ */
356
+ export interface TrustedAuditor {
357
+ /** Auditor identity (email) */
358
+ identity: string;
359
+ /** When they were added to trust list */
360
+ added_at: string;
361
+ }
362
+ /**
363
+ * User trust configuration
364
+ */
365
+ export interface UserTrustConfig {
366
+ /** Username */
367
+ username: string;
368
+ /** List of trusted auditors */
369
+ trusted_auditors: TrustedAuditor[];
370
+ }
371
+ /**
372
+ * Update trust configuration request
373
+ */
374
+ export interface UpdateTrustConfigRequest {
375
+ /** Array of auditor emails to trust */
376
+ trusted_auditors: string[];
377
+ }
378
+ /**
379
+ * Update trust configuration response
380
+ */
381
+ export interface UpdateTrustConfigResponse {
382
+ /** Updated list of trusted auditors */
383
+ trusted_auditors: TrustedAuditor[];
384
+ /** When the config was updated */
385
+ updated_at: string;
386
+ }
387
+ /**
388
+ * Rate limit info from response headers
389
+ */
390
+ export interface RateLimitInfo {
391
+ /** Max requests per window */
392
+ limit: number;
393
+ /** Remaining requests */
394
+ remaining: number;
395
+ /** Unix timestamp when limit resets */
396
+ reset: number;
397
+ }
398
+ /**
399
+ * HTTP error codes from API v2
400
+ */
401
+ export type ApiErrorCode = "BAD_REQUEST" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "VERSION_YANKED" | "BUNDLE_TOO_LARGE" | "VALIDATION_ERROR" | "ATTESTATION_VERIFICATION_FAILED" | "RATE_LIMITED" | "INTERNAL_ERROR";
402
+ /**
403
+ * HTTP status codes
404
+ */
405
+ export declare const HTTP_STATUS: {
406
+ readonly OK: 200;
407
+ readonly CREATED: 201;
408
+ readonly NO_CONTENT: 204;
409
+ readonly REDIRECT: 302;
410
+ readonly BAD_REQUEST: 400;
411
+ readonly UNAUTHORIZED: 401;
412
+ readonly FORBIDDEN: 403;
413
+ readonly NOT_FOUND: 404;
414
+ readonly CONFLICT: 409;
415
+ readonly GONE: 410;
416
+ readonly PAYLOAD_TOO_LARGE: 413;
417
+ readonly VALIDATION_ERROR: 422;
418
+ readonly RATE_LIMITED: 429;
419
+ readonly INTERNAL_ERROR: 500;
420
+ };
421
+ //# sourceMappingURL=types.d.ts.map