@vorionsys/contracts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aci/aci-string.d.ts +539 -0
- package/dist/aci/aci-string.d.ts.map +1 -0
- package/dist/aci/aci-string.js +563 -0
- package/dist/aci/aci-string.js.map +1 -0
- package/dist/aci/attestation.d.ts +648 -0
- package/dist/aci/attestation.d.ts.map +1 -0
- package/dist/aci/attestation.js +289 -0
- package/dist/aci/attestation.js.map +1 -0
- package/dist/aci/domains.d.ts +260 -0
- package/dist/aci/domains.d.ts.map +1 -0
- package/dist/aci/domains.js +322 -0
- package/dist/aci/domains.js.map +1 -0
- package/dist/aci/effective-permission.d.ts +371 -0
- package/dist/aci/effective-permission.d.ts.map +1 -0
- package/dist/aci/effective-permission.js +351 -0
- package/dist/aci/effective-permission.js.map +1 -0
- package/dist/aci/identity.d.ts +1100 -0
- package/dist/aci/identity.d.ts.map +1 -0
- package/dist/aci/identity.js +328 -0
- package/dist/aci/identity.js.map +1 -0
- package/dist/aci/index.d.ts +67 -0
- package/dist/aci/index.d.ts.map +1 -0
- package/dist/aci/index.js +157 -0
- package/dist/aci/index.js.map +1 -0
- package/dist/aci/jwt-claims.d.ts +756 -0
- package/dist/aci/jwt-claims.d.ts.map +1 -0
- package/dist/aci/jwt-claims.js +335 -0
- package/dist/aci/jwt-claims.js.map +1 -0
- package/dist/aci/levels.d.ts +279 -0
- package/dist/aci/levels.d.ts.map +1 -0
- package/dist/aci/levels.js +467 -0
- package/dist/aci/levels.js.map +1 -0
- package/dist/aci/mapping.d.ts +291 -0
- package/dist/aci/mapping.d.ts.map +1 -0
- package/dist/aci/mapping.js +427 -0
- package/dist/aci/mapping.js.map +1 -0
- package/dist/aci/skills.d.ts +314 -0
- package/dist/aci/skills.d.ts.map +1 -0
- package/dist/aci/skills.js +404 -0
- package/dist/aci/skills.js.map +1 -0
- package/dist/aci/tiers.d.ts +403 -0
- package/dist/aci/tiers.d.ts.map +1 -0
- package/dist/aci/tiers.js +659 -0
- package/dist/aci/tiers.js.map +1 -0
- package/dist/canonical/agent.d.ts +796 -0
- package/dist/canonical/agent.d.ts.map +1 -0
- package/dist/canonical/agent.js +527 -0
- package/dist/canonical/agent.js.map +1 -0
- package/dist/canonical/governance.d.ts +905 -0
- package/dist/canonical/governance.d.ts.map +1 -0
- package/dist/canonical/governance.js +454 -0
- package/dist/canonical/governance.js.map +1 -0
- package/dist/canonical/index.d.ts +17 -0
- package/dist/canonical/index.d.ts.map +1 -0
- package/dist/canonical/index.js +21 -0
- package/dist/canonical/index.js.map +1 -0
- package/dist/canonical/intent.d.ts +727 -0
- package/dist/canonical/intent.d.ts.map +1 -0
- package/dist/canonical/intent.js +203 -0
- package/dist/canonical/intent.js.map +1 -0
- package/dist/canonical/risk-level.d.ts +344 -0
- package/dist/canonical/risk-level.d.ts.map +1 -0
- package/dist/canonical/risk-level.js +472 -0
- package/dist/canonical/risk-level.js.map +1 -0
- package/dist/canonical/trust-band.d.ts +239 -0
- package/dist/canonical/trust-band.d.ts.map +1 -0
- package/dist/canonical/trust-band.js +298 -0
- package/dist/canonical/trust-band.js.map +1 -0
- package/dist/canonical/trust-score.d.ts +301 -0
- package/dist/canonical/trust-score.d.ts.map +1 -0
- package/dist/canonical/trust-score.js +390 -0
- package/dist/canonical/trust-score.js.map +1 -0
- package/dist/canonical/trust-signal.d.ts +617 -0
- package/dist/canonical/trust-signal.d.ts.map +1 -0
- package/dist/canonical/trust-signal.js +355 -0
- package/dist/canonical/trust-signal.js.map +1 -0
- package/dist/canonical/validation.d.ts +231 -0
- package/dist/canonical/validation.d.ts.map +1 -0
- package/dist/canonical/validation.js +558 -0
- package/dist/canonical/validation.js.map +1 -0
- package/dist/common/index.d.ts +7 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +7 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/primitives.d.ts +56 -0
- package/dist/common/primitives.d.ts.map +1 -0
- package/dist/common/primitives.js +70 -0
- package/dist/common/primitives.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/v2/canary-probe.d.ts +201 -0
- package/dist/v2/canary-probe.d.ts.map +1 -0
- package/dist/v2/canary-probe.js +99 -0
- package/dist/v2/canary-probe.js.map +1 -0
- package/dist/v2/component.d.ts +132 -0
- package/dist/v2/component.d.ts.map +1 -0
- package/dist/v2/component.js +5 -0
- package/dist/v2/component.js.map +1 -0
- package/dist/v2/decision.d.ts +310 -0
- package/dist/v2/decision.d.ts.map +1 -0
- package/dist/v2/decision.js +21 -0
- package/dist/v2/decision.js.map +1 -0
- package/dist/v2/enums.d.ts +185 -0
- package/dist/v2/enums.d.ts.map +1 -0
- package/dist/v2/enums.js +203 -0
- package/dist/v2/enums.js.map +1 -0
- package/dist/v2/evidence.d.ts +368 -0
- package/dist/v2/evidence.d.ts.map +1 -0
- package/dist/v2/evidence.js +152 -0
- package/dist/v2/evidence.js.map +1 -0
- package/dist/v2/execution.d.ts +190 -0
- package/dist/v2/execution.d.ts.map +1 -0
- package/dist/v2/execution.js +5 -0
- package/dist/v2/execution.js.map +1 -0
- package/dist/v2/index.d.ts +19 -0
- package/dist/v2/index.d.ts.map +1 -0
- package/dist/v2/index.js +32 -0
- package/dist/v2/index.js.map +1 -0
- package/dist/v2/intent.d.ts +89 -0
- package/dist/v2/intent.d.ts.map +1 -0
- package/dist/v2/intent.js +5 -0
- package/dist/v2/intent.js.map +1 -0
- package/dist/v2/policy-bundle.d.ts +166 -0
- package/dist/v2/policy-bundle.d.ts.map +1 -0
- package/dist/v2/policy-bundle.js +20 -0
- package/dist/v2/policy-bundle.js.map +1 -0
- package/dist/v2/pre-action-gate.d.ts +185 -0
- package/dist/v2/pre-action-gate.d.ts.map +1 -0
- package/dist/v2/pre-action-gate.js +64 -0
- package/dist/v2/pre-action-gate.js.map +1 -0
- package/dist/v2/proof-event.d.ts +201 -0
- package/dist/v2/proof-event.d.ts.map +1 -0
- package/dist/v2/proof-event.js +5 -0
- package/dist/v2/proof-event.js.map +1 -0
- package/dist/v2/retention.d.ts +329 -0
- package/dist/v2/retention.d.ts.map +1 -0
- package/dist/v2/retention.js +162 -0
- package/dist/v2/retention.js.map +1 -0
- package/dist/v2/trust-delta.d.ts +119 -0
- package/dist/v2/trust-delta.d.ts.map +1 -0
- package/dist/v2/trust-delta.js +28 -0
- package/dist/v2/trust-delta.js.map +1 -0
- package/dist/v2/trust-profile.d.ts +337 -0
- package/dist/v2/trust-profile.d.ts.map +1 -0
- package/dist/v2/trust-profile.js +96 -0
- package/dist/v2/trust-profile.js.map +1 -0
- package/dist/validators/decision.d.ts +430 -0
- package/dist/validators/decision.d.ts.map +1 -0
- package/dist/validators/decision.js +61 -0
- package/dist/validators/decision.js.map +1 -0
- package/dist/validators/enums.d.ts +24 -0
- package/dist/validators/enums.d.ts.map +1 -0
- package/dist/validators/enums.js +24 -0
- package/dist/validators/enums.js.map +1 -0
- package/dist/validators/index.d.ts +30 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +42 -0
- package/dist/validators/index.js.map +1 -0
- package/dist/validators/intent.d.ts +229 -0
- package/dist/validators/intent.d.ts.map +1 -0
- package/dist/validators/intent.js +47 -0
- package/dist/validators/intent.js.map +1 -0
- package/dist/validators/proof-event.d.ts +981 -0
- package/dist/validators/proof-event.d.ts.map +1 -0
- package/dist/validators/proof-event.js +134 -0
- package/dist/validators/proof-event.js.map +1 -0
- package/dist/validators/trust-profile.d.ts +350 -0
- package/dist/validators/trust-profile.d.ts.map +1 -0
- package/dist/validators/trust-profile.js +65 -0
- package/dist/validators/trust-profile.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ACI Attestation Types
|
|
3
|
+
*
|
|
4
|
+
* Defines types for attestations - cryptographic proofs issued by certification
|
|
5
|
+
* authorities that verify agent capabilities, identity, or compliance.
|
|
6
|
+
*
|
|
7
|
+
* Attestations are the foundation of trust in the ACI system, providing
|
|
8
|
+
* verifiable evidence that an agent has been certified at a particular level.
|
|
9
|
+
*
|
|
10
|
+
* @module @vorion/contracts/aci/attestation
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { certificationTierSchema } from './tiers.js';
|
|
14
|
+
import { domainCodeSchema } from './domains.js';
|
|
15
|
+
/**
|
|
16
|
+
* Array of all attestation scopes.
|
|
17
|
+
*/
|
|
18
|
+
export const ATTESTATION_SCOPES = [
|
|
19
|
+
'full',
|
|
20
|
+
'domain',
|
|
21
|
+
'level',
|
|
22
|
+
'training',
|
|
23
|
+
'security',
|
|
24
|
+
'compliance',
|
|
25
|
+
'identity',
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Zod schema for AttestationScope validation.
|
|
29
|
+
*/
|
|
30
|
+
export const attestationScopeSchema = z.enum(['full', 'domain', 'level', 'training', 'security', 'compliance', 'identity'], { errorMap: () => ({ message: 'Invalid attestation scope' }) });
|
|
31
|
+
/**
|
|
32
|
+
* Descriptions for attestation scopes.
|
|
33
|
+
*/
|
|
34
|
+
export const ATTESTATION_SCOPE_DESCRIPTIONS = {
|
|
35
|
+
full: 'Complete capability attestation covering all aspects of agent certification',
|
|
36
|
+
domain: 'Attestation for a specific capability domain',
|
|
37
|
+
level: 'Attestation for a specific autonomy level',
|
|
38
|
+
training: 'Attestation for training data quality and methodology',
|
|
39
|
+
security: 'Security audit attestation',
|
|
40
|
+
compliance: 'Regulatory compliance attestation',
|
|
41
|
+
identity: 'Identity verification attestation',
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Zod schema for AttestationStatus validation.
|
|
45
|
+
*/
|
|
46
|
+
export const attestationStatusSchema = z.enum(['active', 'expired', 'revoked', 'suspended', 'pending'], { errorMap: () => ({ message: 'Invalid attestation status' }) });
|
|
47
|
+
/**
|
|
48
|
+
* Zod schema for AttestationEvidence validation.
|
|
49
|
+
*/
|
|
50
|
+
export const attestationEvidenceSchema = z.object({
|
|
51
|
+
testResults: z.string().url().optional(),
|
|
52
|
+
auditReport: z.string().url().optional(),
|
|
53
|
+
trainingVerification: z.string().url().optional(),
|
|
54
|
+
complianceDocumentation: z.string().url().optional(),
|
|
55
|
+
}).catchall(z.string().url().optional());
|
|
56
|
+
/**
|
|
57
|
+
* Zod schema for AttestationProof validation.
|
|
58
|
+
*/
|
|
59
|
+
export const attestationProofSchema = z.object({
|
|
60
|
+
type: z.string().min(1),
|
|
61
|
+
created: z.string().datetime(),
|
|
62
|
+
verificationMethod: z.string().min(1),
|
|
63
|
+
proofPurpose: z.string().min(1),
|
|
64
|
+
jws: z.string().min(1),
|
|
65
|
+
nonce: z.string().optional(),
|
|
66
|
+
challenge: z.string().optional(),
|
|
67
|
+
domain: z.string().optional(),
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Zod schema for Attestation validation.
|
|
71
|
+
*/
|
|
72
|
+
export const attestationSchema = z.object({
|
|
73
|
+
id: z.string().min(1),
|
|
74
|
+
issuer: z.string().min(1),
|
|
75
|
+
subject: z.string().min(1),
|
|
76
|
+
scope: attestationScopeSchema,
|
|
77
|
+
certificationTier: certificationTierSchema,
|
|
78
|
+
domains: z.array(domainCodeSchema).optional(),
|
|
79
|
+
issuedAt: z.date(),
|
|
80
|
+
expiresAt: z.date(),
|
|
81
|
+
status: attestationStatusSchema,
|
|
82
|
+
evidence: attestationEvidenceSchema.optional(),
|
|
83
|
+
proof: attestationProofSchema.optional(),
|
|
84
|
+
metadata: z.record(z.unknown()).optional(),
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Zod schema for AttestationVerificationError.
|
|
88
|
+
*/
|
|
89
|
+
export const attestationVerificationErrorSchema = z.object({
|
|
90
|
+
code: z.enum([
|
|
91
|
+
'INVALID_SIGNATURE',
|
|
92
|
+
'EXPIRED',
|
|
93
|
+
'REVOKED',
|
|
94
|
+
'SUSPENDED',
|
|
95
|
+
'ISSUER_NOT_TRUSTED',
|
|
96
|
+
'SUBJECT_MISMATCH',
|
|
97
|
+
'INVALID_FORMAT',
|
|
98
|
+
'PROOF_MISSING',
|
|
99
|
+
'VERIFICATION_FAILED',
|
|
100
|
+
]),
|
|
101
|
+
message: z.string(),
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* Zod schema for AttestationVerificationWarning.
|
|
105
|
+
*/
|
|
106
|
+
export const attestationVerificationWarningSchema = z.object({
|
|
107
|
+
code: z.string(),
|
|
108
|
+
message: z.string(),
|
|
109
|
+
});
|
|
110
|
+
/**
|
|
111
|
+
* Zod schema for AttestationVerificationResult.
|
|
112
|
+
*/
|
|
113
|
+
export const attestationVerificationResultSchema = z.object({
|
|
114
|
+
valid: z.boolean(),
|
|
115
|
+
errors: z.array(attestationVerificationErrorSchema),
|
|
116
|
+
warnings: z.array(attestationVerificationWarningSchema),
|
|
117
|
+
attestation: attestationSchema.optional(),
|
|
118
|
+
verifiedAt: z.date(),
|
|
119
|
+
verificationMethod: z.string().optional(),
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* Creates a new attestation.
|
|
123
|
+
*
|
|
124
|
+
* @param options - Attestation creation options
|
|
125
|
+
* @returns New attestation (without proof - must be signed separately)
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const attestation = createAttestation({
|
|
130
|
+
* issuer: 'did:web:certifier.example.com',
|
|
131
|
+
* subject: 'did:web:agent.acme.com',
|
|
132
|
+
* scope: 'full',
|
|
133
|
+
* certificationTier: CertificationTier.T3_CERTIFIED,
|
|
134
|
+
* validityMs: 365 * 24 * 60 * 60 * 1000, // 1 year
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export function createAttestation(options) {
|
|
139
|
+
const now = new Date();
|
|
140
|
+
const validityMs = options.validityMs ?? 365 * 24 * 60 * 60 * 1000; // Default: 1 year
|
|
141
|
+
return {
|
|
142
|
+
id: options.id ?? `urn:uuid:${crypto.randomUUID()}`,
|
|
143
|
+
issuer: options.issuer,
|
|
144
|
+
subject: options.subject,
|
|
145
|
+
scope: options.scope,
|
|
146
|
+
certificationTier: options.certificationTier,
|
|
147
|
+
domains: options.domains,
|
|
148
|
+
issuedAt: now,
|
|
149
|
+
expiresAt: new Date(now.getTime() + validityMs),
|
|
150
|
+
status: 'active',
|
|
151
|
+
evidence: options.evidence,
|
|
152
|
+
metadata: options.metadata,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Verifies an attestation (basic validation without cryptographic verification).
|
|
157
|
+
*
|
|
158
|
+
* This function performs structural and temporal validation. Cryptographic
|
|
159
|
+
* verification of the proof requires additional libraries and is not
|
|
160
|
+
* performed here.
|
|
161
|
+
*
|
|
162
|
+
* @param attestation - The attestation to verify
|
|
163
|
+
* @param expectedSubject - Optional expected subject DID
|
|
164
|
+
* @param trustedIssuers - Optional list of trusted issuer DIDs
|
|
165
|
+
* @returns Verification result
|
|
166
|
+
*/
|
|
167
|
+
export function verifyAttestation(attestation, expectedSubject, trustedIssuers) {
|
|
168
|
+
const errors = [];
|
|
169
|
+
const warnings = [];
|
|
170
|
+
const now = new Date();
|
|
171
|
+
// Check expiration
|
|
172
|
+
if (attestation.expiresAt < now) {
|
|
173
|
+
errors.push({
|
|
174
|
+
code: 'EXPIRED',
|
|
175
|
+
message: `Attestation expired on ${attestation.expiresAt.toISOString()}`,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
// Check status
|
|
179
|
+
if (attestation.status === 'revoked') {
|
|
180
|
+
errors.push({
|
|
181
|
+
code: 'REVOKED',
|
|
182
|
+
message: 'Attestation has been revoked',
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else if (attestation.status === 'suspended') {
|
|
186
|
+
errors.push({
|
|
187
|
+
code: 'SUSPENDED',
|
|
188
|
+
message: 'Attestation is currently suspended',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
else if (attestation.status === 'pending') {
|
|
192
|
+
warnings.push({
|
|
193
|
+
code: 'PENDING',
|
|
194
|
+
message: 'Attestation is still pending validation',
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
// Check subject match
|
|
198
|
+
if (expectedSubject && attestation.subject !== expectedSubject) {
|
|
199
|
+
errors.push({
|
|
200
|
+
code: 'SUBJECT_MISMATCH',
|
|
201
|
+
message: `Attestation subject ${attestation.subject} does not match expected ${expectedSubject}`,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
// Check trusted issuer
|
|
205
|
+
if (trustedIssuers && !trustedIssuers.includes(attestation.issuer)) {
|
|
206
|
+
errors.push({
|
|
207
|
+
code: 'ISSUER_NOT_TRUSTED',
|
|
208
|
+
message: `Issuer ${attestation.issuer} is not in the trusted issuers list`,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// Check proof presence
|
|
212
|
+
if (!attestation.proof) {
|
|
213
|
+
warnings.push({
|
|
214
|
+
code: 'NO_PROOF',
|
|
215
|
+
message: 'Attestation does not include cryptographic proof',
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
// Check for near expiration
|
|
219
|
+
const daysUntilExpiry = (attestation.expiresAt.getTime() - now.getTime()) / (24 * 60 * 60 * 1000);
|
|
220
|
+
if (daysUntilExpiry > 0 && daysUntilExpiry < 30) {
|
|
221
|
+
warnings.push({
|
|
222
|
+
code: 'EXPIRING_SOON',
|
|
223
|
+
message: `Attestation expires in ${Math.ceil(daysUntilExpiry)} days`,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
valid: errors.length === 0,
|
|
228
|
+
errors,
|
|
229
|
+
warnings,
|
|
230
|
+
attestation: errors.length === 0 ? attestation : undefined,
|
|
231
|
+
verifiedAt: now,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
// ============================================================================
|
|
235
|
+
// Attestation Helpers
|
|
236
|
+
// ============================================================================
|
|
237
|
+
/**
|
|
238
|
+
* Checks if an attestation is currently valid.
|
|
239
|
+
*
|
|
240
|
+
* @param attestation - The attestation to check
|
|
241
|
+
* @returns True if the attestation is valid
|
|
242
|
+
*/
|
|
243
|
+
export function isAttestationValid(attestation) {
|
|
244
|
+
const now = new Date();
|
|
245
|
+
return (attestation.status === 'active' &&
|
|
246
|
+
attestation.issuedAt <= now &&
|
|
247
|
+
attestation.expiresAt > now);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Gets the remaining validity duration of an attestation.
|
|
251
|
+
*
|
|
252
|
+
* @param attestation - The attestation to check
|
|
253
|
+
* @returns Remaining validity in milliseconds (negative if expired)
|
|
254
|
+
*/
|
|
255
|
+
export function getAttestationRemainingValidity(attestation) {
|
|
256
|
+
return attestation.expiresAt.getTime() - Date.now();
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Checks if an attestation covers a specific domain.
|
|
260
|
+
*
|
|
261
|
+
* @param attestation - The attestation to check
|
|
262
|
+
* @param domain - The domain to check for
|
|
263
|
+
* @returns True if the attestation covers the domain
|
|
264
|
+
*/
|
|
265
|
+
export function attestationCoversDomain(attestation, domain) {
|
|
266
|
+
// Full scope covers all domains
|
|
267
|
+
if (attestation.scope === 'full') {
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
// Domain scope must include the specific domain
|
|
271
|
+
if (attestation.scope === 'domain' && attestation.domains) {
|
|
272
|
+
return attestation.domains.includes(domain);
|
|
273
|
+
}
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Type guard to check if a value is a valid AttestationScope.
|
|
278
|
+
*/
|
|
279
|
+
export function isAttestationScope(value) {
|
|
280
|
+
return typeof value === 'string' && ATTESTATION_SCOPES.includes(value);
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Type guard to check if a value is a valid AttestationStatus.
|
|
284
|
+
*/
|
|
285
|
+
export function isAttestationStatus(value) {
|
|
286
|
+
return (typeof value === 'string' &&
|
|
287
|
+
['active', 'expired', 'revoked', 'suspended', 'pending'].includes(value));
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=attestation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../../src/aci/attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAqB,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AA2BjE;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAgC;IAC7D,MAAM;IACN,QAAQ;IACR,OAAO;IACP,UAAU;IACV,UAAU;IACV,YAAY;IACZ,UAAU;CACF,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAC1C,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,EAC7E,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,EAAE,CAC/D,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAA+C;IACxF,IAAI,EAAE,6EAA6E;IACnF,MAAM,EAAE,8CAA8C;IACtD,KAAK,EAAE,2CAA2C;IAClD,QAAQ,EAAE,uDAAuD;IACjE,QAAQ,EAAE,4BAA4B;IACtC,UAAU,EAAE,mCAAmC;IAC/C,QAAQ,EAAE,mCAAmC;CACrC,CAAC;AAgBX;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAC3C,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,E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;AAED;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,WAAwB;IACtE,OAAO,WAAW,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAwB,EACxB,MAAkB;IAElB,gCAAgC;IAChC,IAAI,WAAW,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gDAAgD;IAChD,IAAI,WAAW,CAAC,KAAK,KAAK,QAAQ,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QAC1D,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,kBAAkB,CAAC,QAAQ,CAAC,KAAyB,CAAC,CAAC;AAC7F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ACI Domain Codes and Bitmask Operations
|
|
3
|
+
*
|
|
4
|
+
* Defines the capability domain codes used in ACI strings, with bitmask
|
|
5
|
+
* encoding for efficient queries and domain matching.
|
|
6
|
+
*
|
|
7
|
+
* Domain codes represent high-level capability areas that agents can operate in.
|
|
8
|
+
* Each domain has a single-character code, a human-readable name, a bitmask value,
|
|
9
|
+
* and a description of its scope.
|
|
10
|
+
*
|
|
11
|
+
* @module @vorion/contracts/aci/domains
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
/**
|
|
15
|
+
* Single-character domain codes representing capability areas.
|
|
16
|
+
*
|
|
17
|
+
* Each code maps to a specific area of agent capability:
|
|
18
|
+
* - A: Administration - System administration, user management
|
|
19
|
+
* - B: Business - Business logic, workflows, approvals
|
|
20
|
+
* - C: Communications - Email, messaging, notifications
|
|
21
|
+
* - D: Data - Data processing, analytics, reporting
|
|
22
|
+
* - E: External - Third-party integrations, APIs
|
|
23
|
+
* - F: Finance - Financial operations, payments, accounting
|
|
24
|
+
* - G: Governance - Policy, compliance, oversight
|
|
25
|
+
* - H: Hospitality - Venue, events, catering management
|
|
26
|
+
* - I: Infrastructure - Compute, storage, networking
|
|
27
|
+
* - S: Security - Authentication, authorization, audit
|
|
28
|
+
*/
|
|
29
|
+
export type DomainCode = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'S';
|
|
30
|
+
/**
|
|
31
|
+
* Array of all valid domain codes.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DOMAIN_CODES: readonly DomainCode[];
|
|
34
|
+
/**
|
|
35
|
+
* Zod schema for DomainCode validation.
|
|
36
|
+
*/
|
|
37
|
+
export declare const domainCodeSchema: z.ZodEnum<["A", "B", "C", "D", "E", "F", "G", "H", "I", "S"]>;
|
|
38
|
+
/**
|
|
39
|
+
* Complete definition for a capability domain.
|
|
40
|
+
*/
|
|
41
|
+
export interface DomainDefinition {
|
|
42
|
+
/** Single-character domain code */
|
|
43
|
+
readonly code: DomainCode;
|
|
44
|
+
/** Human-readable domain name */
|
|
45
|
+
readonly name: string;
|
|
46
|
+
/** Bitmask value for efficient queries (power of 2) */
|
|
47
|
+
readonly bit: number;
|
|
48
|
+
/** Description of the domain's scope */
|
|
49
|
+
readonly description: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Capability domains with their definitions.
|
|
53
|
+
*
|
|
54
|
+
* Each domain has a unique bitmask value (power of 2) for efficient
|
|
55
|
+
* storage and querying of domain combinations.
|
|
56
|
+
*/
|
|
57
|
+
export declare const CAPABILITY_DOMAINS: Readonly<Record<DomainCode, DomainDefinition>>;
|
|
58
|
+
/**
|
|
59
|
+
* Human-readable domain names indexed by code.
|
|
60
|
+
*/
|
|
61
|
+
export declare const DOMAIN_NAMES: Readonly<Record<DomainCode, string>>;
|
|
62
|
+
/**
|
|
63
|
+
* Bitmask value representing all domains combined.
|
|
64
|
+
*/
|
|
65
|
+
export declare const ALL_DOMAINS_BITMASK: number;
|
|
66
|
+
/**
|
|
67
|
+
* Encodes an array of domain codes into a bitmask.
|
|
68
|
+
*
|
|
69
|
+
* @param domains - Array of domain codes to encode
|
|
70
|
+
* @returns Bitmask integer representing the domains
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* encodeDomains(['A', 'B']); // 0x003 (3)
|
|
75
|
+
* encodeDomains(['A', 'S']); // 0x201 (513)
|
|
76
|
+
* encodeDomains([]); // 0
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function encodeDomains(domains: readonly DomainCode[]): number;
|
|
80
|
+
/**
|
|
81
|
+
* Decodes a bitmask into an array of domain codes.
|
|
82
|
+
*
|
|
83
|
+
* @param bitmask - Bitmask integer to decode
|
|
84
|
+
* @returns Array of domain codes present in the bitmask
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* decodeDomains(0x003); // ['A', 'B']
|
|
89
|
+
* decodeDomains(0x201); // ['A', 'S']
|
|
90
|
+
* decodeDomains(0); // []
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function decodeDomains(bitmask: number): DomainCode[];
|
|
94
|
+
/**
|
|
95
|
+
* Converts a domain string (e.g., "ABS") to an array of domain codes.
|
|
96
|
+
*
|
|
97
|
+
* @param domainString - String containing domain codes (e.g., "ABS")
|
|
98
|
+
* @returns Array of domain codes
|
|
99
|
+
* @throws Error if any character is not a valid domain code
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* parseDomainString('ABS'); // ['A', 'B', 'S']
|
|
104
|
+
* parseDomainString('D'); // ['D']
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare function parseDomainString(domainString: string): DomainCode[];
|
|
108
|
+
/**
|
|
109
|
+
* Converts an array of domain codes to a domain string.
|
|
110
|
+
*
|
|
111
|
+
* @param domains - Array of domain codes
|
|
112
|
+
* @param sort - Whether to sort the codes alphabetically (default: true)
|
|
113
|
+
* @returns String containing the domain codes
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* formatDomainString(['S', 'A', 'B']); // 'ABS'
|
|
118
|
+
* formatDomainString(['S', 'A'], false); // 'SA'
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function formatDomainString(domains: readonly DomainCode[], sort?: boolean): string;
|
|
122
|
+
/**
|
|
123
|
+
* Checks if a set of domains includes all required domains.
|
|
124
|
+
*
|
|
125
|
+
* @param agentDomains - Domains the agent has (array or bitmask)
|
|
126
|
+
* @param requiredDomains - Domains required (array or bitmask)
|
|
127
|
+
* @returns True if agent has all required domains
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* hasDomains(['A', 'B', 'C'], ['A', 'B']); // true
|
|
132
|
+
* hasDomains(['A', 'B'], ['A', 'B', 'C']); // false
|
|
133
|
+
* hasDomains(0x007, 0x003); // true (ABC has AB)
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export declare function hasDomains(agentDomains: readonly DomainCode[] | number, requiredDomains: readonly DomainCode[] | number): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Checks if a set of domains satisfies domain requirements.
|
|
139
|
+
*
|
|
140
|
+
* This is an alias for hasDomains with more semantic naming for
|
|
141
|
+
* authorization contexts.
|
|
142
|
+
*
|
|
143
|
+
* @param agentDomains - Domains the agent has
|
|
144
|
+
* @param requirements - Domain requirements to satisfy
|
|
145
|
+
* @returns True if all requirements are satisfied
|
|
146
|
+
*/
|
|
147
|
+
export declare function satisfiesDomainRequirements(agentDomains: readonly DomainCode[] | number, requirements: readonly DomainCode[] | number): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Gets the intersection of two domain sets.
|
|
150
|
+
*
|
|
151
|
+
* @param domainsA - First domain set
|
|
152
|
+
* @param domainsB - Second domain set
|
|
153
|
+
* @returns Array of domains present in both sets
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* intersectDomains(['A', 'B', 'C'], ['B', 'C', 'D']); // ['B', 'C']
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare function intersectDomains(domainsA: readonly DomainCode[] | number, domainsB: readonly DomainCode[] | number): DomainCode[];
|
|
161
|
+
/**
|
|
162
|
+
* Gets the union of two domain sets.
|
|
163
|
+
*
|
|
164
|
+
* @param domainsA - First domain set
|
|
165
|
+
* @param domainsB - Second domain set
|
|
166
|
+
* @returns Array of domains present in either set
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* unionDomains(['A', 'B'], ['B', 'C']); // ['A', 'B', 'C']
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export declare function unionDomains(domainsA: readonly DomainCode[] | number, domainsB: readonly DomainCode[] | number): DomainCode[];
|
|
174
|
+
/**
|
|
175
|
+
* Gets domains in the first set that are not in the second.
|
|
176
|
+
*
|
|
177
|
+
* @param domainsA - First domain set
|
|
178
|
+
* @param domainsB - Second domain set
|
|
179
|
+
* @returns Array of domains in A but not in B
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* differenceDomains(['A', 'B', 'C'], ['B', 'C']); // ['A']
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export declare function differenceDomains(domainsA: readonly DomainCode[] | number, domainsB: readonly DomainCode[] | number): DomainCode[];
|
|
187
|
+
/**
|
|
188
|
+
* Gets the full definition for a domain code.
|
|
189
|
+
*
|
|
190
|
+
* @param code - Domain code
|
|
191
|
+
* @returns Domain definition
|
|
192
|
+
*/
|
|
193
|
+
export declare function getDomainDefinition(code: DomainCode): DomainDefinition;
|
|
194
|
+
/**
|
|
195
|
+
* Gets the human-readable name for a domain code.
|
|
196
|
+
*
|
|
197
|
+
* @param code - Domain code
|
|
198
|
+
* @returns Domain name
|
|
199
|
+
*/
|
|
200
|
+
export declare function getDomainName(code: DomainCode): string;
|
|
201
|
+
/**
|
|
202
|
+
* Gets the bitmask value for a domain code.
|
|
203
|
+
*
|
|
204
|
+
* @param code - Domain code
|
|
205
|
+
* @returns Bitmask value
|
|
206
|
+
*/
|
|
207
|
+
export declare function getDomainBit(code: DomainCode): number;
|
|
208
|
+
/**
|
|
209
|
+
* Counts the number of domains in a bitmask.
|
|
210
|
+
*
|
|
211
|
+
* @param bitmask - Domain bitmask
|
|
212
|
+
* @returns Number of domains
|
|
213
|
+
*/
|
|
214
|
+
export declare function countDomains(bitmask: number): number;
|
|
215
|
+
/**
|
|
216
|
+
* Type guard to check if a value is a valid DomainCode.
|
|
217
|
+
*
|
|
218
|
+
* @param value - Value to check
|
|
219
|
+
* @returns True if value is a valid DomainCode
|
|
220
|
+
*/
|
|
221
|
+
export declare function isDomainCode(value: unknown): value is DomainCode;
|
|
222
|
+
/**
|
|
223
|
+
* Type guard to check if all values in an array are valid DomainCodes.
|
|
224
|
+
*
|
|
225
|
+
* @param values - Array to check
|
|
226
|
+
* @returns True if all values are valid DomainCodes
|
|
227
|
+
*/
|
|
228
|
+
export declare function isDomainCodeArray(values: unknown): values is DomainCode[];
|
|
229
|
+
/**
|
|
230
|
+
* Zod schema for domain definition.
|
|
231
|
+
*/
|
|
232
|
+
export declare const domainDefinitionSchema: z.ZodObject<{
|
|
233
|
+
code: z.ZodEnum<["A", "B", "C", "D", "E", "F", "G", "H", "I", "S"]>;
|
|
234
|
+
name: z.ZodString;
|
|
235
|
+
bit: z.ZodNumber;
|
|
236
|
+
description: z.ZodString;
|
|
237
|
+
}, "strip", z.ZodTypeAny, {
|
|
238
|
+
name: string;
|
|
239
|
+
code: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "S";
|
|
240
|
+
description: string;
|
|
241
|
+
bit: number;
|
|
242
|
+
}, {
|
|
243
|
+
name: string;
|
|
244
|
+
code: "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "S";
|
|
245
|
+
description: string;
|
|
246
|
+
bit: number;
|
|
247
|
+
}>;
|
|
248
|
+
/**
|
|
249
|
+
* Zod schema for an array of domain codes.
|
|
250
|
+
*/
|
|
251
|
+
export declare const domainCodeArraySchema: z.ZodArray<z.ZodEnum<["A", "B", "C", "D", "E", "F", "G", "H", "I", "S"]>, "many">;
|
|
252
|
+
/**
|
|
253
|
+
* Zod schema for a domain bitmask (positive integer).
|
|
254
|
+
*/
|
|
255
|
+
export declare const domainBitmaskSchema: z.ZodNumber;
|
|
256
|
+
/**
|
|
257
|
+
* Zod schema for domain string (e.g., "ABS").
|
|
258
|
+
*/
|
|
259
|
+
export declare const domainStringSchema: z.ZodEffects<z.ZodString, DomainCode[], string>;
|
|
260
|
+
//# sourceMappingURL=domains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../src/aci/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GA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