@kya-os/contracts 1.3.2 → 1.3.4
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/package.json +28 -5
- package/README.md +0 -130
- package/dist/cli.d.ts +0 -378
- package/dist/cli.js +0 -116
- package/dist/delegation/constraints.d.ts +0 -992
- package/dist/delegation/constraints.js +0 -210
- package/dist/delegation/index.d.ts +0 -8
- package/dist/delegation/index.js +0 -24
- package/dist/delegation/schemas.d.ts +0 -8382
- package/dist/delegation/schemas.js +0 -476
- package/dist/did/index.d.ts +0 -9
- package/dist/did/index.js +0 -25
- package/dist/did/resolve-contract.d.ts +0 -220
- package/dist/did/resolve-contract.js +0 -32
- package/dist/did/schemas.d.ts +0 -113
- package/dist/did/schemas.js +0 -173
- package/dist/did/types.d.ts +0 -164
- package/dist/did/types.js +0 -71
- package/dist/env/constants.d.ts +0 -58
- package/dist/env/constants.js +0 -60
- package/dist/env/index.d.ts +0 -5
- package/dist/env/index.js +0 -21
- package/dist/handshake.d.ts +0 -159
- package/dist/handshake.js +0 -58
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -53
- package/dist/proof/index.d.ts +0 -9
- package/dist/proof/index.js +0 -25
- package/dist/proof/proof-record.d.ts +0 -838
- package/dist/proof/proof-record.js +0 -134
- package/dist/proof/signing-spec.d.ts +0 -147
- package/dist/proof/signing-spec.js +0 -123
- package/dist/proof.d.ts +0 -400
- package/dist/proof.js +0 -82
- package/dist/registry.d.ts +0 -343
- package/dist/registry.js +0 -119
- package/dist/runtime/errors.d.ts +0 -348
- package/dist/runtime/errors.js +0 -120
- package/dist/runtime/headers.d.ts +0 -84
- package/dist/runtime/headers.js +0 -82
- package/dist/runtime/index.d.ts +0 -6
- package/dist/runtime/index.js +0 -22
- package/dist/test.d.ts +0 -252
- package/dist/test.js +0 -120
- package/dist/tlkrc/index.d.ts +0 -5
- package/dist/tlkrc/index.js +0 -21
- package/dist/tlkrc/rotation.d.ts +0 -246
- package/dist/tlkrc/rotation.js +0 -127
- package/dist/utils/validation.d.ts +0 -31
- package/dist/utils/validation.js +0 -70
- package/dist/vc/index.d.ts +0 -8
- package/dist/vc/index.js +0 -24
- package/dist/vc/schemas.d.ts +0 -2484
- package/dist/vc/schemas.js +0 -225
- package/dist/vc/statuslist.d.ts +0 -494
- package/dist/vc/statuslist.js +0 -133
- package/dist/verifier.d.ts +0 -206
- package/dist/verifier.js +0 -84
package/dist/test.d.ts
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
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
|
-
import { z } from "zod";
|
|
8
|
-
/**
|
|
9
|
-
* Test environment configuration
|
|
10
|
-
*/
|
|
11
|
-
export declare const TestEnvironmentSchema: z.ZodObject<{
|
|
12
|
-
mode: z.ZodLiteral<"test">;
|
|
13
|
-
seed: z.ZodOptional<z.ZodString>;
|
|
14
|
-
deterministicKeys: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
-
skipKTACalls: z.ZodDefault<z.ZodBoolean>;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
mode: "test";
|
|
18
|
-
deterministicKeys: boolean;
|
|
19
|
-
skipKTACalls: boolean;
|
|
20
|
-
seed?: string | undefined;
|
|
21
|
-
}, {
|
|
22
|
-
mode: "test";
|
|
23
|
-
seed?: string | undefined;
|
|
24
|
-
deterministicKeys?: boolean | undefined;
|
|
25
|
-
skipKTACalls?: boolean | undefined;
|
|
26
|
-
}>;
|
|
27
|
-
export type TestEnvironment = z.infer<typeof TestEnvironmentSchema>;
|
|
28
|
-
/**
|
|
29
|
-
* Mock identity configuration for testing
|
|
30
|
-
*/
|
|
31
|
-
export declare const MockIdentitySchema: z.ZodObject<{
|
|
32
|
-
did: z.ZodString;
|
|
33
|
-
kid: z.ZodString;
|
|
34
|
-
privateKey: z.ZodString;
|
|
35
|
-
publicKey: z.ZodString;
|
|
36
|
-
createdAt: z.ZodString;
|
|
37
|
-
lastRotated: z.ZodOptional<z.ZodString>;
|
|
38
|
-
}, "strip", z.ZodTypeAny, {
|
|
39
|
-
did: string;
|
|
40
|
-
kid: string;
|
|
41
|
-
privateKey: string;
|
|
42
|
-
publicKey: string;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
lastRotated?: string | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
did: string;
|
|
47
|
-
kid: string;
|
|
48
|
-
privateKey: string;
|
|
49
|
-
publicKey: string;
|
|
50
|
-
createdAt: string;
|
|
51
|
-
lastRotated?: string | undefined;
|
|
52
|
-
}>;
|
|
53
|
-
export type MockIdentity = z.infer<typeof MockIdentitySchema>;
|
|
54
|
-
/**
|
|
55
|
-
* Mock delegation status for testing
|
|
56
|
-
*/
|
|
57
|
-
export declare const MockDelegationStatusSchema: z.ZodEnum<["active", "revoked", "pending"]>;
|
|
58
|
-
export type MockDelegationStatus = z.infer<typeof MockDelegationStatusSchema>;
|
|
59
|
-
/**
|
|
60
|
-
* Mock KTA failure scenarios for testing
|
|
61
|
-
*/
|
|
62
|
-
export declare const MockKTAFailureTypeSchema: z.ZodEnum<["network", "auth", "invalid", "timeout"]>;
|
|
63
|
-
export type MockKTAFailureType = z.infer<typeof MockKTAFailureTypeSchema>;
|
|
64
|
-
/**
|
|
65
|
-
* Mock identity provider configuration
|
|
66
|
-
*/
|
|
67
|
-
export declare const MockIdentityProviderConfigSchema: z.ZodObject<{
|
|
68
|
-
identities: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
69
|
-
did: z.ZodString;
|
|
70
|
-
kid: z.ZodString;
|
|
71
|
-
privateKey: z.ZodString;
|
|
72
|
-
publicKey: z.ZodString;
|
|
73
|
-
createdAt: z.ZodString;
|
|
74
|
-
lastRotated: z.ZodOptional<z.ZodString>;
|
|
75
|
-
}, "strip", z.ZodTypeAny, {
|
|
76
|
-
did: string;
|
|
77
|
-
kid: string;
|
|
78
|
-
privateKey: string;
|
|
79
|
-
publicKey: string;
|
|
80
|
-
createdAt: string;
|
|
81
|
-
lastRotated?: string | undefined;
|
|
82
|
-
}, {
|
|
83
|
-
did: string;
|
|
84
|
-
kid: string;
|
|
85
|
-
privateKey: string;
|
|
86
|
-
publicKey: string;
|
|
87
|
-
createdAt: string;
|
|
88
|
-
lastRotated?: string | undefined;
|
|
89
|
-
}>>;
|
|
90
|
-
delegations: z.ZodRecord<z.ZodString, z.ZodEnum<["active", "revoked", "pending"]>>;
|
|
91
|
-
ktaFailures: z.ZodDefault<z.ZodArray<z.ZodEnum<["network", "auth", "invalid", "timeout"]>, "many">>;
|
|
92
|
-
deterministicSeed: z.ZodOptional<z.ZodString>;
|
|
93
|
-
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
identities: Record<string, {
|
|
95
|
-
did: string;
|
|
96
|
-
kid: string;
|
|
97
|
-
privateKey: string;
|
|
98
|
-
publicKey: string;
|
|
99
|
-
createdAt: string;
|
|
100
|
-
lastRotated?: string | undefined;
|
|
101
|
-
}>;
|
|
102
|
-
delegations: Record<string, "pending" | "active" | "revoked">;
|
|
103
|
-
ktaFailures: ("network" | "auth" | "invalid" | "timeout")[];
|
|
104
|
-
deterministicSeed?: string | undefined;
|
|
105
|
-
}, {
|
|
106
|
-
identities: Record<string, {
|
|
107
|
-
did: string;
|
|
108
|
-
kid: string;
|
|
109
|
-
privateKey: string;
|
|
110
|
-
publicKey: string;
|
|
111
|
-
createdAt: string;
|
|
112
|
-
lastRotated?: string | undefined;
|
|
113
|
-
}>;
|
|
114
|
-
delegations: Record<string, "pending" | "active" | "revoked">;
|
|
115
|
-
ktaFailures?: ("network" | "auth" | "invalid" | "timeout")[] | undefined;
|
|
116
|
-
deterministicSeed?: string | undefined;
|
|
117
|
-
}>;
|
|
118
|
-
export type MockIdentityProviderConfig = z.infer<typeof MockIdentityProviderConfigSchema>;
|
|
119
|
-
/**
|
|
120
|
-
* Local verification result for offline testing
|
|
121
|
-
*/
|
|
122
|
-
export declare const LocalVerificationResultSchema: z.ZodObject<{
|
|
123
|
-
valid: z.ZodBoolean;
|
|
124
|
-
did: z.ZodOptional<z.ZodString>;
|
|
125
|
-
kid: z.ZodOptional<z.ZodString>;
|
|
126
|
-
signature: z.ZodObject<{
|
|
127
|
-
valid: z.ZodBoolean;
|
|
128
|
-
algorithm: z.ZodString;
|
|
129
|
-
error: z.ZodOptional<z.ZodString>;
|
|
130
|
-
}, "strip", z.ZodTypeAny, {
|
|
131
|
-
valid: boolean;
|
|
132
|
-
algorithm: string;
|
|
133
|
-
error?: string | undefined;
|
|
134
|
-
}, {
|
|
135
|
-
valid: boolean;
|
|
136
|
-
algorithm: string;
|
|
137
|
-
error?: string | undefined;
|
|
138
|
-
}>;
|
|
139
|
-
proof: z.ZodObject<{
|
|
140
|
-
valid: z.ZodBoolean;
|
|
141
|
-
structure: z.ZodBoolean;
|
|
142
|
-
timestamps: z.ZodBoolean;
|
|
143
|
-
hashes: z.ZodBoolean;
|
|
144
|
-
error: z.ZodOptional<z.ZodString>;
|
|
145
|
-
}, "strip", z.ZodTypeAny, {
|
|
146
|
-
valid: boolean;
|
|
147
|
-
structure: boolean;
|
|
148
|
-
timestamps: boolean;
|
|
149
|
-
hashes: boolean;
|
|
150
|
-
error?: string | undefined;
|
|
151
|
-
}, {
|
|
152
|
-
valid: boolean;
|
|
153
|
-
structure: boolean;
|
|
154
|
-
timestamps: boolean;
|
|
155
|
-
hashes: boolean;
|
|
156
|
-
error?: string | undefined;
|
|
157
|
-
}>;
|
|
158
|
-
session: z.ZodObject<{
|
|
159
|
-
valid: z.ZodBoolean;
|
|
160
|
-
expired: z.ZodBoolean;
|
|
161
|
-
error: z.ZodOptional<z.ZodString>;
|
|
162
|
-
}, "strip", z.ZodTypeAny, {
|
|
163
|
-
valid: boolean;
|
|
164
|
-
expired: boolean;
|
|
165
|
-
error?: string | undefined;
|
|
166
|
-
}, {
|
|
167
|
-
valid: boolean;
|
|
168
|
-
expired: boolean;
|
|
169
|
-
error?: string | undefined;
|
|
170
|
-
}>;
|
|
171
|
-
errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
172
|
-
warnings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
173
|
-
}, "strip", z.ZodTypeAny, {
|
|
174
|
-
valid: boolean;
|
|
175
|
-
warnings: string[];
|
|
176
|
-
session: {
|
|
177
|
-
valid: boolean;
|
|
178
|
-
expired: boolean;
|
|
179
|
-
error?: string | undefined;
|
|
180
|
-
};
|
|
181
|
-
signature: {
|
|
182
|
-
valid: boolean;
|
|
183
|
-
algorithm: string;
|
|
184
|
-
error?: string | undefined;
|
|
185
|
-
};
|
|
186
|
-
proof: {
|
|
187
|
-
valid: boolean;
|
|
188
|
-
structure: boolean;
|
|
189
|
-
timestamps: boolean;
|
|
190
|
-
hashes: boolean;
|
|
191
|
-
error?: string | undefined;
|
|
192
|
-
};
|
|
193
|
-
errors: string[];
|
|
194
|
-
did?: string | undefined;
|
|
195
|
-
kid?: string | undefined;
|
|
196
|
-
}, {
|
|
197
|
-
valid: boolean;
|
|
198
|
-
session: {
|
|
199
|
-
valid: boolean;
|
|
200
|
-
expired: boolean;
|
|
201
|
-
error?: string | undefined;
|
|
202
|
-
};
|
|
203
|
-
signature: {
|
|
204
|
-
valid: boolean;
|
|
205
|
-
algorithm: string;
|
|
206
|
-
error?: string | undefined;
|
|
207
|
-
};
|
|
208
|
-
proof: {
|
|
209
|
-
valid: boolean;
|
|
210
|
-
structure: boolean;
|
|
211
|
-
timestamps: boolean;
|
|
212
|
-
hashes: boolean;
|
|
213
|
-
error?: string | undefined;
|
|
214
|
-
};
|
|
215
|
-
did?: string | undefined;
|
|
216
|
-
kid?: string | undefined;
|
|
217
|
-
warnings?: string[] | undefined;
|
|
218
|
-
errors?: string[] | undefined;
|
|
219
|
-
}>;
|
|
220
|
-
export type LocalVerificationResult = z.infer<typeof LocalVerificationResultSchema>;
|
|
221
|
-
/**
|
|
222
|
-
* Test DID and Key ID constants
|
|
223
|
-
*/
|
|
224
|
-
export declare const TEST_DIDS: {
|
|
225
|
-
readonly AGENT_1: "did:test:agent-1";
|
|
226
|
-
readonly AGENT_2: "did:test:agent-2";
|
|
227
|
-
readonly VERIFIER_1: "did:test:verifier-1";
|
|
228
|
-
};
|
|
229
|
-
export declare const TEST_KEY_IDS: {
|
|
230
|
-
readonly KEY_TEST_1: "key-test-1";
|
|
231
|
-
readonly KEY_TEST_2: "key-test-2";
|
|
232
|
-
readonly KEY_VERIFIER_1: "key-verifier-1";
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* Test environment detection
|
|
236
|
-
*/
|
|
237
|
-
export declare function isTestEnvironment(): boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Get test seed from environment or test name
|
|
240
|
-
*/
|
|
241
|
-
export declare function getTestSeed(testName?: string): string;
|
|
242
|
-
/**
|
|
243
|
-
* Error codes for test infrastructure
|
|
244
|
-
*/
|
|
245
|
-
export declare const TEST_ERROR_CODES: {
|
|
246
|
-
readonly MOCK_KTA_FAILURE: "XMCP_I_TEST_MOCK_KTA_FAILURE";
|
|
247
|
-
readonly DETERMINISTIC_KEY_GENERATION_FAILED: "XMCP_I_TEST_DETERMINISTIC_KEY_FAILED";
|
|
248
|
-
readonly LOCAL_VERIFICATION_FAILED: "XMCP_I_TEST_LOCAL_VERIFICATION_FAILED";
|
|
249
|
-
readonly INVALID_TEST_CONFIGURATION: "XMCP_I_TEST_INVALID_CONFIG";
|
|
250
|
-
};
|
|
251
|
-
export type TestErrorCode = (typeof TEST_ERROR_CODES)[keyof typeof TEST_ERROR_CODES];
|
|
252
|
-
//# sourceMappingURL=test.d.ts.map
|
package/dist/test.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
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
|
-
exports.isTestEnvironment = isTestEnvironment;
|
|
11
|
-
exports.getTestSeed = getTestSeed;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
/**
|
|
14
|
-
* Test environment configuration
|
|
15
|
-
*/
|
|
16
|
-
exports.TestEnvironmentSchema = zod_1.z.object({
|
|
17
|
-
mode: zod_1.z.literal("test"),
|
|
18
|
-
seed: zod_1.z.string().optional(),
|
|
19
|
-
deterministicKeys: zod_1.z.boolean().default(true),
|
|
20
|
-
skipKTACalls: zod_1.z.boolean().default(true),
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Mock identity configuration for testing
|
|
24
|
-
*/
|
|
25
|
-
exports.MockIdentitySchema = zod_1.z.object({
|
|
26
|
-
did: zod_1.z.string(),
|
|
27
|
-
kid: zod_1.z.string(),
|
|
28
|
-
privateKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 private key (44 characters)"),
|
|
29
|
-
publicKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 public key (44 characters)"),
|
|
30
|
-
createdAt: zod_1.z.string(),
|
|
31
|
-
lastRotated: zod_1.z.string().optional(),
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
* Mock delegation status for testing
|
|
35
|
-
*/
|
|
36
|
-
exports.MockDelegationStatusSchema = zod_1.z.enum([
|
|
37
|
-
"active",
|
|
38
|
-
"revoked",
|
|
39
|
-
"pending",
|
|
40
|
-
]);
|
|
41
|
-
/**
|
|
42
|
-
* Mock KTA failure scenarios for testing
|
|
43
|
-
*/
|
|
44
|
-
exports.MockKTAFailureTypeSchema = zod_1.z.enum([
|
|
45
|
-
"network",
|
|
46
|
-
"auth",
|
|
47
|
-
"invalid",
|
|
48
|
-
"timeout",
|
|
49
|
-
]);
|
|
50
|
-
/**
|
|
51
|
-
* Mock identity provider configuration
|
|
52
|
-
*/
|
|
53
|
-
exports.MockIdentityProviderConfigSchema = zod_1.z.object({
|
|
54
|
-
identities: zod_1.z.record(zod_1.z.string(), exports.MockIdentitySchema),
|
|
55
|
-
delegations: zod_1.z.record(zod_1.z.string(), exports.MockDelegationStatusSchema),
|
|
56
|
-
ktaFailures: zod_1.z.array(exports.MockKTAFailureTypeSchema).default([]),
|
|
57
|
-
deterministicSeed: zod_1.z.string().optional(),
|
|
58
|
-
});
|
|
59
|
-
/**
|
|
60
|
-
* Local verification result for offline testing
|
|
61
|
-
*/
|
|
62
|
-
exports.LocalVerificationResultSchema = zod_1.z.object({
|
|
63
|
-
valid: zod_1.z.boolean(),
|
|
64
|
-
did: zod_1.z.string().optional(),
|
|
65
|
-
kid: zod_1.z.string().optional(),
|
|
66
|
-
signature: zod_1.z.object({
|
|
67
|
-
valid: zod_1.z.boolean(),
|
|
68
|
-
algorithm: zod_1.z.string(),
|
|
69
|
-
error: zod_1.z.string().optional(),
|
|
70
|
-
}),
|
|
71
|
-
proof: zod_1.z.object({
|
|
72
|
-
valid: zod_1.z.boolean(),
|
|
73
|
-
structure: zod_1.z.boolean(),
|
|
74
|
-
timestamps: zod_1.z.boolean(),
|
|
75
|
-
hashes: zod_1.z.boolean(),
|
|
76
|
-
error: zod_1.z.string().optional(),
|
|
77
|
-
}),
|
|
78
|
-
session: zod_1.z.object({
|
|
79
|
-
valid: zod_1.z.boolean(),
|
|
80
|
-
expired: zod_1.z.boolean(),
|
|
81
|
-
error: zod_1.z.string().optional(),
|
|
82
|
-
}),
|
|
83
|
-
errors: zod_1.z.array(zod_1.z.string()).default([]),
|
|
84
|
-
warnings: zod_1.z.array(zod_1.z.string()).default([]),
|
|
85
|
-
});
|
|
86
|
-
/**
|
|
87
|
-
* Test DID and Key ID constants
|
|
88
|
-
*/
|
|
89
|
-
exports.TEST_DIDS = {
|
|
90
|
-
AGENT_1: "did:test:agent-1",
|
|
91
|
-
AGENT_2: "did:test:agent-2",
|
|
92
|
-
VERIFIER_1: "did:test:verifier-1",
|
|
93
|
-
};
|
|
94
|
-
exports.TEST_KEY_IDS = {
|
|
95
|
-
KEY_TEST_1: "key-test-1",
|
|
96
|
-
KEY_TEST_2: "key-test-2",
|
|
97
|
-
KEY_VERIFIER_1: "key-verifier-1",
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Test environment detection
|
|
101
|
-
*/
|
|
102
|
-
function isTestEnvironment() {
|
|
103
|
-
return process.env.XMCP_ENV === "test";
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Get test seed from environment or test name
|
|
107
|
-
*/
|
|
108
|
-
function getTestSeed(testName) {
|
|
109
|
-
return process.env.XMCP_TEST_SEED || testName || "default-test-seed";
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Error codes for test infrastructure
|
|
113
|
-
*/
|
|
114
|
-
exports.TEST_ERROR_CODES = {
|
|
115
|
-
MOCK_KTA_FAILURE: "XMCP_I_TEST_MOCK_KTA_FAILURE",
|
|
116
|
-
DETERMINISTIC_KEY_GENERATION_FAILED: "XMCP_I_TEST_DETERMINISTIC_KEY_FAILED",
|
|
117
|
-
LOCAL_VERIFICATION_FAILED: "XMCP_I_TEST_LOCAL_VERIFICATION_FAILED",
|
|
118
|
-
INVALID_TEST_CONFIGURATION: "XMCP_I_TEST_INVALID_CONFIG",
|
|
119
|
-
};
|
|
120
|
-
//# sourceMappingURL=test.js.map
|
package/dist/tlkrc/index.d.ts
DELETED
package/dist/tlkrc/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* TLKRC Module Exports
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
__exportStar(require("./rotation.js"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/dist/tlkrc/rotation.d.ts
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TLKRC (Transparent Log Key Rotation Contract)
|
|
3
|
-
*
|
|
4
|
-
* Types for key rotation events in a transparent, auditable manner
|
|
5
|
-
*
|
|
6
|
-
* Related Spec: MCP-I Core
|
|
7
|
-
* Python Reference: Core-Documentation.md
|
|
8
|
-
*/
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
/**
|
|
11
|
-
* Rotation Event Schema
|
|
12
|
-
*
|
|
13
|
-
* Represents a key rotation event in a transparent log.
|
|
14
|
-
* Events form a hash-linked chain for auditability.
|
|
15
|
-
*
|
|
16
|
-
* **Dual-Key Grace Window:**
|
|
17
|
-
* During rotation, both `prevKeyId` and `nextKeyId` are valid
|
|
18
|
-
* from `effectiveAt` until `effectiveAt + grace period`.
|
|
19
|
-
*/
|
|
20
|
-
export declare const RotationEventSchema: z.ZodEffects<z.ZodObject<{
|
|
21
|
-
/** DID of the issuer performing the rotation */
|
|
22
|
-
issuerDid: z.ZodString;
|
|
23
|
-
/** Previous key ID being rotated out */
|
|
24
|
-
prevKeyId: z.ZodString;
|
|
25
|
-
/** New key ID being rotated in */
|
|
26
|
-
nextKeyId: z.ZodString;
|
|
27
|
-
/** Timestamp when new key becomes effective (Unix seconds) */
|
|
28
|
-
effectiveAt: z.ZodNumber;
|
|
29
|
-
/** Timestamp when event was issued (Unix seconds) */
|
|
30
|
-
issuedAt: z.ZodNumber;
|
|
31
|
-
/** Sequence number (monotonically increasing) */
|
|
32
|
-
seq: z.ZodNumber;
|
|
33
|
-
/** Hash of previous rotation event (null for first rotation) */
|
|
34
|
-
prevEventHash: z.ZodOptional<z.ZodString>;
|
|
35
|
-
/** Signature over the event (using prevKeyId) */
|
|
36
|
-
signature: z.ZodString;
|
|
37
|
-
/** Optional metadata */
|
|
38
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
issuerDid: string;
|
|
41
|
-
signature: string;
|
|
42
|
-
prevKeyId: string;
|
|
43
|
-
nextKeyId: string;
|
|
44
|
-
effectiveAt: number;
|
|
45
|
-
issuedAt: number;
|
|
46
|
-
seq: number;
|
|
47
|
-
metadata?: Record<string, any> | undefined;
|
|
48
|
-
prevEventHash?: string | undefined;
|
|
49
|
-
}, {
|
|
50
|
-
issuerDid: string;
|
|
51
|
-
signature: string;
|
|
52
|
-
prevKeyId: string;
|
|
53
|
-
nextKeyId: string;
|
|
54
|
-
effectiveAt: number;
|
|
55
|
-
issuedAt: number;
|
|
56
|
-
seq: number;
|
|
57
|
-
metadata?: Record<string, any> | undefined;
|
|
58
|
-
prevEventHash?: string | undefined;
|
|
59
|
-
}>, {
|
|
60
|
-
issuerDid: string;
|
|
61
|
-
signature: string;
|
|
62
|
-
prevKeyId: string;
|
|
63
|
-
nextKeyId: string;
|
|
64
|
-
effectiveAt: number;
|
|
65
|
-
issuedAt: number;
|
|
66
|
-
seq: number;
|
|
67
|
-
metadata?: Record<string, any> | undefined;
|
|
68
|
-
prevEventHash?: string | undefined;
|
|
69
|
-
}, {
|
|
70
|
-
issuerDid: string;
|
|
71
|
-
signature: string;
|
|
72
|
-
prevKeyId: string;
|
|
73
|
-
nextKeyId: string;
|
|
74
|
-
effectiveAt: number;
|
|
75
|
-
issuedAt: number;
|
|
76
|
-
seq: number;
|
|
77
|
-
metadata?: Record<string, any> | undefined;
|
|
78
|
-
prevEventHash?: string | undefined;
|
|
79
|
-
}>;
|
|
80
|
-
export type RotationEvent = z.infer<typeof RotationEventSchema>;
|
|
81
|
-
/**
|
|
82
|
-
* Rotation Chain
|
|
83
|
-
*
|
|
84
|
-
* Represents a chain of rotation events
|
|
85
|
-
*/
|
|
86
|
-
export declare const RotationChainSchema: z.ZodObject<{
|
|
87
|
-
/** Issuer DID */
|
|
88
|
-
issuerDid: z.ZodString;
|
|
89
|
-
/** All rotation events in order */
|
|
90
|
-
events: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
91
|
-
/** DID of the issuer performing the rotation */
|
|
92
|
-
issuerDid: z.ZodString;
|
|
93
|
-
/** Previous key ID being rotated out */
|
|
94
|
-
prevKeyId: z.ZodString;
|
|
95
|
-
/** New key ID being rotated in */
|
|
96
|
-
nextKeyId: z.ZodString;
|
|
97
|
-
/** Timestamp when new key becomes effective (Unix seconds) */
|
|
98
|
-
effectiveAt: z.ZodNumber;
|
|
99
|
-
/** Timestamp when event was issued (Unix seconds) */
|
|
100
|
-
issuedAt: z.ZodNumber;
|
|
101
|
-
/** Sequence number (monotonically increasing) */
|
|
102
|
-
seq: z.ZodNumber;
|
|
103
|
-
/** Hash of previous rotation event (null for first rotation) */
|
|
104
|
-
prevEventHash: z.ZodOptional<z.ZodString>;
|
|
105
|
-
/** Signature over the event (using prevKeyId) */
|
|
106
|
-
signature: z.ZodString;
|
|
107
|
-
/** Optional metadata */
|
|
108
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
109
|
-
}, "strip", z.ZodTypeAny, {
|
|
110
|
-
issuerDid: string;
|
|
111
|
-
signature: string;
|
|
112
|
-
prevKeyId: string;
|
|
113
|
-
nextKeyId: string;
|
|
114
|
-
effectiveAt: number;
|
|
115
|
-
issuedAt: number;
|
|
116
|
-
seq: number;
|
|
117
|
-
metadata?: Record<string, any> | undefined;
|
|
118
|
-
prevEventHash?: string | undefined;
|
|
119
|
-
}, {
|
|
120
|
-
issuerDid: string;
|
|
121
|
-
signature: string;
|
|
122
|
-
prevKeyId: string;
|
|
123
|
-
nextKeyId: string;
|
|
124
|
-
effectiveAt: number;
|
|
125
|
-
issuedAt: number;
|
|
126
|
-
seq: number;
|
|
127
|
-
metadata?: Record<string, any> | undefined;
|
|
128
|
-
prevEventHash?: string | undefined;
|
|
129
|
-
}>, {
|
|
130
|
-
issuerDid: string;
|
|
131
|
-
signature: string;
|
|
132
|
-
prevKeyId: string;
|
|
133
|
-
nextKeyId: string;
|
|
134
|
-
effectiveAt: number;
|
|
135
|
-
issuedAt: number;
|
|
136
|
-
seq: number;
|
|
137
|
-
metadata?: Record<string, any> | undefined;
|
|
138
|
-
prevEventHash?: string | undefined;
|
|
139
|
-
}, {
|
|
140
|
-
issuerDid: string;
|
|
141
|
-
signature: string;
|
|
142
|
-
prevKeyId: string;
|
|
143
|
-
nextKeyId: string;
|
|
144
|
-
effectiveAt: number;
|
|
145
|
-
issuedAt: number;
|
|
146
|
-
seq: number;
|
|
147
|
-
metadata?: Record<string, any> | undefined;
|
|
148
|
-
prevEventHash?: string | undefined;
|
|
149
|
-
}>, "many">;
|
|
150
|
-
/** Current active key ID */
|
|
151
|
-
currentKeyId: z.ZodString;
|
|
152
|
-
/** Whether chain is valid */
|
|
153
|
-
valid: z.ZodBoolean;
|
|
154
|
-
/** Optional validation errors */
|
|
155
|
-
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
156
|
-
}, "strip", z.ZodTypeAny, {
|
|
157
|
-
valid: boolean;
|
|
158
|
-
issuerDid: string;
|
|
159
|
-
events: {
|
|
160
|
-
issuerDid: string;
|
|
161
|
-
signature: string;
|
|
162
|
-
prevKeyId: string;
|
|
163
|
-
nextKeyId: string;
|
|
164
|
-
effectiveAt: number;
|
|
165
|
-
issuedAt: number;
|
|
166
|
-
seq: number;
|
|
167
|
-
metadata?: Record<string, any> | undefined;
|
|
168
|
-
prevEventHash?: string | undefined;
|
|
169
|
-
}[];
|
|
170
|
-
currentKeyId: string;
|
|
171
|
-
errors?: string[] | undefined;
|
|
172
|
-
}, {
|
|
173
|
-
valid: boolean;
|
|
174
|
-
issuerDid: string;
|
|
175
|
-
events: {
|
|
176
|
-
issuerDid: string;
|
|
177
|
-
signature: string;
|
|
178
|
-
prevKeyId: string;
|
|
179
|
-
nextKeyId: string;
|
|
180
|
-
effectiveAt: number;
|
|
181
|
-
issuedAt: number;
|
|
182
|
-
seq: number;
|
|
183
|
-
metadata?: Record<string, any> | undefined;
|
|
184
|
-
prevEventHash?: string | undefined;
|
|
185
|
-
}[];
|
|
186
|
-
currentKeyId: string;
|
|
187
|
-
errors?: string[] | undefined;
|
|
188
|
-
}>;
|
|
189
|
-
export type RotationChain = z.infer<typeof RotationChainSchema>;
|
|
190
|
-
/**
|
|
191
|
-
* Validation Helpers
|
|
192
|
-
*/
|
|
193
|
-
/**
|
|
194
|
-
* Validate a rotation event
|
|
195
|
-
*
|
|
196
|
-
* @param event - The event to validate
|
|
197
|
-
* @returns Validation result
|
|
198
|
-
*/
|
|
199
|
-
export declare function validateRotationEvent(event: unknown): z.SafeParseReturnType<{
|
|
200
|
-
issuerDid: string;
|
|
201
|
-
signature: string;
|
|
202
|
-
prevKeyId: string;
|
|
203
|
-
nextKeyId: string;
|
|
204
|
-
effectiveAt: number;
|
|
205
|
-
issuedAt: number;
|
|
206
|
-
seq: number;
|
|
207
|
-
metadata?: Record<string, any> | undefined;
|
|
208
|
-
prevEventHash?: string | undefined;
|
|
209
|
-
}, {
|
|
210
|
-
issuerDid: string;
|
|
211
|
-
signature: string;
|
|
212
|
-
prevKeyId: string;
|
|
213
|
-
nextKeyId: string;
|
|
214
|
-
effectiveAt: number;
|
|
215
|
-
issuedAt: number;
|
|
216
|
-
seq: number;
|
|
217
|
-
metadata?: Record<string, any> | undefined;
|
|
218
|
-
prevEventHash?: string | undefined;
|
|
219
|
-
}>;
|
|
220
|
-
/**
|
|
221
|
-
* Validate rotation chain integrity
|
|
222
|
-
*
|
|
223
|
-
* @param chain - The chain to validate
|
|
224
|
-
* @returns true if chain is valid
|
|
225
|
-
*/
|
|
226
|
-
export declare function isRotationChainValid(chain: RotationChain): boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Get active key at a specific timestamp
|
|
229
|
-
*
|
|
230
|
-
* @param chain - The rotation chain
|
|
231
|
-
* @param timestamp - Timestamp in seconds
|
|
232
|
-
* @returns Active key ID at that time, or null if none
|
|
233
|
-
*/
|
|
234
|
-
export declare function getActiveKeyAt(chain: RotationChain, timestamp: number): string | null;
|
|
235
|
-
/**
|
|
236
|
-
* Constants
|
|
237
|
-
*/
|
|
238
|
-
/**
|
|
239
|
-
* Default grace period for dual-key validity (24 hours)
|
|
240
|
-
*/
|
|
241
|
-
export declare const DEFAULT_GRACE_PERIOD_SEC: number;
|
|
242
|
-
/**
|
|
243
|
-
* Maximum reasonable grace period (30 days)
|
|
244
|
-
*/
|
|
245
|
-
export declare const MAX_GRACE_PERIOD_SEC: number;
|
|
246
|
-
//# sourceMappingURL=rotation.d.ts.map
|