@kya-os/contracts 1.6.17 → 1.6.19
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/dist/cli.d.ts +56 -11
- package/dist/cli.js +38 -14
- package/dist/config/identity.d.ts +117 -0
- package/dist/config/identity.js +34 -2
- package/dist/config/tool-protection.d.ts +32 -7
- package/dist/consent/schemas.d.ts +90 -90
- package/dist/deploy/index.d.ts +27 -0
- package/dist/deploy/index.js +62 -0
- package/dist/deploy/schemas.d.ts +1001 -0
- package/dist/deploy/schemas.js +283 -0
- package/dist/deploy/types.d.ts +256 -0
- package/dist/deploy/types.js +10 -0
- package/dist/identity/index.d.ts +3 -0
- package/dist/identity/index.js +7 -0
- package/dist/index.js +1 -0
- package/dist/reputation/api.d.ts +2883 -0
- package/dist/reputation/api.js +417 -0
- package/dist/reputation/constants.d.ts +242 -0
- package/dist/reputation/constants.js +259 -0
- package/dist/reputation/credentials.d.ts +1493 -0
- package/dist/reputation/credentials.js +302 -0
- package/dist/reputation/index.d.ts +20 -0
- package/dist/reputation/index.js +40 -0
- package/dist/reputation/schemas.d.ts +1600 -0
- package/dist/reputation/schemas.js +499 -0
- package/package.json +9 -1
|
@@ -0,0 +1,1493 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reputation Credential Schemas
|
|
3
|
+
*
|
|
4
|
+
* W3C Verifiable Credential schemas for reputation attestations.
|
|
5
|
+
* These credentials allow reputation scores to be cryptographically signed
|
|
6
|
+
* and verified as portable, tamper-proof attestations.
|
|
7
|
+
*
|
|
8
|
+
* Credential Types:
|
|
9
|
+
* - ReputationCredential: Attests to an agent's reputation score at a point in time
|
|
10
|
+
* - ReputationAttestation: Lighter-weight attestation for specific contexts
|
|
11
|
+
*
|
|
12
|
+
* Related Spec: MCP-I §3.1 (VC Structure), §5.3 (Reputation Credentials)
|
|
13
|
+
* W3C Reference: Verifiable Credentials Data Model 1.1
|
|
14
|
+
*/
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
import { CredentialStatusSchema } from "../vc/schemas.js";
|
|
17
|
+
import { type ReputationScore } from "./schemas.js";
|
|
18
|
+
/**
|
|
19
|
+
* Reputation Credential JSON-LD Context
|
|
20
|
+
*/
|
|
21
|
+
export declare const REPUTATION_CREDENTIAL_CONTEXT: "https://schemas.kya-os.ai/xmcp-i/credentials/reputation.v1.0.0.json";
|
|
22
|
+
/**
|
|
23
|
+
* Reputation Credential Type
|
|
24
|
+
*/
|
|
25
|
+
export declare const REPUTATION_CREDENTIAL_TYPE: "ReputationCredential";
|
|
26
|
+
/**
|
|
27
|
+
* Reputation Attestation Type
|
|
28
|
+
*/
|
|
29
|
+
export declare const REPUTATION_ATTESTATION_TYPE: "ReputationAttestation";
|
|
30
|
+
/**
|
|
31
|
+
* Reputation Credential Subject Schema
|
|
32
|
+
*
|
|
33
|
+
* The credentialSubject of a ReputationCredential contains:
|
|
34
|
+
* - id: The agent DID being attested
|
|
35
|
+
* - reputation: The complete reputation score at time of issuance
|
|
36
|
+
*/
|
|
37
|
+
export declare const ReputationCredentialSubjectSchema: z.ZodObject<{
|
|
38
|
+
/** Subject DID (the agent whose reputation is being attested) */
|
|
39
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
40
|
+
/** The reputation score being attested */
|
|
41
|
+
reputation: z.ZodObject<{
|
|
42
|
+
/** Final reputation score (0-100) */
|
|
43
|
+
score: z.ZodNumber;
|
|
44
|
+
/** Confidence in the score (0-1) */
|
|
45
|
+
confidence: z.ZodNumber;
|
|
46
|
+
/** Human-readable confidence level */
|
|
47
|
+
confidenceLevel: z.ZodEnum<["Low", "Medium", "High", "VeryHigh"]>;
|
|
48
|
+
/** Human-readable reputation level */
|
|
49
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
50
|
+
/** Whether this is a provisional score */
|
|
51
|
+
isProvisional: z.ZodBoolean;
|
|
52
|
+
/** Timestamp when the score was calculated (ISO 8601) */
|
|
53
|
+
calculatedAt: z.ZodString;
|
|
54
|
+
/** Optional score components (for transparency) */
|
|
55
|
+
components: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
priorScore: z.ZodNumber;
|
|
57
|
+
empiricalScore: z.ZodNumber;
|
|
58
|
+
confidenceWeight: z.ZodNumber;
|
|
59
|
+
priorWeight: z.ZodNumber;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
priorScore: number;
|
|
62
|
+
empiricalScore: number;
|
|
63
|
+
confidenceWeight: number;
|
|
64
|
+
priorWeight: number;
|
|
65
|
+
}, {
|
|
66
|
+
priorScore: number;
|
|
67
|
+
empiricalScore: number;
|
|
68
|
+
confidenceWeight: number;
|
|
69
|
+
priorWeight: number;
|
|
70
|
+
}>>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
score: number;
|
|
73
|
+
confidence: number;
|
|
74
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
75
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
76
|
+
isProvisional: boolean;
|
|
77
|
+
calculatedAt: string;
|
|
78
|
+
components?: {
|
|
79
|
+
priorScore: number;
|
|
80
|
+
empiricalScore: number;
|
|
81
|
+
confidenceWeight: number;
|
|
82
|
+
priorWeight: number;
|
|
83
|
+
} | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
score: number;
|
|
86
|
+
confidence: number;
|
|
87
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
88
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
89
|
+
isProvisional: boolean;
|
|
90
|
+
calculatedAt: string;
|
|
91
|
+
components?: {
|
|
92
|
+
priorScore: number;
|
|
93
|
+
empiricalScore: number;
|
|
94
|
+
confidenceWeight: number;
|
|
95
|
+
priorWeight: number;
|
|
96
|
+
} | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
/** Context in which this reputation applies */
|
|
99
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
/** Scope of the reputation (e.g., 'global', 'domain-specific') */
|
|
101
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
102
|
+
/** Domain or category (e.g., 'e-commerce', 'healthcare') */
|
|
103
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
104
|
+
/** Geographic region (if applicable) */
|
|
105
|
+
region: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
scope: string;
|
|
108
|
+
domain?: string | undefined;
|
|
109
|
+
region?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
scope?: string | undefined;
|
|
112
|
+
domain?: string | undefined;
|
|
113
|
+
region?: string | undefined;
|
|
114
|
+
}>>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
id: string;
|
|
117
|
+
reputation: {
|
|
118
|
+
score: number;
|
|
119
|
+
confidence: number;
|
|
120
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
121
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
122
|
+
isProvisional: boolean;
|
|
123
|
+
calculatedAt: string;
|
|
124
|
+
components?: {
|
|
125
|
+
priorScore: number;
|
|
126
|
+
empiricalScore: number;
|
|
127
|
+
confidenceWeight: number;
|
|
128
|
+
priorWeight: number;
|
|
129
|
+
} | undefined;
|
|
130
|
+
};
|
|
131
|
+
context?: {
|
|
132
|
+
scope: string;
|
|
133
|
+
domain?: string | undefined;
|
|
134
|
+
region?: string | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
id: string;
|
|
138
|
+
reputation: {
|
|
139
|
+
score: number;
|
|
140
|
+
confidence: number;
|
|
141
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
142
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
143
|
+
isProvisional: boolean;
|
|
144
|
+
calculatedAt: string;
|
|
145
|
+
components?: {
|
|
146
|
+
priorScore: number;
|
|
147
|
+
empiricalScore: number;
|
|
148
|
+
confidenceWeight: number;
|
|
149
|
+
priorWeight: number;
|
|
150
|
+
} | undefined;
|
|
151
|
+
};
|
|
152
|
+
context?: {
|
|
153
|
+
scope?: string | undefined;
|
|
154
|
+
domain?: string | undefined;
|
|
155
|
+
region?: string | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
export type ReputationCredentialSubject = z.infer<typeof ReputationCredentialSubjectSchema>;
|
|
159
|
+
/**
|
|
160
|
+
* Reputation Credential Schema
|
|
161
|
+
*
|
|
162
|
+
* W3C Verifiable Credential for reputation attestation.
|
|
163
|
+
* This is the PRIMARY format for portable reputation scores.
|
|
164
|
+
*
|
|
165
|
+
* Structure:
|
|
166
|
+
* - @context: [...W3C VC contexts, reputation context]
|
|
167
|
+
* - type: ['VerifiableCredential', 'ReputationCredential']
|
|
168
|
+
* - issuer: Reputation authority DID (e.g., KYA platform)
|
|
169
|
+
* - issuanceDate: When the reputation was calculated
|
|
170
|
+
* - expirationDate: When this attestation expires
|
|
171
|
+
* - credentialSubject: Contains agent DID + reputation data
|
|
172
|
+
* - credentialStatus: StatusList2021Entry for revocation
|
|
173
|
+
* - proof: Ed25519Signature2020 or similar
|
|
174
|
+
*/
|
|
175
|
+
export declare const ReputationCredentialSchema: z.ZodObject<{
|
|
176
|
+
id: z.ZodOptional<z.ZodString>;
|
|
177
|
+
} & {
|
|
178
|
+
"@context": z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">, (string | Record<string, any>)[], (string | Record<string, any>)[]>;
|
|
179
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
180
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
181
|
+
id: z.ZodString;
|
|
182
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
183
|
+
id: z.ZodString;
|
|
184
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
187
|
+
issuanceDate: z.ZodString;
|
|
188
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
189
|
+
credentialSubject: z.ZodObject<{
|
|
190
|
+
/** Subject DID (the agent whose reputation is being attested) */
|
|
191
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
192
|
+
/** The reputation score being attested */
|
|
193
|
+
reputation: z.ZodObject<{
|
|
194
|
+
/** Final reputation score (0-100) */
|
|
195
|
+
score: z.ZodNumber;
|
|
196
|
+
/** Confidence in the score (0-1) */
|
|
197
|
+
confidence: z.ZodNumber;
|
|
198
|
+
/** Human-readable confidence level */
|
|
199
|
+
confidenceLevel: z.ZodEnum<["Low", "Medium", "High", "VeryHigh"]>;
|
|
200
|
+
/** Human-readable reputation level */
|
|
201
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
202
|
+
/** Whether this is a provisional score */
|
|
203
|
+
isProvisional: z.ZodBoolean;
|
|
204
|
+
/** Timestamp when the score was calculated (ISO 8601) */
|
|
205
|
+
calculatedAt: z.ZodString;
|
|
206
|
+
/** Optional score components (for transparency) */
|
|
207
|
+
components: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
priorScore: z.ZodNumber;
|
|
209
|
+
empiricalScore: z.ZodNumber;
|
|
210
|
+
confidenceWeight: z.ZodNumber;
|
|
211
|
+
priorWeight: z.ZodNumber;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
priorScore: number;
|
|
214
|
+
empiricalScore: number;
|
|
215
|
+
confidenceWeight: number;
|
|
216
|
+
priorWeight: number;
|
|
217
|
+
}, {
|
|
218
|
+
priorScore: number;
|
|
219
|
+
empiricalScore: number;
|
|
220
|
+
confidenceWeight: number;
|
|
221
|
+
priorWeight: number;
|
|
222
|
+
}>>;
|
|
223
|
+
}, "strip", z.ZodTypeAny, {
|
|
224
|
+
score: number;
|
|
225
|
+
confidence: number;
|
|
226
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
227
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
228
|
+
isProvisional: boolean;
|
|
229
|
+
calculatedAt: string;
|
|
230
|
+
components?: {
|
|
231
|
+
priorScore: number;
|
|
232
|
+
empiricalScore: number;
|
|
233
|
+
confidenceWeight: number;
|
|
234
|
+
priorWeight: number;
|
|
235
|
+
} | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
score: number;
|
|
238
|
+
confidence: number;
|
|
239
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
240
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
241
|
+
isProvisional: boolean;
|
|
242
|
+
calculatedAt: string;
|
|
243
|
+
components?: {
|
|
244
|
+
priorScore: number;
|
|
245
|
+
empiricalScore: number;
|
|
246
|
+
confidenceWeight: number;
|
|
247
|
+
priorWeight: number;
|
|
248
|
+
} | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
/** Context in which this reputation applies */
|
|
251
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
252
|
+
/** Scope of the reputation (e.g., 'global', 'domain-specific') */
|
|
253
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
254
|
+
/** Domain or category (e.g., 'e-commerce', 'healthcare') */
|
|
255
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
256
|
+
/** Geographic region (if applicable) */
|
|
257
|
+
region: z.ZodOptional<z.ZodString>;
|
|
258
|
+
}, "strip", z.ZodTypeAny, {
|
|
259
|
+
scope: string;
|
|
260
|
+
domain?: string | undefined;
|
|
261
|
+
region?: string | undefined;
|
|
262
|
+
}, {
|
|
263
|
+
scope?: string | undefined;
|
|
264
|
+
domain?: string | undefined;
|
|
265
|
+
region?: string | undefined;
|
|
266
|
+
}>>;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
id: string;
|
|
269
|
+
reputation: {
|
|
270
|
+
score: number;
|
|
271
|
+
confidence: number;
|
|
272
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
273
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
274
|
+
isProvisional: boolean;
|
|
275
|
+
calculatedAt: string;
|
|
276
|
+
components?: {
|
|
277
|
+
priorScore: number;
|
|
278
|
+
empiricalScore: number;
|
|
279
|
+
confidenceWeight: number;
|
|
280
|
+
priorWeight: number;
|
|
281
|
+
} | undefined;
|
|
282
|
+
};
|
|
283
|
+
context?: {
|
|
284
|
+
scope: string;
|
|
285
|
+
domain?: string | undefined;
|
|
286
|
+
region?: string | undefined;
|
|
287
|
+
} | undefined;
|
|
288
|
+
}, {
|
|
289
|
+
id: string;
|
|
290
|
+
reputation: {
|
|
291
|
+
score: number;
|
|
292
|
+
confidence: number;
|
|
293
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
294
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
295
|
+
isProvisional: boolean;
|
|
296
|
+
calculatedAt: string;
|
|
297
|
+
components?: {
|
|
298
|
+
priorScore: number;
|
|
299
|
+
empiricalScore: number;
|
|
300
|
+
confidenceWeight: number;
|
|
301
|
+
priorWeight: number;
|
|
302
|
+
} | undefined;
|
|
303
|
+
};
|
|
304
|
+
context?: {
|
|
305
|
+
scope?: string | undefined;
|
|
306
|
+
domain?: string | undefined;
|
|
307
|
+
region?: string | undefined;
|
|
308
|
+
} | undefined;
|
|
309
|
+
}>;
|
|
310
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
311
|
+
id: z.ZodString;
|
|
312
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
313
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
314
|
+
statusListIndex: z.ZodString;
|
|
315
|
+
statusListCredential: z.ZodString;
|
|
316
|
+
}, "strip", z.ZodTypeAny, {
|
|
317
|
+
type: "StatusList2021Entry";
|
|
318
|
+
id: string;
|
|
319
|
+
statusPurpose: "revocation" | "suspension";
|
|
320
|
+
statusListIndex: string;
|
|
321
|
+
statusListCredential: string;
|
|
322
|
+
}, {
|
|
323
|
+
type: "StatusList2021Entry";
|
|
324
|
+
id: string;
|
|
325
|
+
statusPurpose: "revocation" | "suspension";
|
|
326
|
+
statusListIndex: string;
|
|
327
|
+
statusListCredential: string;
|
|
328
|
+
}>>;
|
|
329
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
330
|
+
type: z.ZodString;
|
|
331
|
+
created: z.ZodOptional<z.ZodString>;
|
|
332
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
333
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
334
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
335
|
+
type: z.ZodString;
|
|
336
|
+
created: z.ZodOptional<z.ZodString>;
|
|
337
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
338
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
339
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
340
|
+
type: z.ZodString;
|
|
341
|
+
created: z.ZodOptional<z.ZodString>;
|
|
342
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
343
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
344
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
345
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
346
|
+
id: z.ZodOptional<z.ZodString>;
|
|
347
|
+
} & {
|
|
348
|
+
"@context": z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">, (string | Record<string, any>)[], (string | Record<string, any>)[]>;
|
|
349
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
350
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
351
|
+
id: z.ZodString;
|
|
352
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
353
|
+
id: z.ZodString;
|
|
354
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
355
|
+
id: z.ZodString;
|
|
356
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
357
|
+
issuanceDate: z.ZodString;
|
|
358
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
359
|
+
credentialSubject: z.ZodObject<{
|
|
360
|
+
/** Subject DID (the agent whose reputation is being attested) */
|
|
361
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
362
|
+
/** The reputation score being attested */
|
|
363
|
+
reputation: z.ZodObject<{
|
|
364
|
+
/** Final reputation score (0-100) */
|
|
365
|
+
score: z.ZodNumber;
|
|
366
|
+
/** Confidence in the score (0-1) */
|
|
367
|
+
confidence: z.ZodNumber;
|
|
368
|
+
/** Human-readable confidence level */
|
|
369
|
+
confidenceLevel: z.ZodEnum<["Low", "Medium", "High", "VeryHigh"]>;
|
|
370
|
+
/** Human-readable reputation level */
|
|
371
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
372
|
+
/** Whether this is a provisional score */
|
|
373
|
+
isProvisional: z.ZodBoolean;
|
|
374
|
+
/** Timestamp when the score was calculated (ISO 8601) */
|
|
375
|
+
calculatedAt: z.ZodString;
|
|
376
|
+
/** Optional score components (for transparency) */
|
|
377
|
+
components: z.ZodOptional<z.ZodObject<{
|
|
378
|
+
priorScore: z.ZodNumber;
|
|
379
|
+
empiricalScore: z.ZodNumber;
|
|
380
|
+
confidenceWeight: z.ZodNumber;
|
|
381
|
+
priorWeight: z.ZodNumber;
|
|
382
|
+
}, "strip", z.ZodTypeAny, {
|
|
383
|
+
priorScore: number;
|
|
384
|
+
empiricalScore: number;
|
|
385
|
+
confidenceWeight: number;
|
|
386
|
+
priorWeight: number;
|
|
387
|
+
}, {
|
|
388
|
+
priorScore: number;
|
|
389
|
+
empiricalScore: number;
|
|
390
|
+
confidenceWeight: number;
|
|
391
|
+
priorWeight: number;
|
|
392
|
+
}>>;
|
|
393
|
+
}, "strip", z.ZodTypeAny, {
|
|
394
|
+
score: number;
|
|
395
|
+
confidence: number;
|
|
396
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
397
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
398
|
+
isProvisional: boolean;
|
|
399
|
+
calculatedAt: string;
|
|
400
|
+
components?: {
|
|
401
|
+
priorScore: number;
|
|
402
|
+
empiricalScore: number;
|
|
403
|
+
confidenceWeight: number;
|
|
404
|
+
priorWeight: number;
|
|
405
|
+
} | undefined;
|
|
406
|
+
}, {
|
|
407
|
+
score: number;
|
|
408
|
+
confidence: number;
|
|
409
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
410
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
411
|
+
isProvisional: boolean;
|
|
412
|
+
calculatedAt: string;
|
|
413
|
+
components?: {
|
|
414
|
+
priorScore: number;
|
|
415
|
+
empiricalScore: number;
|
|
416
|
+
confidenceWeight: number;
|
|
417
|
+
priorWeight: number;
|
|
418
|
+
} | undefined;
|
|
419
|
+
}>;
|
|
420
|
+
/** Context in which this reputation applies */
|
|
421
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
422
|
+
/** Scope of the reputation (e.g., 'global', 'domain-specific') */
|
|
423
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
424
|
+
/** Domain or category (e.g., 'e-commerce', 'healthcare') */
|
|
425
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
426
|
+
/** Geographic region (if applicable) */
|
|
427
|
+
region: z.ZodOptional<z.ZodString>;
|
|
428
|
+
}, "strip", z.ZodTypeAny, {
|
|
429
|
+
scope: string;
|
|
430
|
+
domain?: string | undefined;
|
|
431
|
+
region?: string | undefined;
|
|
432
|
+
}, {
|
|
433
|
+
scope?: string | undefined;
|
|
434
|
+
domain?: string | undefined;
|
|
435
|
+
region?: string | undefined;
|
|
436
|
+
}>>;
|
|
437
|
+
}, "strip", z.ZodTypeAny, {
|
|
438
|
+
id: string;
|
|
439
|
+
reputation: {
|
|
440
|
+
score: number;
|
|
441
|
+
confidence: number;
|
|
442
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
443
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
444
|
+
isProvisional: boolean;
|
|
445
|
+
calculatedAt: string;
|
|
446
|
+
components?: {
|
|
447
|
+
priorScore: number;
|
|
448
|
+
empiricalScore: number;
|
|
449
|
+
confidenceWeight: number;
|
|
450
|
+
priorWeight: number;
|
|
451
|
+
} | undefined;
|
|
452
|
+
};
|
|
453
|
+
context?: {
|
|
454
|
+
scope: string;
|
|
455
|
+
domain?: string | undefined;
|
|
456
|
+
region?: string | undefined;
|
|
457
|
+
} | undefined;
|
|
458
|
+
}, {
|
|
459
|
+
id: string;
|
|
460
|
+
reputation: {
|
|
461
|
+
score: number;
|
|
462
|
+
confidence: number;
|
|
463
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
464
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
465
|
+
isProvisional: boolean;
|
|
466
|
+
calculatedAt: string;
|
|
467
|
+
components?: {
|
|
468
|
+
priorScore: number;
|
|
469
|
+
empiricalScore: number;
|
|
470
|
+
confidenceWeight: number;
|
|
471
|
+
priorWeight: number;
|
|
472
|
+
} | undefined;
|
|
473
|
+
};
|
|
474
|
+
context?: {
|
|
475
|
+
scope?: string | undefined;
|
|
476
|
+
domain?: string | undefined;
|
|
477
|
+
region?: string | undefined;
|
|
478
|
+
} | undefined;
|
|
479
|
+
}>;
|
|
480
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
481
|
+
id: z.ZodString;
|
|
482
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
483
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
484
|
+
statusListIndex: z.ZodString;
|
|
485
|
+
statusListCredential: z.ZodString;
|
|
486
|
+
}, "strip", z.ZodTypeAny, {
|
|
487
|
+
type: "StatusList2021Entry";
|
|
488
|
+
id: string;
|
|
489
|
+
statusPurpose: "revocation" | "suspension";
|
|
490
|
+
statusListIndex: string;
|
|
491
|
+
statusListCredential: string;
|
|
492
|
+
}, {
|
|
493
|
+
type: "StatusList2021Entry";
|
|
494
|
+
id: string;
|
|
495
|
+
statusPurpose: "revocation" | "suspension";
|
|
496
|
+
statusListIndex: string;
|
|
497
|
+
statusListCredential: string;
|
|
498
|
+
}>>;
|
|
499
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
500
|
+
type: z.ZodString;
|
|
501
|
+
created: z.ZodOptional<z.ZodString>;
|
|
502
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
503
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
504
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
505
|
+
type: z.ZodString;
|
|
506
|
+
created: z.ZodOptional<z.ZodString>;
|
|
507
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
508
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
509
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
510
|
+
type: z.ZodString;
|
|
511
|
+
created: z.ZodOptional<z.ZodString>;
|
|
512
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
513
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
514
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
515
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
516
|
+
id: z.ZodOptional<z.ZodString>;
|
|
517
|
+
} & {
|
|
518
|
+
"@context": z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">, (string | Record<string, any>)[], (string | Record<string, any>)[]>;
|
|
519
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
520
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
521
|
+
id: z.ZodString;
|
|
522
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
523
|
+
id: z.ZodString;
|
|
524
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
525
|
+
id: z.ZodString;
|
|
526
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
527
|
+
issuanceDate: z.ZodString;
|
|
528
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
529
|
+
credentialSubject: z.ZodObject<{
|
|
530
|
+
/** Subject DID (the agent whose reputation is being attested) */
|
|
531
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
532
|
+
/** The reputation score being attested */
|
|
533
|
+
reputation: z.ZodObject<{
|
|
534
|
+
/** Final reputation score (0-100) */
|
|
535
|
+
score: z.ZodNumber;
|
|
536
|
+
/** Confidence in the score (0-1) */
|
|
537
|
+
confidence: z.ZodNumber;
|
|
538
|
+
/** Human-readable confidence level */
|
|
539
|
+
confidenceLevel: z.ZodEnum<["Low", "Medium", "High", "VeryHigh"]>;
|
|
540
|
+
/** Human-readable reputation level */
|
|
541
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
542
|
+
/** Whether this is a provisional score */
|
|
543
|
+
isProvisional: z.ZodBoolean;
|
|
544
|
+
/** Timestamp when the score was calculated (ISO 8601) */
|
|
545
|
+
calculatedAt: z.ZodString;
|
|
546
|
+
/** Optional score components (for transparency) */
|
|
547
|
+
components: z.ZodOptional<z.ZodObject<{
|
|
548
|
+
priorScore: z.ZodNumber;
|
|
549
|
+
empiricalScore: z.ZodNumber;
|
|
550
|
+
confidenceWeight: z.ZodNumber;
|
|
551
|
+
priorWeight: z.ZodNumber;
|
|
552
|
+
}, "strip", z.ZodTypeAny, {
|
|
553
|
+
priorScore: number;
|
|
554
|
+
empiricalScore: number;
|
|
555
|
+
confidenceWeight: number;
|
|
556
|
+
priorWeight: number;
|
|
557
|
+
}, {
|
|
558
|
+
priorScore: number;
|
|
559
|
+
empiricalScore: number;
|
|
560
|
+
confidenceWeight: number;
|
|
561
|
+
priorWeight: number;
|
|
562
|
+
}>>;
|
|
563
|
+
}, "strip", z.ZodTypeAny, {
|
|
564
|
+
score: number;
|
|
565
|
+
confidence: number;
|
|
566
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
567
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
568
|
+
isProvisional: boolean;
|
|
569
|
+
calculatedAt: string;
|
|
570
|
+
components?: {
|
|
571
|
+
priorScore: number;
|
|
572
|
+
empiricalScore: number;
|
|
573
|
+
confidenceWeight: number;
|
|
574
|
+
priorWeight: number;
|
|
575
|
+
} | undefined;
|
|
576
|
+
}, {
|
|
577
|
+
score: number;
|
|
578
|
+
confidence: number;
|
|
579
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
580
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
581
|
+
isProvisional: boolean;
|
|
582
|
+
calculatedAt: string;
|
|
583
|
+
components?: {
|
|
584
|
+
priorScore: number;
|
|
585
|
+
empiricalScore: number;
|
|
586
|
+
confidenceWeight: number;
|
|
587
|
+
priorWeight: number;
|
|
588
|
+
} | undefined;
|
|
589
|
+
}>;
|
|
590
|
+
/** Context in which this reputation applies */
|
|
591
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
592
|
+
/** Scope of the reputation (e.g., 'global', 'domain-specific') */
|
|
593
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
594
|
+
/** Domain or category (e.g., 'e-commerce', 'healthcare') */
|
|
595
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
596
|
+
/** Geographic region (if applicable) */
|
|
597
|
+
region: z.ZodOptional<z.ZodString>;
|
|
598
|
+
}, "strip", z.ZodTypeAny, {
|
|
599
|
+
scope: string;
|
|
600
|
+
domain?: string | undefined;
|
|
601
|
+
region?: string | undefined;
|
|
602
|
+
}, {
|
|
603
|
+
scope?: string | undefined;
|
|
604
|
+
domain?: string | undefined;
|
|
605
|
+
region?: string | undefined;
|
|
606
|
+
}>>;
|
|
607
|
+
}, "strip", z.ZodTypeAny, {
|
|
608
|
+
id: string;
|
|
609
|
+
reputation: {
|
|
610
|
+
score: number;
|
|
611
|
+
confidence: number;
|
|
612
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
613
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
614
|
+
isProvisional: boolean;
|
|
615
|
+
calculatedAt: string;
|
|
616
|
+
components?: {
|
|
617
|
+
priorScore: number;
|
|
618
|
+
empiricalScore: number;
|
|
619
|
+
confidenceWeight: number;
|
|
620
|
+
priorWeight: number;
|
|
621
|
+
} | undefined;
|
|
622
|
+
};
|
|
623
|
+
context?: {
|
|
624
|
+
scope: string;
|
|
625
|
+
domain?: string | undefined;
|
|
626
|
+
region?: string | undefined;
|
|
627
|
+
} | undefined;
|
|
628
|
+
}, {
|
|
629
|
+
id: string;
|
|
630
|
+
reputation: {
|
|
631
|
+
score: number;
|
|
632
|
+
confidence: number;
|
|
633
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
634
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
635
|
+
isProvisional: boolean;
|
|
636
|
+
calculatedAt: string;
|
|
637
|
+
components?: {
|
|
638
|
+
priorScore: number;
|
|
639
|
+
empiricalScore: number;
|
|
640
|
+
confidenceWeight: number;
|
|
641
|
+
priorWeight: number;
|
|
642
|
+
} | undefined;
|
|
643
|
+
};
|
|
644
|
+
context?: {
|
|
645
|
+
scope?: string | undefined;
|
|
646
|
+
domain?: string | undefined;
|
|
647
|
+
region?: string | undefined;
|
|
648
|
+
} | undefined;
|
|
649
|
+
}>;
|
|
650
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
651
|
+
id: z.ZodString;
|
|
652
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
653
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
654
|
+
statusListIndex: z.ZodString;
|
|
655
|
+
statusListCredential: z.ZodString;
|
|
656
|
+
}, "strip", z.ZodTypeAny, {
|
|
657
|
+
type: "StatusList2021Entry";
|
|
658
|
+
id: string;
|
|
659
|
+
statusPurpose: "revocation" | "suspension";
|
|
660
|
+
statusListIndex: string;
|
|
661
|
+
statusListCredential: string;
|
|
662
|
+
}, {
|
|
663
|
+
type: "StatusList2021Entry";
|
|
664
|
+
id: string;
|
|
665
|
+
statusPurpose: "revocation" | "suspension";
|
|
666
|
+
statusListIndex: string;
|
|
667
|
+
statusListCredential: string;
|
|
668
|
+
}>>;
|
|
669
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
670
|
+
type: z.ZodString;
|
|
671
|
+
created: z.ZodOptional<z.ZodString>;
|
|
672
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
673
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
674
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
675
|
+
type: z.ZodString;
|
|
676
|
+
created: z.ZodOptional<z.ZodString>;
|
|
677
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
678
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
679
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
680
|
+
type: z.ZodString;
|
|
681
|
+
created: z.ZodOptional<z.ZodString>;
|
|
682
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
683
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
684
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
685
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
686
|
+
export type ReputationCredential = z.infer<typeof ReputationCredentialSchema>;
|
|
687
|
+
/**
|
|
688
|
+
* Reputation Attestation Subject Schema
|
|
689
|
+
*
|
|
690
|
+
* Lighter-weight attestation for specific use cases.
|
|
691
|
+
* Contains only essential reputation information.
|
|
692
|
+
*/
|
|
693
|
+
export declare const ReputationAttestationSubjectSchema: z.ZodObject<{
|
|
694
|
+
/** Subject DID */
|
|
695
|
+
id: z.ZodString;
|
|
696
|
+
/** Reputation level (human-readable) */
|
|
697
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
698
|
+
/** Numeric score (0-100) */
|
|
699
|
+
score: z.ZodNumber;
|
|
700
|
+
/** Whether the attestation issuer has high confidence */
|
|
701
|
+
highConfidence: z.ZodBoolean;
|
|
702
|
+
/** Specific capability or context being attested */
|
|
703
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
704
|
+
}, "strip", z.ZodTypeAny, {
|
|
705
|
+
score: number;
|
|
706
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
707
|
+
id: string;
|
|
708
|
+
highConfidence: boolean;
|
|
709
|
+
capability?: string | undefined;
|
|
710
|
+
}, {
|
|
711
|
+
score: number;
|
|
712
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
713
|
+
id: string;
|
|
714
|
+
highConfidence: boolean;
|
|
715
|
+
capability?: string | undefined;
|
|
716
|
+
}>;
|
|
717
|
+
export type ReputationAttestationSubject = z.infer<typeof ReputationAttestationSubjectSchema>;
|
|
718
|
+
/**
|
|
719
|
+
* Reputation Attestation Schema
|
|
720
|
+
*
|
|
721
|
+
* Lightweight attestation for embedding in other contexts.
|
|
722
|
+
*/
|
|
723
|
+
export declare const ReputationAttestationSchema: z.ZodObject<{
|
|
724
|
+
'@context': z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
725
|
+
id: z.ZodOptional<z.ZodString>;
|
|
726
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
727
|
+
id: z.ZodString;
|
|
728
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
729
|
+
id: z.ZodString;
|
|
730
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
731
|
+
id: z.ZodString;
|
|
732
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
733
|
+
issuanceDate: z.ZodString;
|
|
734
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
735
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
736
|
+
id: z.ZodString;
|
|
737
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
738
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
739
|
+
statusListIndex: z.ZodString;
|
|
740
|
+
statusListCredential: z.ZodString;
|
|
741
|
+
}, "strip", z.ZodTypeAny, {
|
|
742
|
+
type: "StatusList2021Entry";
|
|
743
|
+
id: string;
|
|
744
|
+
statusPurpose: "revocation" | "suspension";
|
|
745
|
+
statusListIndex: string;
|
|
746
|
+
statusListCredential: string;
|
|
747
|
+
}, {
|
|
748
|
+
type: "StatusList2021Entry";
|
|
749
|
+
id: string;
|
|
750
|
+
statusPurpose: "revocation" | "suspension";
|
|
751
|
+
statusListIndex: string;
|
|
752
|
+
statusListCredential: string;
|
|
753
|
+
}>>;
|
|
754
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
755
|
+
type: z.ZodString;
|
|
756
|
+
created: z.ZodOptional<z.ZodString>;
|
|
757
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
758
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
759
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
760
|
+
type: z.ZodString;
|
|
761
|
+
created: z.ZodOptional<z.ZodString>;
|
|
762
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
763
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
764
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
765
|
+
type: z.ZodString;
|
|
766
|
+
created: z.ZodOptional<z.ZodString>;
|
|
767
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
768
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
769
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
770
|
+
} & {
|
|
771
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
772
|
+
credentialSubject: z.ZodObject<{
|
|
773
|
+
/** Subject DID */
|
|
774
|
+
id: z.ZodString;
|
|
775
|
+
/** Reputation level (human-readable) */
|
|
776
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
777
|
+
/** Numeric score (0-100) */
|
|
778
|
+
score: z.ZodNumber;
|
|
779
|
+
/** Whether the attestation issuer has high confidence */
|
|
780
|
+
highConfidence: z.ZodBoolean;
|
|
781
|
+
/** Specific capability or context being attested */
|
|
782
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
783
|
+
}, "strip", z.ZodTypeAny, {
|
|
784
|
+
score: number;
|
|
785
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
786
|
+
id: string;
|
|
787
|
+
highConfidence: boolean;
|
|
788
|
+
capability?: string | undefined;
|
|
789
|
+
}, {
|
|
790
|
+
score: number;
|
|
791
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
792
|
+
id: string;
|
|
793
|
+
highConfidence: boolean;
|
|
794
|
+
capability?: string | undefined;
|
|
795
|
+
}>;
|
|
796
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
797
|
+
'@context': z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
798
|
+
id: z.ZodOptional<z.ZodString>;
|
|
799
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
800
|
+
id: z.ZodString;
|
|
801
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
802
|
+
id: z.ZodString;
|
|
803
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
804
|
+
id: z.ZodString;
|
|
805
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
806
|
+
issuanceDate: z.ZodString;
|
|
807
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
808
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
809
|
+
id: z.ZodString;
|
|
810
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
811
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
812
|
+
statusListIndex: z.ZodString;
|
|
813
|
+
statusListCredential: z.ZodString;
|
|
814
|
+
}, "strip", z.ZodTypeAny, {
|
|
815
|
+
type: "StatusList2021Entry";
|
|
816
|
+
id: string;
|
|
817
|
+
statusPurpose: "revocation" | "suspension";
|
|
818
|
+
statusListIndex: string;
|
|
819
|
+
statusListCredential: string;
|
|
820
|
+
}, {
|
|
821
|
+
type: "StatusList2021Entry";
|
|
822
|
+
id: string;
|
|
823
|
+
statusPurpose: "revocation" | "suspension";
|
|
824
|
+
statusListIndex: string;
|
|
825
|
+
statusListCredential: string;
|
|
826
|
+
}>>;
|
|
827
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
828
|
+
type: z.ZodString;
|
|
829
|
+
created: z.ZodOptional<z.ZodString>;
|
|
830
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
831
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
832
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
833
|
+
type: z.ZodString;
|
|
834
|
+
created: z.ZodOptional<z.ZodString>;
|
|
835
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
836
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
837
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
838
|
+
type: z.ZodString;
|
|
839
|
+
created: z.ZodOptional<z.ZodString>;
|
|
840
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
841
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
842
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
843
|
+
} & {
|
|
844
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
845
|
+
credentialSubject: z.ZodObject<{
|
|
846
|
+
/** Subject DID */
|
|
847
|
+
id: z.ZodString;
|
|
848
|
+
/** Reputation level (human-readable) */
|
|
849
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
850
|
+
/** Numeric score (0-100) */
|
|
851
|
+
score: z.ZodNumber;
|
|
852
|
+
/** Whether the attestation issuer has high confidence */
|
|
853
|
+
highConfidence: z.ZodBoolean;
|
|
854
|
+
/** Specific capability or context being attested */
|
|
855
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
856
|
+
}, "strip", z.ZodTypeAny, {
|
|
857
|
+
score: number;
|
|
858
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
859
|
+
id: string;
|
|
860
|
+
highConfidence: boolean;
|
|
861
|
+
capability?: string | undefined;
|
|
862
|
+
}, {
|
|
863
|
+
score: number;
|
|
864
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
865
|
+
id: string;
|
|
866
|
+
highConfidence: boolean;
|
|
867
|
+
capability?: string | undefined;
|
|
868
|
+
}>;
|
|
869
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
870
|
+
'@context': z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
871
|
+
id: z.ZodOptional<z.ZodString>;
|
|
872
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
873
|
+
id: z.ZodString;
|
|
874
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
875
|
+
id: z.ZodString;
|
|
876
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
877
|
+
id: z.ZodString;
|
|
878
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
879
|
+
issuanceDate: z.ZodString;
|
|
880
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
881
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
882
|
+
id: z.ZodString;
|
|
883
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
884
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
885
|
+
statusListIndex: z.ZodString;
|
|
886
|
+
statusListCredential: z.ZodString;
|
|
887
|
+
}, "strip", z.ZodTypeAny, {
|
|
888
|
+
type: "StatusList2021Entry";
|
|
889
|
+
id: string;
|
|
890
|
+
statusPurpose: "revocation" | "suspension";
|
|
891
|
+
statusListIndex: string;
|
|
892
|
+
statusListCredential: string;
|
|
893
|
+
}, {
|
|
894
|
+
type: "StatusList2021Entry";
|
|
895
|
+
id: string;
|
|
896
|
+
statusPurpose: "revocation" | "suspension";
|
|
897
|
+
statusListIndex: string;
|
|
898
|
+
statusListCredential: string;
|
|
899
|
+
}>>;
|
|
900
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
901
|
+
type: z.ZodString;
|
|
902
|
+
created: z.ZodOptional<z.ZodString>;
|
|
903
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
904
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
905
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
906
|
+
type: z.ZodString;
|
|
907
|
+
created: z.ZodOptional<z.ZodString>;
|
|
908
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
909
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
910
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
911
|
+
type: z.ZodString;
|
|
912
|
+
created: z.ZodOptional<z.ZodString>;
|
|
913
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
914
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
915
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
916
|
+
} & {
|
|
917
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
918
|
+
credentialSubject: z.ZodObject<{
|
|
919
|
+
/** Subject DID */
|
|
920
|
+
id: z.ZodString;
|
|
921
|
+
/** Reputation level (human-readable) */
|
|
922
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
923
|
+
/** Numeric score (0-100) */
|
|
924
|
+
score: z.ZodNumber;
|
|
925
|
+
/** Whether the attestation issuer has high confidence */
|
|
926
|
+
highConfidence: z.ZodBoolean;
|
|
927
|
+
/** Specific capability or context being attested */
|
|
928
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
929
|
+
}, "strip", z.ZodTypeAny, {
|
|
930
|
+
score: number;
|
|
931
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
932
|
+
id: string;
|
|
933
|
+
highConfidence: boolean;
|
|
934
|
+
capability?: string | undefined;
|
|
935
|
+
}, {
|
|
936
|
+
score: number;
|
|
937
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
938
|
+
id: string;
|
|
939
|
+
highConfidence: boolean;
|
|
940
|
+
capability?: string | undefined;
|
|
941
|
+
}>;
|
|
942
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
943
|
+
export type ReputationAttestation = z.infer<typeof ReputationAttestationSchema>;
|
|
944
|
+
/**
|
|
945
|
+
* Validate a reputation credential
|
|
946
|
+
*
|
|
947
|
+
* @param credential - The credential to validate
|
|
948
|
+
* @returns Validation result
|
|
949
|
+
*/
|
|
950
|
+
export declare function validateReputationCredential(credential: unknown): z.SafeParseReturnType<z.objectInputType<{
|
|
951
|
+
id: z.ZodOptional<z.ZodString>;
|
|
952
|
+
} & {
|
|
953
|
+
"@context": z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">, (string | Record<string, any>)[], (string | Record<string, any>)[]>;
|
|
954
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
955
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
956
|
+
id: z.ZodString;
|
|
957
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
958
|
+
id: z.ZodString;
|
|
959
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
960
|
+
id: z.ZodString;
|
|
961
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
962
|
+
issuanceDate: z.ZodString;
|
|
963
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
964
|
+
credentialSubject: z.ZodObject<{
|
|
965
|
+
/** Subject DID (the agent whose reputation is being attested) */
|
|
966
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
967
|
+
/** The reputation score being attested */
|
|
968
|
+
reputation: z.ZodObject<{
|
|
969
|
+
/** Final reputation score (0-100) */
|
|
970
|
+
score: z.ZodNumber;
|
|
971
|
+
/** Confidence in the score (0-1) */
|
|
972
|
+
confidence: z.ZodNumber;
|
|
973
|
+
/** Human-readable confidence level */
|
|
974
|
+
confidenceLevel: z.ZodEnum<["Low", "Medium", "High", "VeryHigh"]>;
|
|
975
|
+
/** Human-readable reputation level */
|
|
976
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
977
|
+
/** Whether this is a provisional score */
|
|
978
|
+
isProvisional: z.ZodBoolean;
|
|
979
|
+
/** Timestamp when the score was calculated (ISO 8601) */
|
|
980
|
+
calculatedAt: z.ZodString;
|
|
981
|
+
/** Optional score components (for transparency) */
|
|
982
|
+
components: z.ZodOptional<z.ZodObject<{
|
|
983
|
+
priorScore: z.ZodNumber;
|
|
984
|
+
empiricalScore: z.ZodNumber;
|
|
985
|
+
confidenceWeight: z.ZodNumber;
|
|
986
|
+
priorWeight: z.ZodNumber;
|
|
987
|
+
}, "strip", z.ZodTypeAny, {
|
|
988
|
+
priorScore: number;
|
|
989
|
+
empiricalScore: number;
|
|
990
|
+
confidenceWeight: number;
|
|
991
|
+
priorWeight: number;
|
|
992
|
+
}, {
|
|
993
|
+
priorScore: number;
|
|
994
|
+
empiricalScore: number;
|
|
995
|
+
confidenceWeight: number;
|
|
996
|
+
priorWeight: number;
|
|
997
|
+
}>>;
|
|
998
|
+
}, "strip", z.ZodTypeAny, {
|
|
999
|
+
score: number;
|
|
1000
|
+
confidence: number;
|
|
1001
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1002
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1003
|
+
isProvisional: boolean;
|
|
1004
|
+
calculatedAt: string;
|
|
1005
|
+
components?: {
|
|
1006
|
+
priorScore: number;
|
|
1007
|
+
empiricalScore: number;
|
|
1008
|
+
confidenceWeight: number;
|
|
1009
|
+
priorWeight: number;
|
|
1010
|
+
} | undefined;
|
|
1011
|
+
}, {
|
|
1012
|
+
score: number;
|
|
1013
|
+
confidence: number;
|
|
1014
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1015
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1016
|
+
isProvisional: boolean;
|
|
1017
|
+
calculatedAt: string;
|
|
1018
|
+
components?: {
|
|
1019
|
+
priorScore: number;
|
|
1020
|
+
empiricalScore: number;
|
|
1021
|
+
confidenceWeight: number;
|
|
1022
|
+
priorWeight: number;
|
|
1023
|
+
} | undefined;
|
|
1024
|
+
}>;
|
|
1025
|
+
/** Context in which this reputation applies */
|
|
1026
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
1027
|
+
/** Scope of the reputation (e.g., 'global', 'domain-specific') */
|
|
1028
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1029
|
+
/** Domain or category (e.g., 'e-commerce', 'healthcare') */
|
|
1030
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
1031
|
+
/** Geographic region (if applicable) */
|
|
1032
|
+
region: z.ZodOptional<z.ZodString>;
|
|
1033
|
+
}, "strip", z.ZodTypeAny, {
|
|
1034
|
+
scope: string;
|
|
1035
|
+
domain?: string | undefined;
|
|
1036
|
+
region?: string | undefined;
|
|
1037
|
+
}, {
|
|
1038
|
+
scope?: string | undefined;
|
|
1039
|
+
domain?: string | undefined;
|
|
1040
|
+
region?: string | undefined;
|
|
1041
|
+
}>>;
|
|
1042
|
+
}, "strip", z.ZodTypeAny, {
|
|
1043
|
+
id: string;
|
|
1044
|
+
reputation: {
|
|
1045
|
+
score: number;
|
|
1046
|
+
confidence: number;
|
|
1047
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1048
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1049
|
+
isProvisional: boolean;
|
|
1050
|
+
calculatedAt: string;
|
|
1051
|
+
components?: {
|
|
1052
|
+
priorScore: number;
|
|
1053
|
+
empiricalScore: number;
|
|
1054
|
+
confidenceWeight: number;
|
|
1055
|
+
priorWeight: number;
|
|
1056
|
+
} | undefined;
|
|
1057
|
+
};
|
|
1058
|
+
context?: {
|
|
1059
|
+
scope: string;
|
|
1060
|
+
domain?: string | undefined;
|
|
1061
|
+
region?: string | undefined;
|
|
1062
|
+
} | undefined;
|
|
1063
|
+
}, {
|
|
1064
|
+
id: string;
|
|
1065
|
+
reputation: {
|
|
1066
|
+
score: number;
|
|
1067
|
+
confidence: number;
|
|
1068
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1069
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1070
|
+
isProvisional: boolean;
|
|
1071
|
+
calculatedAt: string;
|
|
1072
|
+
components?: {
|
|
1073
|
+
priorScore: number;
|
|
1074
|
+
empiricalScore: number;
|
|
1075
|
+
confidenceWeight: number;
|
|
1076
|
+
priorWeight: number;
|
|
1077
|
+
} | undefined;
|
|
1078
|
+
};
|
|
1079
|
+
context?: {
|
|
1080
|
+
scope?: string | undefined;
|
|
1081
|
+
domain?: string | undefined;
|
|
1082
|
+
region?: string | undefined;
|
|
1083
|
+
} | undefined;
|
|
1084
|
+
}>;
|
|
1085
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
1086
|
+
id: z.ZodString;
|
|
1087
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
1088
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
1089
|
+
statusListIndex: z.ZodString;
|
|
1090
|
+
statusListCredential: z.ZodString;
|
|
1091
|
+
}, "strip", z.ZodTypeAny, {
|
|
1092
|
+
type: "StatusList2021Entry";
|
|
1093
|
+
id: string;
|
|
1094
|
+
statusPurpose: "revocation" | "suspension";
|
|
1095
|
+
statusListIndex: string;
|
|
1096
|
+
statusListCredential: string;
|
|
1097
|
+
}, {
|
|
1098
|
+
type: "StatusList2021Entry";
|
|
1099
|
+
id: string;
|
|
1100
|
+
statusPurpose: "revocation" | "suspension";
|
|
1101
|
+
statusListIndex: string;
|
|
1102
|
+
statusListCredential: string;
|
|
1103
|
+
}>>;
|
|
1104
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
1105
|
+
type: z.ZodString;
|
|
1106
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1107
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1108
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1109
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1110
|
+
type: z.ZodString;
|
|
1111
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1112
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1113
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1114
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1115
|
+
type: z.ZodString;
|
|
1116
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1117
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1118
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1119
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
1120
|
+
}, z.ZodTypeAny, "passthrough">, z.objectOutputType<{
|
|
1121
|
+
id: z.ZodOptional<z.ZodString>;
|
|
1122
|
+
} & {
|
|
1123
|
+
"@context": z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "many">, (string | Record<string, any>)[], (string | Record<string, any>)[]>;
|
|
1124
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
1125
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1126
|
+
id: z.ZodString;
|
|
1127
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1128
|
+
id: z.ZodString;
|
|
1129
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1130
|
+
id: z.ZodString;
|
|
1131
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
1132
|
+
issuanceDate: z.ZodString;
|
|
1133
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
1134
|
+
credentialSubject: z.ZodObject<{
|
|
1135
|
+
/** Subject DID (the agent whose reputation is being attested) */
|
|
1136
|
+
id: z.ZodEffects<z.ZodString, string, string>;
|
|
1137
|
+
/** The reputation score being attested */
|
|
1138
|
+
reputation: z.ZodObject<{
|
|
1139
|
+
/** Final reputation score (0-100) */
|
|
1140
|
+
score: z.ZodNumber;
|
|
1141
|
+
/** Confidence in the score (0-1) */
|
|
1142
|
+
confidence: z.ZodNumber;
|
|
1143
|
+
/** Human-readable confidence level */
|
|
1144
|
+
confidenceLevel: z.ZodEnum<["Low", "Medium", "High", "VeryHigh"]>;
|
|
1145
|
+
/** Human-readable reputation level */
|
|
1146
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
1147
|
+
/** Whether this is a provisional score */
|
|
1148
|
+
isProvisional: z.ZodBoolean;
|
|
1149
|
+
/** Timestamp when the score was calculated (ISO 8601) */
|
|
1150
|
+
calculatedAt: z.ZodString;
|
|
1151
|
+
/** Optional score components (for transparency) */
|
|
1152
|
+
components: z.ZodOptional<z.ZodObject<{
|
|
1153
|
+
priorScore: z.ZodNumber;
|
|
1154
|
+
empiricalScore: z.ZodNumber;
|
|
1155
|
+
confidenceWeight: z.ZodNumber;
|
|
1156
|
+
priorWeight: z.ZodNumber;
|
|
1157
|
+
}, "strip", z.ZodTypeAny, {
|
|
1158
|
+
priorScore: number;
|
|
1159
|
+
empiricalScore: number;
|
|
1160
|
+
confidenceWeight: number;
|
|
1161
|
+
priorWeight: number;
|
|
1162
|
+
}, {
|
|
1163
|
+
priorScore: number;
|
|
1164
|
+
empiricalScore: number;
|
|
1165
|
+
confidenceWeight: number;
|
|
1166
|
+
priorWeight: number;
|
|
1167
|
+
}>>;
|
|
1168
|
+
}, "strip", z.ZodTypeAny, {
|
|
1169
|
+
score: number;
|
|
1170
|
+
confidence: number;
|
|
1171
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1172
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1173
|
+
isProvisional: boolean;
|
|
1174
|
+
calculatedAt: string;
|
|
1175
|
+
components?: {
|
|
1176
|
+
priorScore: number;
|
|
1177
|
+
empiricalScore: number;
|
|
1178
|
+
confidenceWeight: number;
|
|
1179
|
+
priorWeight: number;
|
|
1180
|
+
} | undefined;
|
|
1181
|
+
}, {
|
|
1182
|
+
score: number;
|
|
1183
|
+
confidence: number;
|
|
1184
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1185
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1186
|
+
isProvisional: boolean;
|
|
1187
|
+
calculatedAt: string;
|
|
1188
|
+
components?: {
|
|
1189
|
+
priorScore: number;
|
|
1190
|
+
empiricalScore: number;
|
|
1191
|
+
confidenceWeight: number;
|
|
1192
|
+
priorWeight: number;
|
|
1193
|
+
} | undefined;
|
|
1194
|
+
}>;
|
|
1195
|
+
/** Context in which this reputation applies */
|
|
1196
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
1197
|
+
/** Scope of the reputation (e.g., 'global', 'domain-specific') */
|
|
1198
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1199
|
+
/** Domain or category (e.g., 'e-commerce', 'healthcare') */
|
|
1200
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
1201
|
+
/** Geographic region (if applicable) */
|
|
1202
|
+
region: z.ZodOptional<z.ZodString>;
|
|
1203
|
+
}, "strip", z.ZodTypeAny, {
|
|
1204
|
+
scope: string;
|
|
1205
|
+
domain?: string | undefined;
|
|
1206
|
+
region?: string | undefined;
|
|
1207
|
+
}, {
|
|
1208
|
+
scope?: string | undefined;
|
|
1209
|
+
domain?: string | undefined;
|
|
1210
|
+
region?: string | undefined;
|
|
1211
|
+
}>>;
|
|
1212
|
+
}, "strip", z.ZodTypeAny, {
|
|
1213
|
+
id: string;
|
|
1214
|
+
reputation: {
|
|
1215
|
+
score: number;
|
|
1216
|
+
confidence: number;
|
|
1217
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1218
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1219
|
+
isProvisional: boolean;
|
|
1220
|
+
calculatedAt: string;
|
|
1221
|
+
components?: {
|
|
1222
|
+
priorScore: number;
|
|
1223
|
+
empiricalScore: number;
|
|
1224
|
+
confidenceWeight: number;
|
|
1225
|
+
priorWeight: number;
|
|
1226
|
+
} | undefined;
|
|
1227
|
+
};
|
|
1228
|
+
context?: {
|
|
1229
|
+
scope: string;
|
|
1230
|
+
domain?: string | undefined;
|
|
1231
|
+
region?: string | undefined;
|
|
1232
|
+
} | undefined;
|
|
1233
|
+
}, {
|
|
1234
|
+
id: string;
|
|
1235
|
+
reputation: {
|
|
1236
|
+
score: number;
|
|
1237
|
+
confidence: number;
|
|
1238
|
+
confidenceLevel: "Low" | "Medium" | "High" | "VeryHigh";
|
|
1239
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1240
|
+
isProvisional: boolean;
|
|
1241
|
+
calculatedAt: string;
|
|
1242
|
+
components?: {
|
|
1243
|
+
priorScore: number;
|
|
1244
|
+
empiricalScore: number;
|
|
1245
|
+
confidenceWeight: number;
|
|
1246
|
+
priorWeight: number;
|
|
1247
|
+
} | undefined;
|
|
1248
|
+
};
|
|
1249
|
+
context?: {
|
|
1250
|
+
scope?: string | undefined;
|
|
1251
|
+
domain?: string | undefined;
|
|
1252
|
+
region?: string | undefined;
|
|
1253
|
+
} | undefined;
|
|
1254
|
+
}>;
|
|
1255
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
1256
|
+
id: z.ZodString;
|
|
1257
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
1258
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
1259
|
+
statusListIndex: z.ZodString;
|
|
1260
|
+
statusListCredential: z.ZodString;
|
|
1261
|
+
}, "strip", z.ZodTypeAny, {
|
|
1262
|
+
type: "StatusList2021Entry";
|
|
1263
|
+
id: string;
|
|
1264
|
+
statusPurpose: "revocation" | "suspension";
|
|
1265
|
+
statusListIndex: string;
|
|
1266
|
+
statusListCredential: string;
|
|
1267
|
+
}, {
|
|
1268
|
+
type: "StatusList2021Entry";
|
|
1269
|
+
id: string;
|
|
1270
|
+
statusPurpose: "revocation" | "suspension";
|
|
1271
|
+
statusListIndex: string;
|
|
1272
|
+
statusListCredential: string;
|
|
1273
|
+
}>>;
|
|
1274
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
1275
|
+
type: z.ZodString;
|
|
1276
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1277
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1278
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1279
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1280
|
+
type: z.ZodString;
|
|
1281
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1282
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1283
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1284
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1285
|
+
type: z.ZodString;
|
|
1286
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1287
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1288
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1289
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
1290
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Validate a reputation attestation
|
|
1293
|
+
*
|
|
1294
|
+
* @param attestation - The attestation to validate
|
|
1295
|
+
* @returns Validation result
|
|
1296
|
+
*/
|
|
1297
|
+
export declare function validateReputationAttestation(attestation: unknown): z.SafeParseReturnType<z.objectInputType<{
|
|
1298
|
+
'@context': z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
1299
|
+
id: z.ZodOptional<z.ZodString>;
|
|
1300
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1301
|
+
id: z.ZodString;
|
|
1302
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1303
|
+
id: z.ZodString;
|
|
1304
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1305
|
+
id: z.ZodString;
|
|
1306
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
1307
|
+
issuanceDate: z.ZodString;
|
|
1308
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
1309
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
1310
|
+
id: z.ZodString;
|
|
1311
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
1312
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
1313
|
+
statusListIndex: z.ZodString;
|
|
1314
|
+
statusListCredential: z.ZodString;
|
|
1315
|
+
}, "strip", z.ZodTypeAny, {
|
|
1316
|
+
type: "StatusList2021Entry";
|
|
1317
|
+
id: string;
|
|
1318
|
+
statusPurpose: "revocation" | "suspension";
|
|
1319
|
+
statusListIndex: string;
|
|
1320
|
+
statusListCredential: string;
|
|
1321
|
+
}, {
|
|
1322
|
+
type: "StatusList2021Entry";
|
|
1323
|
+
id: string;
|
|
1324
|
+
statusPurpose: "revocation" | "suspension";
|
|
1325
|
+
statusListIndex: string;
|
|
1326
|
+
statusListCredential: string;
|
|
1327
|
+
}>>;
|
|
1328
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
1329
|
+
type: z.ZodString;
|
|
1330
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1331
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1332
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1333
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1334
|
+
type: z.ZodString;
|
|
1335
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1336
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1337
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1338
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1339
|
+
type: z.ZodString;
|
|
1340
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1341
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1342
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1343
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
1344
|
+
} & {
|
|
1345
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
1346
|
+
credentialSubject: z.ZodObject<{
|
|
1347
|
+
/** Subject DID */
|
|
1348
|
+
id: z.ZodString;
|
|
1349
|
+
/** Reputation level (human-readable) */
|
|
1350
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
1351
|
+
/** Numeric score (0-100) */
|
|
1352
|
+
score: z.ZodNumber;
|
|
1353
|
+
/** Whether the attestation issuer has high confidence */
|
|
1354
|
+
highConfidence: z.ZodBoolean;
|
|
1355
|
+
/** Specific capability or context being attested */
|
|
1356
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
1357
|
+
}, "strip", z.ZodTypeAny, {
|
|
1358
|
+
score: number;
|
|
1359
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1360
|
+
id: string;
|
|
1361
|
+
highConfidence: boolean;
|
|
1362
|
+
capability?: string | undefined;
|
|
1363
|
+
}, {
|
|
1364
|
+
score: number;
|
|
1365
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1366
|
+
id: string;
|
|
1367
|
+
highConfidence: boolean;
|
|
1368
|
+
capability?: string | undefined;
|
|
1369
|
+
}>;
|
|
1370
|
+
}, z.ZodTypeAny, "passthrough">, z.objectOutputType<{
|
|
1371
|
+
'@context': z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">, [string | Record<string, any>, ...(string | Record<string, any>)[]], [string | Record<string, any>, ...(string | Record<string, any>)[]]>;
|
|
1372
|
+
id: z.ZodOptional<z.ZodString>;
|
|
1373
|
+
issuer: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
1374
|
+
id: z.ZodString;
|
|
1375
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1376
|
+
id: z.ZodString;
|
|
1377
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1378
|
+
id: z.ZodString;
|
|
1379
|
+
}, z.ZodTypeAny, "passthrough">>]>;
|
|
1380
|
+
issuanceDate: z.ZodString;
|
|
1381
|
+
expirationDate: z.ZodOptional<z.ZodString>;
|
|
1382
|
+
credentialStatus: z.ZodOptional<z.ZodObject<{
|
|
1383
|
+
id: z.ZodString;
|
|
1384
|
+
type: z.ZodLiteral<"StatusList2021Entry">;
|
|
1385
|
+
statusPurpose: z.ZodEnum<["revocation", "suspension"]>;
|
|
1386
|
+
statusListIndex: z.ZodString;
|
|
1387
|
+
statusListCredential: z.ZodString;
|
|
1388
|
+
}, "strip", z.ZodTypeAny, {
|
|
1389
|
+
type: "StatusList2021Entry";
|
|
1390
|
+
id: string;
|
|
1391
|
+
statusPurpose: "revocation" | "suspension";
|
|
1392
|
+
statusListIndex: string;
|
|
1393
|
+
statusListCredential: string;
|
|
1394
|
+
}, {
|
|
1395
|
+
type: "StatusList2021Entry";
|
|
1396
|
+
id: string;
|
|
1397
|
+
statusPurpose: "revocation" | "suspension";
|
|
1398
|
+
statusListIndex: string;
|
|
1399
|
+
statusListCredential: string;
|
|
1400
|
+
}>>;
|
|
1401
|
+
proof: z.ZodOptional<z.ZodObject<{
|
|
1402
|
+
type: z.ZodString;
|
|
1403
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1404
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1405
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1406
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1407
|
+
type: z.ZodString;
|
|
1408
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1409
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1410
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1411
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1412
|
+
type: z.ZodString;
|
|
1413
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1414
|
+
verificationMethod: z.ZodOptional<z.ZodString>;
|
|
1415
|
+
proofPurpose: z.ZodOptional<z.ZodString>;
|
|
1416
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
1417
|
+
} & {
|
|
1418
|
+
type: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
1419
|
+
credentialSubject: z.ZodObject<{
|
|
1420
|
+
/** Subject DID */
|
|
1421
|
+
id: z.ZodString;
|
|
1422
|
+
/** Reputation level (human-readable) */
|
|
1423
|
+
level: z.ZodEnum<["Unknown", "Poor", "BelowAverage", "Average", "Good", "Excellent", "Outstanding"]>;
|
|
1424
|
+
/** Numeric score (0-100) */
|
|
1425
|
+
score: z.ZodNumber;
|
|
1426
|
+
/** Whether the attestation issuer has high confidence */
|
|
1427
|
+
highConfidence: z.ZodBoolean;
|
|
1428
|
+
/** Specific capability or context being attested */
|
|
1429
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
1430
|
+
}, "strip", z.ZodTypeAny, {
|
|
1431
|
+
score: number;
|
|
1432
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1433
|
+
id: string;
|
|
1434
|
+
highConfidence: boolean;
|
|
1435
|
+
capability?: string | undefined;
|
|
1436
|
+
}, {
|
|
1437
|
+
score: number;
|
|
1438
|
+
level: "Unknown" | "Poor" | "BelowAverage" | "Average" | "Good" | "Excellent" | "Outstanding";
|
|
1439
|
+
id: string;
|
|
1440
|
+
highConfidence: boolean;
|
|
1441
|
+
capability?: string | undefined;
|
|
1442
|
+
}>;
|
|
1443
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Create an unsigned reputation credential (requires signing)
|
|
1446
|
+
*
|
|
1447
|
+
* @param agentDid - DID of the agent
|
|
1448
|
+
* @param score - Reputation score
|
|
1449
|
+
* @param issuerDid - DID of the issuing authority
|
|
1450
|
+
* @param options - Optional credential options
|
|
1451
|
+
* @returns Unsigned ReputationCredential
|
|
1452
|
+
*/
|
|
1453
|
+
export declare function createUnsignedReputationCredential(agentDid: string, score: ReputationScore, issuerDid: string, options?: {
|
|
1454
|
+
id?: string;
|
|
1455
|
+
expirationDate?: string;
|
|
1456
|
+
credentialStatus?: z.infer<typeof CredentialStatusSchema>;
|
|
1457
|
+
context?: {
|
|
1458
|
+
scope?: string;
|
|
1459
|
+
domain?: string;
|
|
1460
|
+
region?: string;
|
|
1461
|
+
};
|
|
1462
|
+
}): Omit<ReputationCredential, "proof">;
|
|
1463
|
+
/**
|
|
1464
|
+
* Extract reputation score from a reputation credential
|
|
1465
|
+
*
|
|
1466
|
+
* @param credential - The reputation credential
|
|
1467
|
+
* @returns Reputation score data
|
|
1468
|
+
*/
|
|
1469
|
+
export declare function extractReputationFromCredential(credential: ReputationCredential): ReputationScore;
|
|
1470
|
+
/**
|
|
1471
|
+
* Check if a reputation credential has expired
|
|
1472
|
+
*
|
|
1473
|
+
* @param credential - The credential to check
|
|
1474
|
+
* @returns true if expired
|
|
1475
|
+
*/
|
|
1476
|
+
export declare function isReputationCredentialExpired(credential: ReputationCredential): boolean;
|
|
1477
|
+
/**
|
|
1478
|
+
* Check if the reputation score in a credential is stale
|
|
1479
|
+
* (calculated too long ago to be reliable)
|
|
1480
|
+
*
|
|
1481
|
+
* @param credential - The credential to check
|
|
1482
|
+
* @param maxAgeMs - Maximum age in milliseconds (default: 24 hours)
|
|
1483
|
+
* @returns true if stale
|
|
1484
|
+
*/
|
|
1485
|
+
export declare function isReputationCredentialStale(credential: ReputationCredential, maxAgeMs?: number): boolean;
|
|
1486
|
+
/**
|
|
1487
|
+
* Default reputation credential validity period (7 days)
|
|
1488
|
+
*/
|
|
1489
|
+
export declare const DEFAULT_REPUTATION_CREDENTIAL_VALIDITY_MS: number;
|
|
1490
|
+
/**
|
|
1491
|
+
* Recommended maximum age for reputation scores (24 hours)
|
|
1492
|
+
*/
|
|
1493
|
+
export declare const RECOMMENDED_REPUTATION_FRESHNESS_MS: number;
|