@githolon/dsl 0.94.2 → 0.95.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/dsl",
3
- "version": "0.94.2",
3
+ "version": "0.95.0",
4
4
  "type": "module",
5
5
  "description": "Nomos 2 domain-authoring DSL: aggregates + directives in TS, executed and encoded to the Rust kernel's wire shapes.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -322,6 +322,15 @@ export const enrollFirstDevice = directive("enrollFirstDevice")
322
322
  /** THE CAPTURED PREMISE: the IdP's signed identity assertion (JWT), re-verified on every lane against
323
323
  * the on-chain AuthProvider keys. */
324
324
  idpToken: z.string().min(1),
325
+ /** THE KEYLESS DELEGATION CERT (JSON `executor::birth_cert::BirthCert`) — the self-serve sibling of
326
+ * `enrollDelegation.certJson`. Built CLIENT-SIDE via the `cert_sign` op: DEVICE-self-signed by this
327
+ * same device key `P_U` (parent_key == P_U), founder == `user:<uid>`, carrying `verifiedVia` +
328
+ * `idpToken` + `capturedClock`. There is NO tenant `S_P` in the loop — the kernel's home-birth chain
329
+ * walk (`verify_to_root`, keyless branch) RE-VERIFIES the token against the platform-attested
330
+ * AuthProvider (bound to K_root by the terminal platform_cert), so a forged/swapped cert fails the
331
+ * child's own gate. Writing it as the user's `SignerDelegation` is what lets `birthHome`'s offer-effect
332
+ * assemble a WARRANTED travelling chain (closes co2's `birth-cert-not-seeded` / empty signerDelegation). */
333
+ delegationCert: z.string().min(1),
325
334
  }),
326
335
  )
327
336
  .plan((p, ctx) => {
@@ -329,7 +338,8 @@ export const enrollFirstDevice = directive("enrollFirstDevice")
329
338
  // evidence — the framework may; an author cannot). The kernel arm proves the principal is the IdP subject.
330
339
  const me = ctx.principal().asAuthoritySubject<string>("bootstrap my first device signer key from a verified IdP token");
331
340
  const rawPrincipal = endorsementOf(me)?.principal ?? "";
332
- return writeTuple({
341
+ // (1) seat the signer leaf (the RelationTuple — this directive's primary `.ensures`).
342
+ const tupleOps = writeTuple({
333
343
  object: signerObject(rawPrincipal),
334
344
  relation: SIGNER_RELATION,
335
345
  subject: "key:" + p.keyHash,
@@ -338,6 +348,20 @@ export const enrollFirstDevice = directive("enrollFirstDevice")
338
348
  verifiedVia: p.verifiedVia,
339
349
  validFromEpoch: p.validFromEpoch,
340
350
  });
351
+ // (2) fold the KEYLESS delegation cert as the user's `SignerDelegation` singleton (a SECONDARY ensures,
352
+ // per-op marked — the id is deterministic-by-user, an upsert). This is the seed `birthHome` reads to
353
+ // assemble the warranted chain; without it the home is born headless (co2's block).
354
+ // The delegation is keyed by the AUTHENTICATED principal — EXACTLY the `founder` the kernel's birth
355
+ // offer-effect reads it back by (`read_signer_delegation(state, &founder)`, founder == captured principal
356
+ // == this `rawPrincipal`, already in `user:<uid>` form). Do NOT re-prefix.
357
+ const d = instance(SignerDelegation, signerDelegationInstanceId(rawPrincipal));
358
+ const delegationOps: PlannedOp[] = [
359
+ withMarker(set(d, "user", rawPrincipal), "ensures"),
360
+ withMarker(set(d, "deviceKey", "key:" + p.keyHash), "ensures"),
361
+ withMarker(set(d, "certJson", p.delegationCert), "ensures"),
362
+ withMarker(set(d, "enrolledAt", p.grantedAt), "ensures"),
363
+ ];
364
+ return [...tupleOps, ...delegationOps];
341
365
  })
342
366
  // THE KEYLESS GATE DECLARATION: the carried device-bound `idpToken` IS this directive's authorization
343
367
  // (re-verified against the workspace AuthProvider on every lane), not a pre-enrolled signer. This lowers