@kya-os/contracts 1.10.0 → 1.12.1
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/agentshield-api/schemas.d.ts +14 -0
- package/dist/cli.d.ts +93 -0
- package/dist/cli.js +108 -1
- package/dist/handshake.d.ts +77 -0
- package/dist/handshake.js +73 -1
- package/dist/index.js +1 -0
- package/dist/molti/schemas.d.ts +1 -1
- package/dist/policy/schemas.d.ts +160 -160
- package/dist/proof.d.ts +30 -0
- package/dist/proof.js +6 -0
- package/dist/reputation/api.d.ts +0 -17
- package/dist/reputation/api.js +1 -21
- package/dist/review/canonicalize.d.ts +87 -0
- package/dist/review/canonicalize.js +122 -0
- package/dist/review/fix-attestation.d.ts +151 -0
- package/dist/review/fix-attestation.js +105 -0
- package/dist/review/index.d.ts +9 -0
- package/dist/review/index.js +25 -0
- package/dist/review/registry.d.ts +328 -0
- package/dist/review/registry.js +269 -0
- package/dist/review/schemas.d.ts +249 -0
- package/dist/review/schemas.js +102 -0
- package/dist/review/verify.d.ts +37 -0
- package/dist/review/verify.js +58 -0
- package/dist/test.d.ts +12 -12
- package/dist/vault/schemas.d.ts +2 -2
- package/package.json +9 -1
|
@@ -87,6 +87,8 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
87
87
|
scopeId: z.ZodOptional<z.ZodString>;
|
|
88
88
|
delegationRef: z.ZodOptional<z.ZodString>;
|
|
89
89
|
clientDid: z.ZodOptional<z.ZodString>;
|
|
90
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
91
|
+
submissionOutcome: z.ZodOptional<z.ZodEnum<["success", "failure", "denied"]>>;
|
|
90
92
|
}, "strip", z.ZodTypeAny, {
|
|
91
93
|
did: string;
|
|
92
94
|
kid: string;
|
|
@@ -100,6 +102,8 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
100
102
|
delegationRef?: string | undefined;
|
|
101
103
|
outcome?: "allowed" | "denied" | "step_up_required" | "needs_authorization" | undefined;
|
|
102
104
|
scopeId?: string | undefined;
|
|
105
|
+
toolName?: string | undefined;
|
|
106
|
+
submissionOutcome?: "success" | "denied" | "failure" | undefined;
|
|
103
107
|
}, {
|
|
104
108
|
did: string;
|
|
105
109
|
kid: string;
|
|
@@ -113,6 +117,8 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
113
117
|
delegationRef?: string | undefined;
|
|
114
118
|
outcome?: "allowed" | "denied" | "step_up_required" | "needs_authorization" | undefined;
|
|
115
119
|
scopeId?: string | undefined;
|
|
120
|
+
toolName?: string | undefined;
|
|
121
|
+
submissionOutcome?: "success" | "denied" | "failure" | undefined;
|
|
116
122
|
}>;
|
|
117
123
|
}, "strip", z.ZodTypeAny, {
|
|
118
124
|
jws: string;
|
|
@@ -129,6 +135,8 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
129
135
|
delegationRef?: string | undefined;
|
|
130
136
|
outcome?: "allowed" | "denied" | "step_up_required" | "needs_authorization" | undefined;
|
|
131
137
|
scopeId?: string | undefined;
|
|
138
|
+
toolName?: string | undefined;
|
|
139
|
+
submissionOutcome?: "success" | "denied" | "failure" | undefined;
|
|
132
140
|
};
|
|
133
141
|
}, {
|
|
134
142
|
jws: string;
|
|
@@ -145,6 +153,8 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
145
153
|
delegationRef?: string | undefined;
|
|
146
154
|
outcome?: "allowed" | "denied" | "step_up_required" | "needs_authorization" | undefined;
|
|
147
155
|
scopeId?: string | undefined;
|
|
156
|
+
toolName?: string | undefined;
|
|
157
|
+
submissionOutcome?: "success" | "denied" | "failure" | undefined;
|
|
148
158
|
};
|
|
149
159
|
}>, "many">;
|
|
150
160
|
context: z.ZodOptional<z.ZodObject<{
|
|
@@ -293,6 +303,8 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
293
303
|
delegationRef?: string | undefined;
|
|
294
304
|
outcome?: "allowed" | "denied" | "step_up_required" | "needs_authorization" | undefined;
|
|
295
305
|
scopeId?: string | undefined;
|
|
306
|
+
toolName?: string | undefined;
|
|
307
|
+
submissionOutcome?: "success" | "denied" | "failure" | undefined;
|
|
296
308
|
};
|
|
297
309
|
}[];
|
|
298
310
|
delegation_id?: string | null | undefined;
|
|
@@ -340,6 +352,8 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
340
352
|
delegationRef?: string | undefined;
|
|
341
353
|
outcome?: "allowed" | "denied" | "step_up_required" | "needs_authorization" | undefined;
|
|
342
354
|
scopeId?: string | undefined;
|
|
355
|
+
toolName?: string | undefined;
|
|
356
|
+
submissionOutcome?: "success" | "denied" | "failure" | undefined;
|
|
343
357
|
};
|
|
344
358
|
}[];
|
|
345
359
|
delegation_id?: string | null | undefined;
|
package/dist/cli.d.ts
CHANGED
|
@@ -431,3 +431,96 @@ export declare const CLI_EXIT_CODES: {
|
|
|
431
431
|
readonly CONFIG: 25;
|
|
432
432
|
readonly RUNTIME: 26;
|
|
433
433
|
};
|
|
434
|
+
export declare const CliProjectProvisionRequestSchema: z.ZodObject<{
|
|
435
|
+
/** Stable per-repo slug so re-running provisioning is idempotent. */
|
|
436
|
+
resourceId: z.ZodString;
|
|
437
|
+
/** Defaults server-side to the caller's package.json name when omitted. */
|
|
438
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
439
|
+
}, "strip", z.ZodTypeAny, {
|
|
440
|
+
resourceId: string;
|
|
441
|
+
projectName?: string | undefined;
|
|
442
|
+
}, {
|
|
443
|
+
resourceId: string;
|
|
444
|
+
projectName?: string | undefined;
|
|
445
|
+
}>;
|
|
446
|
+
export declare const CliProjectProvisionAnonymousResponseSchema: z.ZodObject<{
|
|
447
|
+
apiKey: z.ZodString;
|
|
448
|
+
projectId: z.ZodString;
|
|
449
|
+
claimUrl: z.ZodEffects<z.ZodString, string, string>;
|
|
450
|
+
pollToken: z.ZodString;
|
|
451
|
+
}, "strip", z.ZodTypeAny, {
|
|
452
|
+
projectId: string;
|
|
453
|
+
claimUrl: string;
|
|
454
|
+
apiKey: string;
|
|
455
|
+
pollToken: string;
|
|
456
|
+
}, {
|
|
457
|
+
projectId: string;
|
|
458
|
+
claimUrl: string;
|
|
459
|
+
apiKey: string;
|
|
460
|
+
pollToken: string;
|
|
461
|
+
}>;
|
|
462
|
+
export declare const CliProjectProvisionAuthenticatedResponseSchema: z.ZodObject<{
|
|
463
|
+
apiKey: z.ZodString;
|
|
464
|
+
projectId: z.ZodString;
|
|
465
|
+
organizationId: z.ZodString;
|
|
466
|
+
dashboardUrl: z.ZodEffects<z.ZodString, string, string>;
|
|
467
|
+
}, "strip", z.ZodTypeAny, {
|
|
468
|
+
projectId: string;
|
|
469
|
+
apiKey: string;
|
|
470
|
+
organizationId: string;
|
|
471
|
+
dashboardUrl: string;
|
|
472
|
+
}, {
|
|
473
|
+
projectId: string;
|
|
474
|
+
apiKey: string;
|
|
475
|
+
organizationId: string;
|
|
476
|
+
dashboardUrl: string;
|
|
477
|
+
}>;
|
|
478
|
+
export declare const CliClaimStatusPendingSchema: z.ZodObject<{
|
|
479
|
+
status: z.ZodLiteral<"pending">;
|
|
480
|
+
}, "strip", z.ZodTypeAny, {
|
|
481
|
+
status: "pending";
|
|
482
|
+
}, {
|
|
483
|
+
status: "pending";
|
|
484
|
+
}>;
|
|
485
|
+
export declare const CliClaimStatusClaimedSchema: z.ZodObject<{
|
|
486
|
+
status: z.ZodLiteral<"claimed">;
|
|
487
|
+
cliToken: z.ZodString;
|
|
488
|
+
orgId: z.ZodString;
|
|
489
|
+
projectId: z.ZodString;
|
|
490
|
+
}, "strip", z.ZodTypeAny, {
|
|
491
|
+
status: "claimed";
|
|
492
|
+
projectId: string;
|
|
493
|
+
cliToken: string;
|
|
494
|
+
orgId: string;
|
|
495
|
+
}, {
|
|
496
|
+
status: "claimed";
|
|
497
|
+
projectId: string;
|
|
498
|
+
cliToken: string;
|
|
499
|
+
orgId: string;
|
|
500
|
+
}>;
|
|
501
|
+
export declare const CliClaimStatusResponseSchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
|
|
502
|
+
status: z.ZodLiteral<"pending">;
|
|
503
|
+
}, "strip", z.ZodTypeAny, {
|
|
504
|
+
status: "pending";
|
|
505
|
+
}, {
|
|
506
|
+
status: "pending";
|
|
507
|
+
}>, z.ZodObject<{
|
|
508
|
+
status: z.ZodLiteral<"claimed">;
|
|
509
|
+
cliToken: z.ZodString;
|
|
510
|
+
orgId: z.ZodString;
|
|
511
|
+
projectId: z.ZodString;
|
|
512
|
+
}, "strip", z.ZodTypeAny, {
|
|
513
|
+
status: "claimed";
|
|
514
|
+
projectId: string;
|
|
515
|
+
cliToken: string;
|
|
516
|
+
orgId: string;
|
|
517
|
+
}, {
|
|
518
|
+
status: "claimed";
|
|
519
|
+
projectId: string;
|
|
520
|
+
cliToken: string;
|
|
521
|
+
orgId: string;
|
|
522
|
+
}>]>;
|
|
523
|
+
export type CliProjectProvisionRequest = z.infer<typeof CliProjectProvisionRequestSchema>;
|
|
524
|
+
export type CliProjectProvisionAnonymousResponse = z.infer<typeof CliProjectProvisionAnonymousResponseSchema>;
|
|
525
|
+
export type CliProjectProvisionAuthenticatedResponse = z.infer<typeof CliProjectProvisionAuthenticatedResponseSchema>;
|
|
526
|
+
export type CliClaimStatusResponse = z.infer<typeof CliClaimStatusResponseSchema>;
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.CLIIdentityFileSchema = exports.KTARegistrationSchema = void 0;
|
|
3
|
+
exports.CliClaimStatusResponseSchema = exports.CliClaimStatusClaimedSchema = exports.CliClaimStatusPendingSchema = exports.CliProjectProvisionAuthenticatedResponseSchema = exports.CliProjectProvisionAnonymousResponseSchema = exports.CliProjectProvisionRequestSchema = exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.CLIIdentityFileSchema = exports.KTARegistrationSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const identity_js_1 = require("./config/identity.js");
|
|
6
6
|
/**
|
|
@@ -143,3 +143,110 @@ exports.CLI_EXIT_CODES = {
|
|
|
143
143
|
CONFIG: 25,
|
|
144
144
|
RUNTIME: 26,
|
|
145
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* `/api/v1/cli/*` wire schemas: Checkpoint's CLI provisioning API (the
|
|
148
|
+
* KYA-1003 init-CLI epic, Phase 1). Anonymous provisioning mints an
|
|
149
|
+
* unclaimed, observe-only project with a single-use claim URL; a caller
|
|
150
|
+
* holding a claimed `cliToken` provisions directly into its org.
|
|
151
|
+
*
|
|
152
|
+
* First-pass contract, drafted from the checkpoint plan doc so the CLI
|
|
153
|
+
* side (packages/cli's utils/cli-kit/claim-polling.ts, packages/id's future
|
|
154
|
+
* `init` command) has a stable shape to build against; the checkpoint
|
|
155
|
+
* route handlers (owned separately) must validate against these same
|
|
156
|
+
* schemas so the two sides can't drift — see CLAUDE.md's API parity
|
|
157
|
+
* requirements before changing either side.
|
|
158
|
+
*
|
|
159
|
+
* SECURITY NOTE for the route-handler implementer (checkpoint plan doc
|
|
160
|
+
* Phase 1F already calls for a security review of the unclaimed-project
|
|
161
|
+
* lifecycle before shipping — this is that review's starting checklist,
|
|
162
|
+
* not a substitute for it): the anonymous request below is unauthenticated
|
|
163
|
+
* and idempotent on `resourceId` alone, and `resourceId` is typically a
|
|
164
|
+
* public, guessable value (a repo slug). Re-provisioning must not hand out
|
|
165
|
+
* the SAME apiKey/claimUrl/pollToken to a second caller who merely guesses
|
|
166
|
+
* an existing `resourceId` — bind idempotency to something the original
|
|
167
|
+
* caller holds (e.g. re-require the previously-issued `pollToken`), not to
|
|
168
|
+
* `resourceId` in isolation. Likewise the claim-status poll has no request
|
|
169
|
+
* schema here because it's a GET keyed on `pollToken` as a bearer value;
|
|
170
|
+
* treat it accordingly (short TTL, single active token per project, rate
|
|
171
|
+
* limited) rather than adding a body schema that implies otherwise.
|
|
172
|
+
*/
|
|
173
|
+
// Mirrors -- without importing, since @kya-os/contracts must stay
|
|
174
|
+
// dependency-free and packages/cli already depends on contracts, making
|
|
175
|
+
// the reverse import circular -- API_KEY_RE / PROJECT_ID_RE / isHttpUrl
|
|
176
|
+
// in packages/cli/src/utils/checkpoint-api.ts (the sibling KYA-1037
|
|
177
|
+
// checkpoint-init claim flow's parse-time guards, added there after a
|
|
178
|
+
// Bugbot review on PR #658 for this exact newline-injection /
|
|
179
|
+
// non-http-scheme shape). Keep both in sync if either side's shape
|
|
180
|
+
// changes.
|
|
181
|
+
//
|
|
182
|
+
// The two live API-key formats the server mints (credentials.mdx): sk_...
|
|
183
|
+
// for current keys, as_... as a real legacy format some paths still
|
|
184
|
+
// generate.
|
|
185
|
+
const CLI_API_KEY_RE = /^(sk|as)_[A-Za-z0-9._-]+$/;
|
|
186
|
+
// Shared "safe opaque token" shape for projectId/cliToken/pollToken: once
|
|
187
|
+
// the Checkpoint CLI writes these into a .env file or a scaffold snippet,
|
|
188
|
+
// an unvalidated newline could inject a rogue env line or break out of
|
|
189
|
+
// the snippet, so the charset is restricted to what can never do that.
|
|
190
|
+
const CLI_OPAQUE_TOKEN_RE = /^[A-Za-z0-9._-]+$/;
|
|
191
|
+
/**
|
|
192
|
+
* True for an http(s) URL only -- never file:, vscode:, or any other
|
|
193
|
+
* scheme an OS protocol handler might act on unexpectedly.
|
|
194
|
+
*/
|
|
195
|
+
function isHttpUrl(value) {
|
|
196
|
+
try {
|
|
197
|
+
const protocol = new URL(value).protocol;
|
|
198
|
+
return protocol === "http:" || protocol === "https:";
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.CliProjectProvisionRequestSchema = zod_1.z.object({
|
|
205
|
+
/** Stable per-repo slug so re-running provisioning is idempotent. */
|
|
206
|
+
resourceId: zod_1.z.string().min(1),
|
|
207
|
+
/** Defaults server-side to the caller's package.json name when omitted. */
|
|
208
|
+
projectName: zod_1.z.string().min(1).optional(),
|
|
209
|
+
});
|
|
210
|
+
exports.CliProjectProvisionAnonymousResponseSchema = zod_1.z.object({
|
|
211
|
+
apiKey: zod_1.z.string().min(1).regex(CLI_API_KEY_RE, "Malformed apiKey"),
|
|
212
|
+
projectId: zod_1.z
|
|
213
|
+
.string()
|
|
214
|
+
.min(1)
|
|
215
|
+
.regex(CLI_OPAQUE_TOKEN_RE, "Malformed projectId"),
|
|
216
|
+
claimUrl: zod_1.z
|
|
217
|
+
.string()
|
|
218
|
+
.url()
|
|
219
|
+
.refine(isHttpUrl, "claimUrl must be an http(s) URL"),
|
|
220
|
+
pollToken: zod_1.z
|
|
221
|
+
.string()
|
|
222
|
+
.min(1)
|
|
223
|
+
.regex(CLI_OPAQUE_TOKEN_RE, "Malformed pollToken"),
|
|
224
|
+
});
|
|
225
|
+
exports.CliProjectProvisionAuthenticatedResponseSchema = zod_1.z.object({
|
|
226
|
+
apiKey: zod_1.z.string().min(1).regex(CLI_API_KEY_RE, "Malformed apiKey"),
|
|
227
|
+
projectId: zod_1.z
|
|
228
|
+
.string()
|
|
229
|
+
.min(1)
|
|
230
|
+
.regex(CLI_OPAQUE_TOKEN_RE, "Malformed projectId"),
|
|
231
|
+
organizationId: zod_1.z.string().min(1),
|
|
232
|
+
dashboardUrl: zod_1.z
|
|
233
|
+
.string()
|
|
234
|
+
.url()
|
|
235
|
+
.refine(isHttpUrl, "dashboardUrl must be an http(s) URL"),
|
|
236
|
+
});
|
|
237
|
+
exports.CliClaimStatusPendingSchema = zod_1.z.object({
|
|
238
|
+
status: zod_1.z.literal("pending"),
|
|
239
|
+
});
|
|
240
|
+
exports.CliClaimStatusClaimedSchema = zod_1.z.object({
|
|
241
|
+
status: zod_1.z.literal("claimed"),
|
|
242
|
+
cliToken: zod_1.z.string().min(1).regex(CLI_OPAQUE_TOKEN_RE, "Malformed cliToken"),
|
|
243
|
+
orgId: zod_1.z.string().min(1),
|
|
244
|
+
projectId: zod_1.z
|
|
245
|
+
.string()
|
|
246
|
+
.min(1)
|
|
247
|
+
.regex(CLI_OPAQUE_TOKEN_RE, "Malformed projectId"),
|
|
248
|
+
});
|
|
249
|
+
exports.CliClaimStatusResponseSchema = zod_1.z.discriminatedUnion("status", [
|
|
250
|
+
exports.CliClaimStatusPendingSchema,
|
|
251
|
+
exports.CliClaimStatusClaimedSchema,
|
|
252
|
+
]);
|
package/dist/handshake.d.ts
CHANGED
|
@@ -406,4 +406,81 @@ export type NonceCacheConfig = z.infer<typeof NonceCacheConfigSchema>;
|
|
|
406
406
|
export declare const DEFAULT_SESSION_TTL_MINUTES = 30;
|
|
407
407
|
export declare const DEFAULT_TIMESTAMP_SKEW_SECONDS = 120;
|
|
408
408
|
export declare const NONCE_LENGTH_BYTES = 16;
|
|
409
|
+
/**
|
|
410
|
+
* JWS `typ` header for a DIDComm proof-of-possession.
|
|
411
|
+
*
|
|
412
|
+
* A verifier MUST reject a proof whose `typ` differs. Without that check a JWS
|
|
413
|
+
* minted for some other purpose — an API token, a delegation credential — could
|
|
414
|
+
* be replayed as a possession proof, since both are signed by the same key.
|
|
415
|
+
*/
|
|
416
|
+
export declare const DIDCOMM_POP_TYP = "didcomm-pop+jwt";
|
|
417
|
+
/** Signature algorithm. Ed25519 throughout the platform. */
|
|
418
|
+
export declare const DIDCOMM_POP_ALG = "EdDSA";
|
|
419
|
+
/**
|
|
420
|
+
* Claims a proof carries.
|
|
421
|
+
*
|
|
422
|
+
* `nonce` is the hub's challenge, which makes the proof fresh and single-use.
|
|
423
|
+
* `sub` binds it to the DID that presented the key, so a valid proof for one DID
|
|
424
|
+
* cannot be replayed as another's.
|
|
425
|
+
*/
|
|
426
|
+
export declare const DIDCommPopClaimsSchema: z.ZodObject<{
|
|
427
|
+
/** The exact nonce the hub issued. */
|
|
428
|
+
nonce: z.ZodString;
|
|
429
|
+
/** The DID being proven. */
|
|
430
|
+
sub: z.ZodString;
|
|
431
|
+
}, "strip", z.ZodTypeAny, {
|
|
432
|
+
nonce: string;
|
|
433
|
+
sub: string;
|
|
434
|
+
}, {
|
|
435
|
+
nonce: string;
|
|
436
|
+
sub: string;
|
|
437
|
+
}>;
|
|
438
|
+
export type DIDCommPopClaims = z.infer<typeof DIDCommPopClaimsSchema>;
|
|
439
|
+
/**
|
|
440
|
+
* The `observe` frame an observer sends to attach to a hub.
|
|
441
|
+
*
|
|
442
|
+
* `did` and `publicKey` are optional on the wire because a hub may admit a
|
|
443
|
+
* loopback observer without them. When the hub requires authentication, both are
|
|
444
|
+
* needed: the DID to bind the proof to, and the key to verify the binding before
|
|
445
|
+
* a challenge is spent.
|
|
446
|
+
*/
|
|
447
|
+
export declare const ObserverHelloSchema: z.ZodObject<{
|
|
448
|
+
type: z.ZodLiteral<"observe">;
|
|
449
|
+
did: z.ZodOptional<z.ZodString>;
|
|
450
|
+
/** JSON-serialised public JWK. */
|
|
451
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
452
|
+
}, "strip", z.ZodTypeAny, {
|
|
453
|
+
type: "observe";
|
|
454
|
+
did?: string | undefined;
|
|
455
|
+
publicKey?: string | undefined;
|
|
456
|
+
}, {
|
|
457
|
+
type: "observe";
|
|
458
|
+
did?: string | undefined;
|
|
459
|
+
publicKey?: string | undefined;
|
|
460
|
+
}>;
|
|
461
|
+
export type ObserverHello = z.infer<typeof ObserverHelloSchema>;
|
|
462
|
+
/** The hub's challenge, and the answer to it. */
|
|
463
|
+
export declare const DIDCommChallengeSchema: z.ZodObject<{
|
|
464
|
+
type: z.ZodLiteral<"challenge">;
|
|
465
|
+
nonce: z.ZodString;
|
|
466
|
+
}, "strip", z.ZodTypeAny, {
|
|
467
|
+
type: "challenge";
|
|
468
|
+
nonce: string;
|
|
469
|
+
}, {
|
|
470
|
+
type: "challenge";
|
|
471
|
+
nonce: string;
|
|
472
|
+
}>;
|
|
473
|
+
export type DIDCommChallenge = z.infer<typeof DIDCommChallengeSchema>;
|
|
474
|
+
export declare const DIDCommProofSchema: z.ZodObject<{
|
|
475
|
+
type: z.ZodLiteral<"proof">;
|
|
476
|
+
/** Compact JWS over {@link DIDCommPopClaimsSchema}. */
|
|
477
|
+
jws: z.ZodString;
|
|
478
|
+
}, "strip", z.ZodTypeAny, {
|
|
479
|
+
type: "proof";
|
|
480
|
+
jws: string;
|
|
481
|
+
}, {
|
|
482
|
+
type: "proof";
|
|
483
|
+
jws: string;
|
|
484
|
+
}>;
|
|
485
|
+
export type DIDCommProof = z.infer<typeof DIDCommProofSchema>;
|
|
409
486
|
export {};
|
package/dist/handshake.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NONCE_LENGTH_BYTES = exports.DEFAULT_TIMESTAMP_SKEW_SECONDS = exports.DEFAULT_SESSION_TTL_MINUTES = exports.NonceCacheConfigSchema = exports.NonceCacheEntrySchema = exports.SessionContextSchema = exports.HandshakeRequestSchema = exports.MCPClientSessionInfoSchema = exports.MCPClientInfoSchema = exports.SessionIdentityStateSchema = void 0;
|
|
3
|
+
exports.DIDCommProofSchema = exports.DIDCommChallengeSchema = exports.ObserverHelloSchema = exports.DIDCommPopClaimsSchema = exports.DIDCOMM_POP_ALG = exports.DIDCOMM_POP_TYP = exports.NONCE_LENGTH_BYTES = exports.DEFAULT_TIMESTAMP_SKEW_SECONDS = exports.DEFAULT_SESSION_TTL_MINUTES = exports.NonceCacheConfigSchema = exports.NonceCacheEntrySchema = exports.SessionContextSchema = exports.HandshakeRequestSchema = exports.MCPClientSessionInfoSchema = exports.MCPClientInfoSchema = exports.SessionIdentityStateSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
/**
|
|
6
6
|
* OAuth Identity schema (inlined to avoid ESM/CJS boundary issues with @kya-os/consent)
|
|
@@ -128,3 +128,75 @@ exports.NonceCacheConfigSchema = zod_1.z.object({
|
|
|
128
128
|
exports.DEFAULT_SESSION_TTL_MINUTES = 30;
|
|
129
129
|
exports.DEFAULT_TIMESTAMP_SKEW_SECONDS = 120;
|
|
130
130
|
exports.NONCE_LENGTH_BYTES = 16; // 128-bit
|
|
131
|
+
/* ────────────────────────────────────────────────────────────────────────────
|
|
132
|
+
* DIDComm proof-of-possession
|
|
133
|
+
*
|
|
134
|
+
* The wire format a connector uses to prove it holds the private half of the key
|
|
135
|
+
* it presented at handshake. The coordination hub challenges with a nonce; the
|
|
136
|
+
* connector returns a compact JWS over it.
|
|
137
|
+
*
|
|
138
|
+
* Lives here, on the `./handshake` subpath, rather than under `./proof`. Both
|
|
139
|
+
* `src/proof.ts` and `src/proof/index.ts` exist, so `@kya-os/contracts/proof` is
|
|
140
|
+
* ambiguous: Node follows the exports map to `dist/proof/index.js` while tsc
|
|
141
|
+
* resolves the flat `dist/proof.d.ts`, and a symbol added to only one of them
|
|
142
|
+
* type-checks in the dev config and fails the build. `./handshake` has no
|
|
143
|
+
* directory twin, and this IS handshake material.
|
|
144
|
+
*
|
|
145
|
+
* Shared because there are two implementors: the hub in @kya-os/compute verifies
|
|
146
|
+
* these, and @kya-os/cli produces one when its orchestrator daemon attaches as an
|
|
147
|
+
* observer. The CLI cannot depend on compute -- compute is PID 1 in a Fly worker,
|
|
148
|
+
* the CLI is a published package -- so without a shared spec the format would
|
|
149
|
+
* exist twice and drift the first time either side touched a header.
|
|
150
|
+
*
|
|
151
|
+
* Only the FORMAT is here; signing and verification stay with the sides holding
|
|
152
|
+
* keys, which is why this adds no crypto dependency.
|
|
153
|
+
*
|
|
154
|
+
* Related: #3147 (hello proof-of-possession)
|
|
155
|
+
* ──────────────────────────────────────────────────────────────────────────── */
|
|
156
|
+
/**
|
|
157
|
+
* JWS `typ` header for a DIDComm proof-of-possession.
|
|
158
|
+
*
|
|
159
|
+
* A verifier MUST reject a proof whose `typ` differs. Without that check a JWS
|
|
160
|
+
* minted for some other purpose — an API token, a delegation credential — could
|
|
161
|
+
* be replayed as a possession proof, since both are signed by the same key.
|
|
162
|
+
*/
|
|
163
|
+
exports.DIDCOMM_POP_TYP = 'didcomm-pop+jwt';
|
|
164
|
+
/** Signature algorithm. Ed25519 throughout the platform. */
|
|
165
|
+
exports.DIDCOMM_POP_ALG = 'EdDSA';
|
|
166
|
+
/**
|
|
167
|
+
* Claims a proof carries.
|
|
168
|
+
*
|
|
169
|
+
* `nonce` is the hub's challenge, which makes the proof fresh and single-use.
|
|
170
|
+
* `sub` binds it to the DID that presented the key, so a valid proof for one DID
|
|
171
|
+
* cannot be replayed as another's.
|
|
172
|
+
*/
|
|
173
|
+
exports.DIDCommPopClaimsSchema = zod_1.z.object({
|
|
174
|
+
/** The exact nonce the hub issued. */
|
|
175
|
+
nonce: zod_1.z.string().min(1),
|
|
176
|
+
/** The DID being proven. */
|
|
177
|
+
sub: zod_1.z.string().min(1),
|
|
178
|
+
});
|
|
179
|
+
/**
|
|
180
|
+
* The `observe` frame an observer sends to attach to a hub.
|
|
181
|
+
*
|
|
182
|
+
* `did` and `publicKey` are optional on the wire because a hub may admit a
|
|
183
|
+
* loopback observer without them. When the hub requires authentication, both are
|
|
184
|
+
* needed: the DID to bind the proof to, and the key to verify the binding before
|
|
185
|
+
* a challenge is spent.
|
|
186
|
+
*/
|
|
187
|
+
exports.ObserverHelloSchema = zod_1.z.object({
|
|
188
|
+
type: zod_1.z.literal('observe'),
|
|
189
|
+
did: zod_1.z.string().min(1).optional(),
|
|
190
|
+
/** JSON-serialised public JWK. */
|
|
191
|
+
publicKey: zod_1.z.string().min(1).optional(),
|
|
192
|
+
});
|
|
193
|
+
/** The hub's challenge, and the answer to it. */
|
|
194
|
+
exports.DIDCommChallengeSchema = zod_1.z.object({
|
|
195
|
+
type: zod_1.z.literal('challenge'),
|
|
196
|
+
nonce: zod_1.z.string().min(1),
|
|
197
|
+
});
|
|
198
|
+
exports.DIDCommProofSchema = zod_1.z.object({
|
|
199
|
+
type: zod_1.z.literal('proof'),
|
|
200
|
+
/** Compact JWS over {@link DIDCommPopClaimsSchema}. */
|
|
201
|
+
jws: zod_1.z.string().min(1),
|
|
202
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -60,3 +60,4 @@ exports.SUPPORTED_XMCP_I_VERSION = "^1.0.0";
|
|
|
60
60
|
// import { ... } from '@kya-os/contracts/identity' // Phase 5: Identity resolution
|
|
61
61
|
// import { ... } from '@kya-os/contracts/reputation' // Reputation scoring system
|
|
62
62
|
// import { ... } from '@kya-os/contracts/policy' // Agent policy configuration
|
|
63
|
+
// import { ... } from '@kya-os/contracts/review' // PR review verdicts
|
package/dist/molti/schemas.d.ts
CHANGED
|
@@ -76,8 +76,8 @@ export declare const moltiDeployRequestSchema: z.ZodObject<{
|
|
|
76
76
|
enableReputation: z.ZodDefault<z.ZodBoolean>;
|
|
77
77
|
}, "strip", z.ZodTypeAny, {
|
|
78
78
|
projectName: string;
|
|
79
|
-
enableReputation: boolean;
|
|
80
79
|
organizationId: string;
|
|
80
|
+
enableReputation: boolean;
|
|
81
81
|
agentName?: string | undefined;
|
|
82
82
|
agentDescription?: string | undefined;
|
|
83
83
|
instanceType?: "basic" | "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4" | undefined;
|