@kya-os/verifier 1.5.6 → 1.5.8

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/core.d.ts ADDED
@@ -0,0 +1,131 @@
1
+ import type { DetachedProof } from "@kya-os/contracts/proof";
2
+ import type { VerifierResult } from "@kya-os/contracts/verifier";
3
+ /**
4
+ * Configuration for the verifier core
5
+ */
6
+ export interface VerifierConfig {
7
+ /**
8
+ * KTA base URL for delegation checking
9
+ */
10
+ ktaBaseUrl?: string;
11
+ /**
12
+ * Enable delegation checking via KTA
13
+ */
14
+ enableDelegationCheck?: boolean;
15
+ /**
16
+ * Clock skew tolerance in seconds
17
+ */
18
+ clockSkewTolerance?: number;
19
+ /**
20
+ * Session timeout in seconds
21
+ */
22
+ sessionTimeout?: number;
23
+ /**
24
+ * Maximum age for proofs in seconds (prevents replay of old proofs)
25
+ */
26
+ proofMaxAge?: number;
27
+ /**
28
+ * Allow mock data for testing
29
+ */
30
+ allowMockData?: boolean;
31
+ /**
32
+ * Cache TTL for DID documents in seconds
33
+ */
34
+ didCacheTtl?: number;
35
+ /**
36
+ * Cache TTL for delegation status in seconds
37
+ */
38
+ delegationCacheTtl?: number;
39
+ }
40
+ /**
41
+ * Context for proof verification
42
+ */
43
+ export interface VerificationContext {
44
+ proof: DetachedProof;
45
+ audience: string;
46
+ timestamp?: number;
47
+ }
48
+ /**
49
+ * Isomorphic verifier core for XMCP-I proof validation
50
+ *
51
+ * This is the heart of the trust system - it verifies that AI agents
52
+ * are who they claim to be and have the authority to perform actions.
53
+ */
54
+ export declare class VerifierCore {
55
+ private config;
56
+ private didCache;
57
+ private delegationCache;
58
+ constructor(config?: VerifierConfig);
59
+ /**
60
+ * Verify a detached proof and return verification result
61
+ *
62
+ * This is the main entry point for proof verification. It performs
63
+ * a comprehensive validation of the agent's identity and authorization.
64
+ */
65
+ verify(context: VerificationContext): Promise<VerifierResult>;
66
+ /**
67
+ * Validate proof structure with comprehensive checks
68
+ */
69
+ private validateProofStructure;
70
+ /**
71
+ * Validate timestamp with configurable clock skew tolerance
72
+ */
73
+ private validateTimestamp;
74
+ /**
75
+ * Validate audience matches expected value
76
+ */
77
+ private validateAudience;
78
+ /**
79
+ * Verify Ed25519 signature using JOSE with proper detached JWS handling
80
+ *
81
+ * This is the cryptographic heart of the verification process.
82
+ * It ensures the proof was signed by the claimed identity.
83
+ */
84
+ private verifySignature;
85
+ /**
86
+ * Create canonical payload that matches runtime implementation
87
+ * Uses JSON Canonicalization Scheme (JCS) RFC 8785 for deterministic ordering
88
+ */
89
+ private createCanonicalPayload;
90
+ /**
91
+ * Verify delegation status via KTA with caching
92
+ */
93
+ private verifyDelegation;
94
+ /**
95
+ * Validate delegation response
96
+ */
97
+ private validateDelegationResponse;
98
+ /**
99
+ * Fetch public key from DID document with caching
100
+ */
101
+ private fetchPublicKeyWithCache;
102
+ /**
103
+ * Fetch DID document from well-known endpoint
104
+ */
105
+ private fetchDIDDocument;
106
+ /**
107
+ * Extract public key from DID document
108
+ */
109
+ private extractPublicKey;
110
+ /**
111
+ * Generate trusted headers for successful verification
112
+ */
113
+ private generateHeaders;
114
+ /**
115
+ * Generate agent context for MCP recipients
116
+ */
117
+ private generateAgentContext;
118
+ /**
119
+ * Create error result from structured error
120
+ */
121
+ private createErrorResult;
122
+ /**
123
+ * Log verification attempt for security monitoring
124
+ */
125
+ private logVerificationAttempt;
126
+ /**
127
+ * Clean up expired cache entries
128
+ */
129
+ cleanupCache(): void;
130
+ }
131
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,4BAA4B,CAAC;AAGpC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,CAAC,EA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