@kya-os/contracts 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agentshield-api/endpoints.d.ts +21 -0
- package/dist/agentshield-api/endpoints.js +20 -0
- package/dist/agentshield-api/index.d.ts +5 -0
- package/dist/agentshield-api/index.js +27 -0
- package/dist/agentshield-api/schemas.d.ts +9846 -0
- package/dist/agentshield-api/schemas.js +92 -0
- package/dist/agentshield-api/types.d.ts +92 -0
- package/dist/agentshield-api/types.js +12 -0
- package/dist/cli.d.ts +3 -6
- package/dist/cli.js +3 -10
- package/dist/config/base.d.ts +19 -0
- package/dist/config/base.js +2 -0
- package/dist/config/delegation.d.ts +46 -0
- package/dist/config/delegation.js +2 -0
- package/dist/config/identity.d.ts +22 -0
- package/dist/config/identity.js +2 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +2 -0
- package/dist/config/proofing.d.ts +26 -0
- package/dist/config/proofing.js +2 -0
- package/dist/config/tool-protection.d.ts +36 -0
- package/dist/config/tool-protection.js +2 -0
- package/dist/delegation/constraints.d.ts +0 -266
- package/dist/delegation/constraints.js +3 -110
- package/dist/delegation/index.d.ts +0 -6
- package/dist/delegation/index.js +0 -6
- package/dist/delegation/schemas.d.ts +174 -514
- package/dist/delegation/schemas.js +3 -247
- package/dist/did/index.d.ts +0 -6
- package/dist/did/index.js +0 -6
- package/dist/did/resolve-contract.d.ts +0 -167
- package/dist/did/resolve-contract.js +0 -20
- package/dist/did/schemas.d.ts +0 -80
- package/dist/did/schemas.js +4 -97
- package/dist/did/types.d.ts +0 -126
- package/dist/did/types.js +0 -34
- package/dist/env/constants.d.ts +0 -45
- package/dist/env/constants.js +0 -45
- package/dist/env/index.d.ts +0 -4
- package/dist/env/index.js +0 -4
- package/dist/handshake.d.ts +0 -21
- package/dist/handshake.js +3 -11
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -25
- package/dist/proof/index.d.ts +0 -7
- package/dist/proof/index.js +0 -7
- package/dist/proof/proof-record.d.ts +62 -172
- package/dist/proof/proof-record.js +0 -74
- package/dist/proof/signing-spec.d.ts +12 -86
- package/dist/proof/signing-spec.js +0 -71
- package/dist/proof.d.ts +16 -38
- package/dist/proof.js +3 -26
- package/dist/registry.d.ts +10 -27
- package/dist/registry.js +9 -30
- package/dist/runtime/errors.d.ts +0 -169
- package/dist/runtime/errors.js +0 -69
- package/dist/runtime/headers.d.ts +0 -50
- package/dist/runtime/headers.js +0 -30
- package/dist/runtime/index.d.ts +0 -4
- package/dist/runtime/index.js +0 -4
- package/dist/test.d.ts +0 -37
- package/dist/test.js +0 -37
- package/dist/tlkrc/index.d.ts +0 -4
- package/dist/tlkrc/index.js +0 -4
- package/dist/tlkrc/rotation.d.ts +12 -90
- package/dist/tlkrc/rotation.js +0 -72
- package/dist/tool-protection/index.d.ts +129 -0
- package/dist/tool-protection/index.js +80 -0
- package/dist/utils/validation.d.ts +0 -17
- package/dist/utils/validation.js +0 -14
- package/dist/vc/index.d.ts +0 -6
- package/dist/vc/index.js +0 -6
- package/dist/vc/schemas.d.ts +0 -596
- package/dist/vc/schemas.js +2 -111
- package/dist/vc/statuslist.d.ts +0 -202
- package/dist/vc/statuslist.js +1 -73
- package/dist/verifier.d.ts +9 -13
- package/dist/verifier.js +0 -8
- package/dist/well-known/index.d.ts +248 -0
- package/dist/well-known/index.js +104 -0
- package/package.json +27 -5
package/dist/runtime/errors.js
CHANGED
|
@@ -1,113 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Runtime Error Contracts
|
|
4
|
-
*
|
|
5
|
-
* Error types and schemas for runtime errors, especially authorization errors
|
|
6
|
-
*
|
|
7
|
-
* Related Spec: MCP-I §6
|
|
8
|
-
* Python Reference: Core-Documentation.md
|
|
9
|
-
*/
|
|
10
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
3
|
exports.ERROR_CODES = exports.RuntimeErrorSchema = exports.NeedsAuthorizationErrorSchema = exports.AuthorizationDisplaySchema = exports.DisplayHintSchema = void 0;
|
|
12
4
|
exports.validateNeedsAuthorizationError = validateNeedsAuthorizationError;
|
|
13
5
|
exports.isNeedsAuthorizationError = isNeedsAuthorizationError;
|
|
14
6
|
exports.createNeedsAuthorizationError = createNeedsAuthorizationError;
|
|
15
7
|
const zod_1 = require("zod");
|
|
16
|
-
/**
|
|
17
|
-
* Display hint types for authorization UI
|
|
18
|
-
*/
|
|
19
8
|
exports.DisplayHintSchema = zod_1.z.enum(['link', 'qr', 'code']);
|
|
20
|
-
/**
|
|
21
|
-
* Display options for authorization flow
|
|
22
|
-
*/
|
|
23
9
|
exports.AuthorizationDisplaySchema = zod_1.z.object({
|
|
24
|
-
/** Optional title for the authorization screen */
|
|
25
10
|
title: zod_1.z.string().optional(),
|
|
26
|
-
/** Hints for how to display authorization (link, QR code, or code) */
|
|
27
11
|
hint: zod_1.z.array(exports.DisplayHintSchema).optional(),
|
|
28
|
-
/** Optional short authorization code */
|
|
29
12
|
authorizationCode: zod_1.z.string().optional(),
|
|
30
|
-
/** Optional QR code URL */
|
|
31
13
|
qrUrl: zod_1.z.string().url().optional(),
|
|
32
14
|
}).passthrough();
|
|
33
|
-
/**
|
|
34
|
-
* NeedsAuthorizationError Schema
|
|
35
|
-
*
|
|
36
|
-
* Error returned when a request requires authorization.
|
|
37
|
-
* Includes a resumeToken and authorizationUrl for the authorization flow.
|
|
38
|
-
*/
|
|
39
15
|
exports.NeedsAuthorizationErrorSchema = zod_1.z.object({
|
|
40
|
-
/** Error code */
|
|
41
16
|
error: zod_1.z.literal('needs_authorization'),
|
|
42
|
-
/** Human-readable error message */
|
|
43
17
|
message: zod_1.z.string().min(1),
|
|
44
|
-
/** URL for the user to authorize (includes resume token) */
|
|
45
18
|
authorizationUrl: zod_1.z.string().url(),
|
|
46
|
-
/** Short-lived resume token for continuing after authorization */
|
|
47
19
|
resumeToken: zod_1.z.string().min(1),
|
|
48
|
-
/** Expiration timestamp for the resume token (milliseconds since epoch) */
|
|
49
20
|
expiresAt: zod_1.z.number().int().positive(),
|
|
50
|
-
/** Required scopes for authorization */
|
|
51
21
|
scopes: zod_1.z.array(zod_1.z.string()),
|
|
52
|
-
/** Optional display configuration for authorization UI */
|
|
53
22
|
display: exports.AuthorizationDisplaySchema.optional(),
|
|
54
|
-
/** Optional additional context */
|
|
55
23
|
context: zod_1.z.record(zod_1.z.any()).optional(),
|
|
56
24
|
}).passthrough();
|
|
57
|
-
/**
|
|
58
|
-
* Generic Error Schema
|
|
59
|
-
*
|
|
60
|
-
* Standard error format for all runtime errors
|
|
61
|
-
*/
|
|
62
25
|
exports.RuntimeErrorSchema = zod_1.z.object({
|
|
63
|
-
/** Error code */
|
|
64
26
|
error: zod_1.z.string().min(1),
|
|
65
|
-
/** Human-readable error message */
|
|
66
27
|
message: zod_1.z.string().min(1),
|
|
67
|
-
/** Optional error details */
|
|
68
28
|
details: zod_1.z.record(zod_1.z.any()).optional(),
|
|
69
|
-
/** HTTP status code (if applicable) */
|
|
70
29
|
httpStatus: zod_1.z.number().int().min(400).max(599).optional(),
|
|
71
30
|
});
|
|
72
|
-
/**
|
|
73
|
-
* Validation Helpers
|
|
74
|
-
*/
|
|
75
|
-
/**
|
|
76
|
-
* Validate a needs authorization error
|
|
77
|
-
*
|
|
78
|
-
* @param error - The error to validate
|
|
79
|
-
* @returns Validation result
|
|
80
|
-
*/
|
|
81
31
|
function validateNeedsAuthorizationError(error) {
|
|
82
32
|
return exports.NeedsAuthorizationErrorSchema.safeParse(error);
|
|
83
33
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Check if error is a needs authorization error
|
|
86
|
-
*
|
|
87
|
-
* @param error - The error to check
|
|
88
|
-
* @returns true if it's a needs authorization error
|
|
89
|
-
*/
|
|
90
34
|
function isNeedsAuthorizationError(error) {
|
|
91
35
|
return error && error.error === 'needs_authorization';
|
|
92
36
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Create a needs authorization error
|
|
95
|
-
*
|
|
96
|
-
* @param config - Configuration for the error
|
|
97
|
-
* @returns NeedsAuthorizationError instance
|
|
98
|
-
*/
|
|
99
37
|
function createNeedsAuthorizationError(config) {
|
|
100
38
|
return {
|
|
101
39
|
error: 'needs_authorization',
|
|
102
40
|
...config,
|
|
103
41
|
};
|
|
104
42
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Constants
|
|
107
|
-
*/
|
|
108
|
-
/**
|
|
109
|
-
* Error codes
|
|
110
|
-
*/
|
|
111
43
|
exports.ERROR_CODES = Object.freeze({
|
|
112
44
|
NEEDS_AUTHORIZATION: 'needs_authorization',
|
|
113
45
|
INVALID_TOKEN: 'invalid_token',
|
|
@@ -117,4 +49,3 @@ exports.ERROR_CODES = Object.freeze({
|
|
|
117
49
|
DELEGATION_REVOKED: 'delegation_revoked',
|
|
118
50
|
CREDENTIAL_REVOKED: 'credential_revoked',
|
|
119
51
|
});
|
|
120
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1,35 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime Header Contracts
|
|
3
|
-
*
|
|
4
|
-
* Header contracts for downstream services
|
|
5
|
-
*
|
|
6
|
-
* Related Spec: MCP-I §6
|
|
7
|
-
* Python Reference: Core-Documentation.md
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Downstream Headers Interface
|
|
11
|
-
*
|
|
12
|
-
* Headers passed to downstream services after verification
|
|
13
|
-
*/
|
|
14
1
|
export interface DownstreamHeaders {
|
|
15
|
-
/** DID of the verified agent */
|
|
16
2
|
'X-Agent-DID': string;
|
|
17
|
-
/** Optional delegation ID */
|
|
18
3
|
'X-Delegation-Id'?: string;
|
|
19
|
-
/** Optional delegation chain (format: vc_id>del_id>...) */
|
|
20
4
|
'X-Delegation-Chain'?: string;
|
|
21
|
-
/** Proof ID for audit trail */
|
|
22
5
|
'X-MCPI-Proof-Id': string;
|
|
23
|
-
/** Optional CRISP spend info (JSON string: {unit, delta, remaining}) */
|
|
24
6
|
'X-CRISP-Spend'?: string;
|
|
25
|
-
/** Optional session ID */
|
|
26
7
|
'X-Session-Id'?: string;
|
|
27
|
-
/** Optional scopes */
|
|
28
8
|
'X-Scopes'?: string;
|
|
29
9
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Header names as constants for type safety
|
|
32
|
-
*/
|
|
33
10
|
export declare const DOWNSTREAM_HEADER_NAMES: Readonly<{
|
|
34
11
|
readonly AGENT_DID: "X-Agent-DID";
|
|
35
12
|
readonly DELEGATION_ID: "X-Delegation-Id";
|
|
@@ -39,39 +16,13 @@ export declare const DOWNSTREAM_HEADER_NAMES: Readonly<{
|
|
|
39
16
|
readonly SESSION_ID: "X-Session-Id";
|
|
40
17
|
readonly SCOPES: "X-Scopes";
|
|
41
18
|
}>;
|
|
42
|
-
/**
|
|
43
|
-
* CRISP Spend Info
|
|
44
|
-
*
|
|
45
|
-
* Structure for X-CRISP-Spend header value
|
|
46
|
-
*/
|
|
47
19
|
export interface CrispSpendInfo {
|
|
48
|
-
/** Unit of spending */
|
|
49
20
|
unit: 'USD' | 'ops' | 'points';
|
|
50
|
-
/** Amount spent in this request */
|
|
51
21
|
delta?: number;
|
|
52
|
-
/** Remaining budget */
|
|
53
22
|
remaining?: number;
|
|
54
23
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Helper to serialize CRISP spend info to header value
|
|
57
|
-
*
|
|
58
|
-
* @param info - CRISP spend info
|
|
59
|
-
* @returns JSON string for header
|
|
60
|
-
*/
|
|
61
24
|
export declare function serializeCrispSpend(info: CrispSpendInfo): string;
|
|
62
|
-
/**
|
|
63
|
-
* Helper to parse CRISP spend info from header value
|
|
64
|
-
*
|
|
65
|
-
* @param headerValue - JSON string from header
|
|
66
|
-
* @returns Parsed CRISP spend info or null if invalid
|
|
67
|
-
*/
|
|
68
25
|
export declare function parseCrispSpend(headerValue: string): CrispSpendInfo | null;
|
|
69
|
-
/**
|
|
70
|
-
* Helper to create downstream headers
|
|
71
|
-
*
|
|
72
|
-
* @param config - Configuration for headers
|
|
73
|
-
* @returns DownstreamHeaders object
|
|
74
|
-
*/
|
|
75
26
|
export declare function createDownstreamHeaders(config: {
|
|
76
27
|
agentDid: string;
|
|
77
28
|
proofId: string;
|
|
@@ -81,4 +32,3 @@ export declare function createDownstreamHeaders(config: {
|
|
|
81
32
|
sessionId?: string;
|
|
82
33
|
scopes?: string[];
|
|
83
34
|
}): DownstreamHeaders;
|
|
84
|
-
//# sourceMappingURL=headers.d.ts.map
|
package/dist/runtime/headers.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Runtime Header Contracts
|
|
4
|
-
*
|
|
5
|
-
* Header contracts for downstream services
|
|
6
|
-
*
|
|
7
|
-
* Related Spec: MCP-I §6
|
|
8
|
-
* Python Reference: Core-Documentation.md
|
|
9
|
-
*/
|
|
10
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
3
|
exports.DOWNSTREAM_HEADER_NAMES = void 0;
|
|
12
4
|
exports.serializeCrispSpend = serializeCrispSpend;
|
|
13
5
|
exports.parseCrispSpend = parseCrispSpend;
|
|
14
6
|
exports.createDownstreamHeaders = createDownstreamHeaders;
|
|
15
|
-
/**
|
|
16
|
-
* Header names as constants for type safety
|
|
17
|
-
*/
|
|
18
7
|
exports.DOWNSTREAM_HEADER_NAMES = Object.freeze({
|
|
19
8
|
AGENT_DID: 'X-Agent-DID',
|
|
20
9
|
DELEGATION_ID: 'X-Delegation-Id',
|
|
@@ -24,21 +13,9 @@ exports.DOWNSTREAM_HEADER_NAMES = Object.freeze({
|
|
|
24
13
|
SESSION_ID: 'X-Session-Id',
|
|
25
14
|
SCOPES: 'X-Scopes',
|
|
26
15
|
});
|
|
27
|
-
/**
|
|
28
|
-
* Helper to serialize CRISP spend info to header value
|
|
29
|
-
*
|
|
30
|
-
* @param info - CRISP spend info
|
|
31
|
-
* @returns JSON string for header
|
|
32
|
-
*/
|
|
33
16
|
function serializeCrispSpend(info) {
|
|
34
17
|
return JSON.stringify(info);
|
|
35
18
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Helper to parse CRISP spend info from header value
|
|
38
|
-
*
|
|
39
|
-
* @param headerValue - JSON string from header
|
|
40
|
-
* @returns Parsed CRISP spend info or null if invalid
|
|
41
|
-
*/
|
|
42
19
|
function parseCrispSpend(headerValue) {
|
|
43
20
|
try {
|
|
44
21
|
const parsed = JSON.parse(headerValue);
|
|
@@ -51,12 +28,6 @@ function parseCrispSpend(headerValue) {
|
|
|
51
28
|
return null;
|
|
52
29
|
}
|
|
53
30
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Helper to create downstream headers
|
|
56
|
-
*
|
|
57
|
-
* @param config - Configuration for headers
|
|
58
|
-
* @returns DownstreamHeaders object
|
|
59
|
-
*/
|
|
60
31
|
function createDownstreamHeaders(config) {
|
|
61
32
|
const headers = {
|
|
62
33
|
'X-Agent-DID': config.agentDid,
|
|
@@ -79,4 +50,3 @@ function createDownstreamHeaders(config) {
|
|
|
79
50
|
}
|
|
80
51
|
return headers;
|
|
81
52
|
}
|
|
82
|
-
//# sourceMappingURL=headers.js.map
|
package/dist/runtime/index.d.ts
CHANGED
package/dist/runtime/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Runtime Module Exports
|
|
4
|
-
*/
|
|
5
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
3
|
if (k2 === undefined) k2 = k;
|
|
7
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -19,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
17
|
__exportStar(require("./errors.js"), exports);
|
|
21
18
|
__exportStar(require("./headers.js"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
package/dist/test.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test infrastructure types and schemas for XMCP-I
|
|
3
|
-
*
|
|
4
|
-
* This module provides types and utilities for testing XMCP-I applications
|
|
5
|
-
* without hitting external services like KTA.
|
|
6
|
-
*/
|
|
7
1
|
import { z } from "zod";
|
|
8
|
-
/**
|
|
9
|
-
* Test environment configuration
|
|
10
|
-
*/
|
|
11
2
|
export declare const TestEnvironmentSchema: z.ZodObject<{
|
|
12
3
|
mode: z.ZodLiteral<"test">;
|
|
13
4
|
seed: z.ZodOptional<z.ZodString>;
|
|
@@ -25,9 +16,6 @@ export declare const TestEnvironmentSchema: z.ZodObject<{
|
|
|
25
16
|
skipKTACalls?: boolean | undefined;
|
|
26
17
|
}>;
|
|
27
18
|
export type TestEnvironment = z.infer<typeof TestEnvironmentSchema>;
|
|
28
|
-
/**
|
|
29
|
-
* Mock identity configuration for testing
|
|
30
|
-
*/
|
|
31
19
|
export declare const MockIdentitySchema: z.ZodObject<{
|
|
32
20
|
did: z.ZodString;
|
|
33
21
|
kid: z.ZodString;
|
|
@@ -51,19 +39,10 @@ export declare const MockIdentitySchema: z.ZodObject<{
|
|
|
51
39
|
lastRotated?: string | undefined;
|
|
52
40
|
}>;
|
|
53
41
|
export type MockIdentity = z.infer<typeof MockIdentitySchema>;
|
|
54
|
-
/**
|
|
55
|
-
* Mock delegation status for testing
|
|
56
|
-
*/
|
|
57
42
|
export declare const MockDelegationStatusSchema: z.ZodEnum<["active", "revoked", "pending"]>;
|
|
58
43
|
export type MockDelegationStatus = z.infer<typeof MockDelegationStatusSchema>;
|
|
59
|
-
/**
|
|
60
|
-
* Mock KTA failure scenarios for testing
|
|
61
|
-
*/
|
|
62
44
|
export declare const MockKTAFailureTypeSchema: z.ZodEnum<["network", "auth", "invalid", "timeout"]>;
|
|
63
45
|
export type MockKTAFailureType = z.infer<typeof MockKTAFailureTypeSchema>;
|
|
64
|
-
/**
|
|
65
|
-
* Mock identity provider configuration
|
|
66
|
-
*/
|
|
67
46
|
export declare const MockIdentityProviderConfigSchema: z.ZodObject<{
|
|
68
47
|
identities: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
69
48
|
did: z.ZodString;
|
|
@@ -116,9 +95,6 @@ export declare const MockIdentityProviderConfigSchema: z.ZodObject<{
|
|
|
116
95
|
deterministicSeed?: string | undefined;
|
|
117
96
|
}>;
|
|
118
97
|
export type MockIdentityProviderConfig = z.infer<typeof MockIdentityProviderConfigSchema>;
|
|
119
|
-
/**
|
|
120
|
-
* Local verification result for offline testing
|
|
121
|
-
*/
|
|
122
98
|
export declare const LocalVerificationResultSchema: z.ZodObject<{
|
|
123
99
|
valid: z.ZodBoolean;
|
|
124
100
|
did: z.ZodOptional<z.ZodString>;
|
|
@@ -218,9 +194,6 @@ export declare const LocalVerificationResultSchema: z.ZodObject<{
|
|
|
218
194
|
errors?: string[] | undefined;
|
|
219
195
|
}>;
|
|
220
196
|
export type LocalVerificationResult = z.infer<typeof LocalVerificationResultSchema>;
|
|
221
|
-
/**
|
|
222
|
-
* Test DID and Key ID constants
|
|
223
|
-
*/
|
|
224
197
|
export declare const TEST_DIDS: {
|
|
225
198
|
readonly AGENT_1: "did:test:agent-1";
|
|
226
199
|
readonly AGENT_2: "did:test:agent-2";
|
|
@@ -231,17 +204,8 @@ export declare const TEST_KEY_IDS: {
|
|
|
231
204
|
readonly KEY_TEST_2: "key-test-2";
|
|
232
205
|
readonly KEY_VERIFIER_1: "key-verifier-1";
|
|
233
206
|
};
|
|
234
|
-
/**
|
|
235
|
-
* Test environment detection
|
|
236
|
-
*/
|
|
237
207
|
export declare function isTestEnvironment(): boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Get test seed from environment or test name
|
|
240
|
-
*/
|
|
241
208
|
export declare function getTestSeed(testName?: string): string;
|
|
242
|
-
/**
|
|
243
|
-
* Error codes for test infrastructure
|
|
244
|
-
*/
|
|
245
209
|
export declare const TEST_ERROR_CODES: {
|
|
246
210
|
readonly MOCK_KTA_FAILURE: "XMCP_I_TEST_MOCK_KTA_FAILURE";
|
|
247
211
|
readonly DETERMINISTIC_KEY_GENERATION_FAILED: "XMCP_I_TEST_DETERMINISTIC_KEY_FAILED";
|
|
@@ -249,4 +213,3 @@ export declare const TEST_ERROR_CODES: {
|
|
|
249
213
|
readonly INVALID_TEST_CONFIGURATION: "XMCP_I_TEST_INVALID_CONFIG";
|
|
250
214
|
};
|
|
251
215
|
export type TestErrorCode = (typeof TEST_ERROR_CODES)[keyof typeof TEST_ERROR_CODES];
|
|
252
|
-
//# sourceMappingURL=test.d.ts.map
|
package/dist/test.js
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Test infrastructure types and schemas for XMCP-I
|
|
4
|
-
*
|
|
5
|
-
* This module provides types and utilities for testing XMCP-I applications
|
|
6
|
-
* without hitting external services like KTA.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.TEST_ERROR_CODES = exports.TEST_KEY_IDS = exports.TEST_DIDS = exports.LocalVerificationResultSchema = exports.MockIdentityProviderConfigSchema = exports.MockKTAFailureTypeSchema = exports.MockDelegationStatusSchema = exports.MockIdentitySchema = exports.TestEnvironmentSchema = void 0;
|
|
10
4
|
exports.isTestEnvironment = isTestEnvironment;
|
|
11
5
|
exports.getTestSeed = getTestSeed;
|
|
12
6
|
const zod_1 = require("zod");
|
|
13
|
-
/**
|
|
14
|
-
* Test environment configuration
|
|
15
|
-
*/
|
|
16
7
|
exports.TestEnvironmentSchema = zod_1.z.object({
|
|
17
8
|
mode: zod_1.z.literal("test"),
|
|
18
9
|
seed: zod_1.z.string().optional(),
|
|
19
10
|
deterministicKeys: zod_1.z.boolean().default(true),
|
|
20
11
|
skipKTACalls: zod_1.z.boolean().default(true),
|
|
21
12
|
});
|
|
22
|
-
/**
|
|
23
|
-
* Mock identity configuration for testing
|
|
24
|
-
*/
|
|
25
13
|
exports.MockIdentitySchema = zod_1.z.object({
|
|
26
14
|
did: zod_1.z.string(),
|
|
27
15
|
kid: zod_1.z.string(),
|
|
@@ -30,35 +18,23 @@ exports.MockIdentitySchema = zod_1.z.object({
|
|
|
30
18
|
createdAt: zod_1.z.string(),
|
|
31
19
|
lastRotated: zod_1.z.string().optional(),
|
|
32
20
|
});
|
|
33
|
-
/**
|
|
34
|
-
* Mock delegation status for testing
|
|
35
|
-
*/
|
|
36
21
|
exports.MockDelegationStatusSchema = zod_1.z.enum([
|
|
37
22
|
"active",
|
|
38
23
|
"revoked",
|
|
39
24
|
"pending",
|
|
40
25
|
]);
|
|
41
|
-
/**
|
|
42
|
-
* Mock KTA failure scenarios for testing
|
|
43
|
-
*/
|
|
44
26
|
exports.MockKTAFailureTypeSchema = zod_1.z.enum([
|
|
45
27
|
"network",
|
|
46
28
|
"auth",
|
|
47
29
|
"invalid",
|
|
48
30
|
"timeout",
|
|
49
31
|
]);
|
|
50
|
-
/**
|
|
51
|
-
* Mock identity provider configuration
|
|
52
|
-
*/
|
|
53
32
|
exports.MockIdentityProviderConfigSchema = zod_1.z.object({
|
|
54
33
|
identities: zod_1.z.record(zod_1.z.string(), exports.MockIdentitySchema),
|
|
55
34
|
delegations: zod_1.z.record(zod_1.z.string(), exports.MockDelegationStatusSchema),
|
|
56
35
|
ktaFailures: zod_1.z.array(exports.MockKTAFailureTypeSchema).default([]),
|
|
57
36
|
deterministicSeed: zod_1.z.string().optional(),
|
|
58
37
|
});
|
|
59
|
-
/**
|
|
60
|
-
* Local verification result for offline testing
|
|
61
|
-
*/
|
|
62
38
|
exports.LocalVerificationResultSchema = zod_1.z.object({
|
|
63
39
|
valid: zod_1.z.boolean(),
|
|
64
40
|
did: zod_1.z.string().optional(),
|
|
@@ -83,9 +59,6 @@ exports.LocalVerificationResultSchema = zod_1.z.object({
|
|
|
83
59
|
errors: zod_1.z.array(zod_1.z.string()).default([]),
|
|
84
60
|
warnings: zod_1.z.array(zod_1.z.string()).default([]),
|
|
85
61
|
});
|
|
86
|
-
/**
|
|
87
|
-
* Test DID and Key ID constants
|
|
88
|
-
*/
|
|
89
62
|
exports.TEST_DIDS = {
|
|
90
63
|
AGENT_1: "did:test:agent-1",
|
|
91
64
|
AGENT_2: "did:test:agent-2",
|
|
@@ -96,25 +69,15 @@ exports.TEST_KEY_IDS = {
|
|
|
96
69
|
KEY_TEST_2: "key-test-2",
|
|
97
70
|
KEY_VERIFIER_1: "key-verifier-1",
|
|
98
71
|
};
|
|
99
|
-
/**
|
|
100
|
-
* Test environment detection
|
|
101
|
-
*/
|
|
102
72
|
function isTestEnvironment() {
|
|
103
73
|
return process.env.XMCP_ENV === "test";
|
|
104
74
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Get test seed from environment or test name
|
|
107
|
-
*/
|
|
108
75
|
function getTestSeed(testName) {
|
|
109
76
|
return process.env.XMCP_TEST_SEED || testName || "default-test-seed";
|
|
110
77
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Error codes for test infrastructure
|
|
113
|
-
*/
|
|
114
78
|
exports.TEST_ERROR_CODES = {
|
|
115
79
|
MOCK_KTA_FAILURE: "XMCP_I_TEST_MOCK_KTA_FAILURE",
|
|
116
80
|
DETERMINISTIC_KEY_GENERATION_FAILED: "XMCP_I_TEST_DETERMINISTIC_KEY_FAILED",
|
|
117
81
|
LOCAL_VERIFICATION_FAILED: "XMCP_I_TEST_LOCAL_VERIFICATION_FAILED",
|
|
118
82
|
INVALID_TEST_CONFIGURATION: "XMCP_I_TEST_INVALID_CONFIG",
|
|
119
83
|
};
|
|
120
|
-
//# sourceMappingURL=test.js.map
|
package/dist/tlkrc/index.d.ts
CHANGED
package/dist/tlkrc/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* TLKRC Module Exports
|
|
4
|
-
*/
|
|
5
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
3
|
if (k2 === undefined) k2 = k;
|
|
7
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -18,4 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
15
|
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
17
|
__exportStar(require("./rotation.js"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|