@real-life/trust-protocol 0.1.0 → 0.2.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.
Files changed (44) hide show
  1. package/README.md +19 -10
  2. package/dist/carrier-identity.d.ts +20 -0
  3. package/dist/carrier-identity.d.ts.map +1 -0
  4. package/dist/carrier-identity.js +115 -0
  5. package/dist/carrier-identity.js.map +1 -0
  6. package/dist/carrier.d.ts +157 -0
  7. package/dist/carrier.d.ts.map +1 -0
  8. package/dist/carrier.js +577 -0
  9. package/dist/carrier.js.map +1 -0
  10. package/dist/holder.d.ts +42 -0
  11. package/dist/holder.d.ts.map +1 -0
  12. package/dist/holder.js +92 -0
  13. package/dist/holder.js.map +1 -0
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +18 -7
  17. package/dist/index.js.map +1 -1
  18. package/dist/probe/acks.d.ts +27 -0
  19. package/dist/probe/acks.d.ts.map +1 -0
  20. package/dist/probe/acks.js +119 -0
  21. package/dist/probe/acks.js.map +1 -0
  22. package/dist/probe/continuity.d.ts +3 -82
  23. package/dist/probe/continuity.d.ts.map +1 -1
  24. package/dist/probe/continuity.js +627 -147
  25. package/dist/probe/continuity.js.map +1 -1
  26. package/dist/probe/trust.d.ts +114 -74
  27. package/dist/probe/trust.d.ts.map +1 -1
  28. package/dist/probe/trust.js +1090 -232
  29. package/dist/probe/trust.js.map +1 -1
  30. package/dist/probe.d.ts +1 -2
  31. package/dist/probe.d.ts.map +1 -1
  32. package/dist/probe.js +6 -8
  33. package/dist/probe.js.map +1 -1
  34. package/dist/schemas.js +22 -22
  35. package/dist/schemas.js.map +1 -1
  36. package/dist/visibility.d.ts +6 -0
  37. package/dist/visibility.d.ts.map +1 -0
  38. package/dist/visibility.js +30 -0
  39. package/dist/visibility.js.map +1 -0
  40. package/dist/wire.d.ts +575 -0
  41. package/dist/wire.d.ts.map +1 -0
  42. package/dist/wire.js +2 -0
  43. package/dist/wire.js.map +1 -0
  44. package/package.json +8 -3
package/README.md CHANGED
@@ -32,6 +32,10 @@ look in the code:
32
32
  | `identity` | Identity Layer | One root seed, every context derived — community anchor, pair anchor per relationship, member anchor per group. Contexts never link without their holder's deliberate act. |
33
33
  | `encounter` | Encounter Layer | The ceremony under fresh-always pair anchors: challenges, contact cards, the enactment binding both sides compute independently, encounter credentials. |
34
34
  | `delivery` | Delivery Contract | The sealed envelope, and the receive chain in its declared order — size bound *before* decryption, envelope form, decryption, parse and digest over the canonical form, completed-effect cache. |
35
+ | `carrier-identity` | Identity §7a | The carrier-relationship principal: one Ed25519 control key per (relationship × carrier), derived so that no computable relation to the relationship's other principals or its `rkid` exists — which is why registration must *prove* the binding instead of computing it. |
36
+ | `carrier` | Delivery §4.4 + §5a | The carrier side of the port as one transport-agnostic state machine: the five guarantees, the proof rule, the total binding lifecycle (unbound → live → closing → released), the verdict sets in their normative evaluation orders, wind-up and binding tombstones. The clock is injected. |
37
+ | `holder` | Delivery §5a + Identity §9.3 | The holder's half: proof construction for all four purposes, the closed verdict set, and the two-exchange recovery flow for a lost carrier entry. |
38
+ | `visibility` | Network Visibility 0.29 on Delivery 0.79 | The trust act (`anchor-mapping@2` + `grade-declaration@1`), the blinded star (`star@1`, 5.2a chunks), the admission layer and the 5.4 reconciliation automaton, §6a continuity (probe + mapping — chains instead of duplicates), and the deniable `delivery-ack/0.1`. Namespaced: `visibility.trust`, `.continuity`, `.acks`. Graduated from `/probe` on 04.09.2026 after a 39-round conformance loop. |
35
39
 
36
40
  Everything is re-exported from the package root; the table is a map, not an
37
41
  import instruction.
@@ -43,17 +47,19 @@ import { labeledContext, signCard, seal, sameDigest } from '@real-life/trust-pro
43
47
  ## Two entry points
44
48
 
45
49
  ```ts
46
- import { … } from '@real-life/trust-protocol' // wire-normative core
47
- import { introduce, trust, continuity, membership }
48
- from '@real-life/trust-protocol/probe' // draft — will change
50
+ import { …, visibility } from '@real-life/trust-protocol' // wire-normative core
51
+ const { trust, continuity, acks } = visibility // Network Visibility, graduated
52
+ import { introduce, membership }
53
+ from '@real-life/trust-protocol/probe' // draft — will change
49
54
  ```
50
55
 
51
56
  The **`/probe` subpath is deliberate.** Its modules exercise the converged
52
57
  *semantics* of their layers, but their transport shapes carry `@probe` and
53
- are **not wire-normative**: mediated introductions over a rendezvous drop,
54
- the explicit trust act with the blinded star, §6a continuity (chains
55
- instead of duplicates), and group membership (founding, VIC invite,
56
- admission, vouching). Experiment with them; do not treat their wire forms
58
+ are **not wire-normative**: mediated introductions over a rendezvous drop
59
+ and group membership (founding, VIC invite, admission, vouching). The
60
+ trust act, the blinded star, §6a continuity and the deniable ack **left
61
+ this subpath on 04.09.2026** — they are wire-normative now and live under
62
+ `visibility` at the package root. Experiment with the rest; do not treat its wire forms
57
63
  as an interoperability target. A subpath import is a decision someone has
58
64
  to make — nothing behind it can be reached by accident.
59
65
 
@@ -72,13 +78,16 @@ This package uses its own semver; the specification uses castings. Each
72
78
  release states, per module, whose **wire forms** it implements — and what
73
79
  it deliberately does not:
74
80
 
75
- | Module (0.1.x) | Casting | Implemented | Not in this package |
81
+ | Module (0.2.x) | Casting | Implemented | Not in this package |
76
82
  |---|---|---|---|
77
- | `identity` | Identity 0.50 | context derivation under the closed label registry (§6.1, unchanged since 0.13) with the ordered persona pipeline (§6.2, Unicode 15.0 pinned) | recovery derivation (§5.3), service identities (§7), carrier relationship (§7a), the label register and its state |
83
+ | `identity` | Identity 0.50 | context derivation under the closed label registry (§6.1, unchanged since 0.13) with the ordered persona pipeline (§6.2, Unicode 15.0 pinned) | recovery derivation (§5.3), service identities (§7), the label register and its state |
84
+ | `carrier-identity` | Identity 0.51 (§7a) | the carrier-relationship principal derivation, identifier validation | the register's generation state (held by the holder's store) |
85
+ | `carrier` + `holder` | Delivery 0.79 (§4.4, §5a) + Identity 0.51 (§9.3) | the port state machine, proofs for all four purposes, verdicts, recovery | transport adapters and their policies (a carrier's budgets enter through hooks) |
78
86
  | `encounter` | Encounter 0.29 — wire `0.25` (`rltp-card/0.25`, `encounter-scan@0.25`) | challenges, both card profiles, the enactment binding, encounter credentials | the ceremony state machine, acceptance rules, ack deadlines |
79
87
  | `delivery` | Delivery 0.64 | the sealed envelope (§5) and the generic receive stages 1–4 | the type-specific stages, residual bookkeeping, transport adapters |
80
88
  | `core`, `crypto` | cross-layer | canonical form, digest equality, timestamps, validator; primitives + `eddsa-jcs-2022` proof | — |
81
- | `/probe` | Network Visibility · Membership Tasks + Access | introductions, trust act + blinded star, §6a continuity, group membership — semantics of the running castings, transport shapes `@probe` | any wire-form stability whatsoever |
89
+ | `visibility` | Network Visibility 0.29 + Delivery 0.79 (§3, §4.2, §4.4) | the trust act (`anchor-mapping@2`, `grade-declaration@1`), `star@1` with 5.2a chunk assembly, the admission layer (Section 2), the 5.4 reconciliation automaton with completion via deniable acks, §6a continuity (`continuity-probe@1`, `continuity-mapping@1`, chaining), the registered task documents and `delivery-ack/0.1` with the 4.2 class rule; full §6.2 stage order on every receive path, peek→build→commit issuance on every producer | storage, transport adapters and their policies, the Encounter layer's ceremony flows (still `@probe`) |
90
+ | `/probe` | Network Visibility (introductions) · Membership Tasks + Access | mediated introductions, group membership — semantics of the running castings, transport shapes `@probe` | any wire-form stability whatsoever |
82
91
 
83
92
  Persona-name validation is **pinned to Unicode 15.0** as Identity §6.2
84
93
  requires: the repertoire ships with the package (`unicode15.ts`, ~5 kB of
@@ -0,0 +1,20 @@
1
+ import type { KeyPair } from './crypto.js';
2
+ export declare const CARRIER_INFO_PREFIX = "rltp/v1/carrier-relationship/ed25519/v1/";
3
+ export declare const CONNECTION_INFO_PREFIX = "rltp/v1/carrier-connection/ed25519/v1/";
4
+ export declare const EGRESS_INFO_PREFIX = "rltp/v1/carrier-egress/ed25519/v1/";
5
+ export declare function validCarrierIdentifier(c: unknown): c is string;
6
+ export interface CarrierPrincipal {
7
+ principal: string;
8
+ key: KeyPair;
9
+ info: string;
10
+ keyAgreement: null;
11
+ }
12
+ export declare function carrierPrincipal(rootIkm: Uint8Array, carrier: string, nonce: Uint8Array): Promise<CarrierPrincipal>;
13
+ export interface CarrierScopedIdentity {
14
+ did: string;
15
+ key: KeyPair;
16
+ info: string;
17
+ scope: 'connection' | 'egress';
18
+ }
19
+ export declare function carrierScopedIdentity(rootIkm: Uint8Array, carrier: string, nonce: Uint8Array, scope: 'connection' | 'egress'): Promise<CarrierScopedIdentity>;
20
+ //# sourceMappingURL=carrier-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carrier-identity.d.ts","sourceRoot":"","sources":["../src/carrier-identity.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAK1C,eAAO,MAAM,mBAAmB,6CAA6C,CAAA;AAS7E,eAAO,MAAM,sBAAsB,2CAA2C,CAAA;AAC9E,eAAO,MAAM,kBAAkB,uCAAuC,CAAA;AA4BtE,wBAAgB,sBAAsB,CAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAmB/D;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,IAAI,CAAA;CACnB;AAKD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GACtD,OAAO,CAAC,gBAAgB,CAAC,CAY3B;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,YAAY,GAAG,QAAQ,CAAA;CAC/B;AAKD,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EACvD,KAAK,EAAE,YAAY,GAAG,QAAQ,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAUhC"}
@@ -0,0 +1,115 @@
1
+ // carrier-identity — Identity §7a: the carrier-relationship identity class.
2
+ //
3
+ // One control principal per (relationship × carrier), Ed25519-only. The
4
+ // derivation shares no computable relation with the relationship's other
5
+ // principals or with its `rkid` — that absence is the privacy property
6
+ // the whole class exists for (§7a.5), and it is why registration must
7
+ // PROVE the binding instead of computing it (Delivery §5a.3).
8
+ //
9
+ // info = "rltp/v1/carrier-relationship/ed25519/v1/" || Dc || Dn
10
+ // where Dc = multihash(sha2-256, UTF-8 of the configured carrier
11
+ // identifier C) and Dn = multihash(sha2-256, 32-byte carrier nonce N),
12
+ // each rendered as 'u' + base64url — exactly 47 characters, so the two
13
+ // parts are length-fixed and no concatenation ambiguity exists (§7a.4).
14
+ //
15
+ // NO key-agreement key is derived for this class: sealing stays at the
16
+ // `rkid` (§7a.1), and a carrier that never holds a decryption key can
17
+ // never be asked to use one.
18
+ import { b64uOf, cat } from './crypto.js';
19
+ import { sha, hkdf, edFromSeed, anchorOfEd } from './crypto.js';
20
+ import { WHITE_SPACE_15 } from './unicode15.js';
21
+ const te = new TextEncoder();
22
+ export const CARRIER_INFO_PREFIX = 'rltp/v1/carrier-relationship/ed25519/v1/';
23
+ // Adapter-scoped identities (profile spec/adapter-vti-mediator.md,
24
+ // Delivery §5a.10): the mediation connection DID and the sender-side
25
+ // egress identity. Both derive from the same root as the control
26
+ // principal but under distinct info prefixes — each is derivable from
27
+ // the root, none from any other. That is exactly the §5a.10 sentence
28
+ // "never a control principal or derivable from one", satisfied by
29
+ // construction: without rootIkm no party can compute one from another.
30
+ export const CONNECTION_INFO_PREFIX = 'rltp/v1/carrier-connection/ed25519/v1/';
31
+ export const EGRESS_INFO_PREFIX = 'rltp/v1/carrier-egress/ed25519/v1/';
32
+ // multihash(sha2-256) in base64url — the digest form Identity §7a.4 fixes
33
+ const mh = async (bytes) => 'u' + b64uOf(cat(Uint8Array.from([0x12, 0x20]), await sha(bytes)));
34
+ // Identity §7a.2 — the ordered validation pipeline for C, fail closed
35
+ // and NO normalization (the deliberate difference to §6.2): valid
36
+ // Unicode scalar values only (unpaired surrogates never repaired),
37
+ // 1..1024 UTF-8 BYTES, and no Cc, Cf or White_Space code point anywhere.
38
+ //
39
+ // The category tables are PINNED to Unicode 15.0 (port-review-2 M-6):
40
+ // evaluating against the platform's \p{...} data would let the same
41
+ // identifier derive a principal on one runtime and be rejected on
42
+ // another the moment a Unicode revision moves a code point — the exact
43
+ // defect the persona repertoire (unicode15.ts) already closed for §6.2.
44
+ // Cc is the stable C0/C1 block; Cf is the 170-code-point Unicode-15.0
45
+ // set, enumerated below; White_Space is unicode15.ts's pinned set.
46
+ const CC_15 = (cp) => cp <= 0x1f || (cp >= 0x7f && cp <= 0x9f);
47
+ const CF_15_RANGES = [
48
+ [0x00ad, 0x00ad], [0x0600, 0x0605], [0x061c, 0x061c], [0x06dd, 0x06dd],
49
+ [0x070f, 0x070f], [0x0890, 0x0891], [0x08e2, 0x08e2], [0x180e, 0x180e],
50
+ [0x200b, 0x200f], [0x202a, 0x202e], [0x2060, 0x2064], [0x2066, 0x206f],
51
+ [0xfeff, 0xfeff], [0xfff9, 0xfffb], [0x110bd, 0x110bd], [0x110cd, 0x110cd],
52
+ [0x13430, 0x1343f], [0x1bca0, 0x1bca3], [0x1d173, 0x1d17a],
53
+ [0xe0001, 0xe0001], [0xe0020, 0xe007f],
54
+ ];
55
+ const CF_15 = (cp) => CF_15_RANGES.some(([a, b]) => cp >= a && cp <= b);
56
+ export function validCarrierIdentifier(c) {
57
+ if (typeof c !== 'string' || c.length === 0)
58
+ return false;
59
+ // scalar values: an unpaired surrogate is not a Unicode string
60
+ for (let i = 0; i < c.length; i++) {
61
+ const u = c.charCodeAt(i);
62
+ if (u >= 0xdc00 && u <= 0xdfff)
63
+ return false; // lone low
64
+ if (u >= 0xd800 && u <= 0xdbff) {
65
+ const nxt = c.charCodeAt(i + 1);
66
+ if (!(nxt >= 0xdc00 && nxt <= 0xdfff))
67
+ return false; // lone high
68
+ i++;
69
+ }
70
+ }
71
+ const bytes = new TextEncoder().encode(c);
72
+ if (bytes.length < 1 || bytes.length > 1024)
73
+ return false;
74
+ for (const ch of c) {
75
+ const cp = ch.codePointAt(0);
76
+ if (CC_15(cp) || CF_15(cp) || WHITE_SPACE_15.has(cp))
77
+ return false;
78
+ }
79
+ return true;
80
+ }
81
+ // Identity §7a.4 — derive the control principal for one relationship at
82
+ // one carrier. `carrier` is C exactly as configured (byte-exact), `nonce`
83
+ // is the relationship's 32-byte carrier nonce N from the register (§7a.3).
84
+ export async function carrierPrincipal(rootIkm, carrier, nonce) {
85
+ if (!validCarrierIdentifier(carrier))
86
+ throw new Error('invalid carrier identifier (7a.2)');
87
+ if (nonce.length !== 32)
88
+ throw new Error('carrier nonce must be 32 bytes (7a.3)');
89
+ // M-3: the derivation reads its inputs at entry, once. Caller-held
90
+ // buffers can be mutated while the HKDF awaits; copies make the
91
+ // derived principal a function of the arguments as passed.
92
+ const ikm = rootIkm.slice();
93
+ const n = nonce.slice();
94
+ const info = CARRIER_INFO_PREFIX + await mh(te.encode(carrier)) + await mh(n);
95
+ const seed = await hkdf(ikm, info);
96
+ const key = await edFromSeed(seed);
97
+ return { principal: anchorOfEd(key.pubRaw), key, info, keyAgreement: null };
98
+ }
99
+ // One connection DID / one egress identity per (relationship × carrier),
100
+ // same derivation discipline and same input rules as the principal
101
+ // (§7a.4), distinct prefix. Retired with the principal, never reused.
102
+ export async function carrierScopedIdentity(rootIkm, carrier, nonce, scope) {
103
+ if (!validCarrierIdentifier(carrier))
104
+ throw new Error('invalid carrier identifier (7a.2)');
105
+ if (nonce.length !== 32)
106
+ throw new Error('carrier nonce must be 32 bytes (7a.3)');
107
+ const ikm = rootIkm.slice();
108
+ const n = nonce.slice();
109
+ const prefix = scope === 'connection' ? CONNECTION_INFO_PREFIX : EGRESS_INFO_PREFIX;
110
+ const info = prefix + await mh(te.encode(carrier)) + await mh(n);
111
+ const seed = await hkdf(ikm, info);
112
+ const key = await edFromSeed(seed);
113
+ return { did: anchorOfEd(key.pubRaw), key, info, scope };
114
+ }
115
+ //# sourceMappingURL=carrier-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carrier-identity.js","sourceRoot":"","sources":["../src/carrier-identity.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;AACvE,sEAAsE;AACtE,8DAA8D;AAC9D,EAAE;AACF,gEAAgE;AAChE,iEAAiE;AACjE,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,6BAA6B;AAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,MAAM,EAAE,GAAG,IAAI,WAAW,EAAE,CAAA;AAE5B,MAAM,CAAC,MAAM,mBAAmB,GAAG,0CAA0C,CAAA;AAE7E,mEAAmE;AACnE,qEAAqE;AACrE,iEAAiE;AACjE,sEAAsE;AACtE,qEAAqE;AACrE,kEAAkE;AAClE,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,wCAAwC,CAAA;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,oCAAoC,CAAA;AAEtE,0EAA0E;AAC1E,MAAM,EAAE,GAAG,KAAK,EAAE,KAAiB,EAAmB,EAAE,CACtD,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAEpE,sEAAsE;AACtE,kEAAkE;AAClE,mEAAmE;AACnE,yE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AM,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAA;IACvB,MAAM,MAAM,GAAG,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,kBAAkB,CAAA;IACnF,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;IAChE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAClC,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAA;IAClC,OAAO,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;AAC1D,CAAC","sourcesContent":["// carrier-identity — Identity §7a: the carrier-relationship identity class.\n//\n// One control principal per (relationship × carrier), Ed25519-only. The\n// derivation shares no computable relation with the relationship's other\n// principals or with its `rkid` — that absence is the privacy property\n// the whole class exists for (§7a.5), and it is why registration must\n// PROVE the binding instead of computing it (Delivery §5a.3).\n//\n// info = \"rltp/v1/carrier-relationship/ed25519/v1/\" || Dc || Dn\n// where Dc = multihash(sha2-256, UTF-8 of the configured carrier\n// identifier C) and Dn = multihash(sha2-256, 32-byte carrier nonce N),\n// each rendered as 'u' + base64url — exactly 47 characters, so the two\n// parts are length-fixed and no concatenation ambiguity exists (§7a.4).\n//\n// NO key-agreement key is derived for this class: sealing stays at the\n// `rkid` (§7a.1), and a carrier that never holds a decryption key can\n// never be asked to use one.\nimport { b64uOf, cat } from './crypto.js'\nimport { sha, hkdf, edFromSeed, anchorOfEd } from './crypto.js'\nimport type { KeyPair } from './crypto.js'\nimport { WHITE_SPACE_15 } from './unicode15.js'\n\nconst te = new TextEncoder()\n\nexport const CARRIER_INFO_PREFIX = 'rltp/v1/carrier-relationship/ed25519/v1/'\n\n// Adapter-scoped identities (profile spec/adapter-vti-mediator.md,\n// Delivery §5a.10): the mediation connection DID and the sender-side\n// egress identity. Both derive from the same root as the control\n// principal but under distinct info prefixes — each is derivable from\n// the root, none from any other. That is exactly the §5a.10 sentence\n// \"never a control principal or derivable from one\", satisfied by\n// construction: without rootIkm no party can compute one from another.\nexport const CONNECTION_INFO_PREFIX = 'rltp/v1/carrier-connection/ed25519/v1/'\nexport const EGRESS_INFO_PREFIX = 'rltp/v1/carrier-egress/ed25519/v1/'\n\n// multihash(sha2-256) in base64url — the digest form Identity §7a.4 fixes\nconst mh = async (bytes: Uint8Array): Promise<string> =>\n 'u' + b64uOf(cat(Uint8Array.from([0x12, 0x20]), await sha(bytes)))\n\n// Identity §7a.2 — the ordered validation pipeline for C, fail closed\n// and NO normalization (the deliberate difference to §6.2): valid\n// Unicode scalar values only (unpaired surrogates never repaired),\n// 1..1024 UTF-8 BYTES, and no Cc, Cf or White_Space code point anywhere.\n//\n// The category tables are PINNED to Unicode 15.0 (port-review-2 M-6):\n// evaluating against the platform's \\p{...} data would let the same\n// identifier derive a principal on one runtime and be rejected on\n// another the moment a Unicode revision moves a code point — the exact\n// defect the persona repertoire (unicode15.ts) already closed for §6.2.\n// Cc is the stable C0/C1 block; Cf is the 170-code-point Unicode-15.0\n// set, enumerated below; White_Space is unicode15.ts's pinned set.\nconst CC_15 = (cp: number): boolean => cp <= 0x1f || (cp >= 0x7f && cp <= 0x9f)\nconst CF_15_RANGES: Array<[number, number]> = [\n [0x00ad, 0x00ad], [0x0600, 0x0605], [0x061c, 0x061c], [0x06dd, 0x06dd],\n [0x070f, 0x070f], [0x0890, 0x0891], [0x08e2, 0x08e2], [0x180e, 0x180e],\n [0x200b, 0x200f], [0x202a, 0x202e], [0x2060, 0x2064], [0x2066, 0x206f],\n [0xfeff, 0xfeff], [0xfff9, 0xfffb], [0x110bd, 0x110bd], [0x110cd, 0x110cd],\n [0x13430, 0x1343f], [0x1bca0, 0x1bca3], [0x1d173, 0x1d17a],\n [0xe0001, 0xe0001], [0xe0020, 0xe007f],\n]\nconst CF_15 = (cp: number): boolean => CF_15_RANGES.some(([a, b]) => cp >= a && cp <= b)\nexport function validCarrierIdentifier (c: unknown): c is string {\n if (typeof c !== 'string' || c.length === 0) return false\n // scalar values: an unpaired surrogate is not a Unicode string\n for (let i = 0; i < c.length; i++) {\n const u = c.charCodeAt(i)\n if (u >= 0xdc00 && u <= 0xdfff) return false // lone low\n if (u >= 0xd800 && u <= 0xdbff) {\n const nxt = c.charCodeAt(i + 1)\n if (!(nxt >= 0xdc00 && nxt <= 0xdfff)) return false // lone high\n i++\n }\n }\n const bytes = new TextEncoder().encode(c)\n if (bytes.length < 1 || bytes.length > 1024) return false\n for (const ch of c) {\n const cp = ch.codePointAt(0)!\n if (CC_15(cp) || CF_15(cp) || WHITE_SPACE_15.has(cp)) return false\n }\n return true\n}\n\nexport interface CarrierPrincipal {\n principal: string // did:key:z6Mk…, the control principal\n key: KeyPair // its Ed25519 pair (for the proofs of §5a.3)\n info: string // the derivation info, for auditability\n keyAgreement: null // declared, not omitted: Ed25519-only (§7a.1)\n}\n\n// Identity §7a.4 — derive the control principal for one relationship at\n// one carrier. `carrier` is C exactly as configured (byte-exact), `nonce`\n// is the relationship's 32-byte carrier nonce N from the register (§7a.3).\nexport async function carrierPrincipal (\n rootIkm: Uint8Array, carrier: string, nonce: Uint8Array,\n): Promise<CarrierPrincipal> {\n if (!validCarrierIdentifier(carrier)) throw new Error('invalid carrier identifier (7a.2)')\n if (nonce.length !== 32) throw new Error('carrier nonce must be 32 bytes (7a.3)')\n // M-3: the derivation reads its inputs at entry, once. Caller-held\n // buffers can be mutated while the HKDF awaits; copies make the\n // derived principal a function of the arguments as passed.\n const ikm = rootIkm.slice()\n const n = nonce.slice()\n const info = CARRIER_INFO_PREFIX + await mh(te.encode(carrier)) + await mh(n)\n const seed = await hkdf(ikm, info)\n const key = await edFromSeed(seed)\n return { principal: anchorOfEd(key.pubRaw), key, info, keyAgreement: null }\n}\n\nexport interface CarrierScopedIdentity {\n did: string // did:key:z6Mk…\n key: KeyPair\n info: string\n scope: 'connection' | 'egress'\n}\n\n// One connection DID / one egress identity per (relationship × carrier),\n// same derivation discipline and same input rules as the principal\n// (§7a.4), distinct prefix. Retired with the principal, never reused.\nexport async function carrierScopedIdentity (\n rootIkm: Uint8Array, carrier: string, nonce: Uint8Array,\n scope: 'connection' | 'egress',\n): Promise<CarrierScopedIdentity> {\n if (!validCarrierIdentifier(carrier)) throw new Error('invalid carrier identifier (7a.2)')\n if (nonce.length !== 32) throw new Error('carrier nonce must be 32 bytes (7a.3)')\n const ikm = rootIkm.slice()\n const n = nonce.slice()\n const prefix = scope === 'connection' ? CONNECTION_INFO_PREFIX : EGRESS_INFO_PREFIX\n const info = prefix + await mh(te.encode(carrier)) + await mh(n)\n const seed = await hkdf(ikm, info)\n const key = await edFromSeed(seed)\n return { did: anchorOfEd(key.pubRaw), key, info, scope }\n}\n"]}
@@ -0,0 +1,157 @@
1
+ export interface CarrierDeclaration {
2
+ carrier: string;
3
+ orphanHorizonMs: number;
4
+ giveUpHorizonMs: number;
5
+ challengeLifetimeMs: number;
6
+ queueFloorBytes: number;
7
+ maxQueueBytes: number;
8
+ maxBindingTombstones: number;
9
+ statusHorizonMs: number;
10
+ }
11
+ /** §11: an out-of-domain declaration REJECTS — it never half-applies. */
12
+ export declare function validateDeclaration(d: CarrierDeclaration): string[];
13
+ export declare const CARRIER_ROLE_URI = "https://real-life.org/trust-tasks/delivery-carrier/0.1";
14
+ export declare const PROOF_V = "rltp-carrier-proof/0.3";
15
+ export interface CarrierPolicy {
16
+ /** shared admission gate — the one unknown-address traffic competes
17
+ * for. NEVER invoked for a request naming a held binding. */
18
+ admitNew?: () => boolean;
19
+ /** per-binding gate for requests naming a HELD rkid (guarantee 4). */
20
+ admitHeld?: (rkid: string) => boolean;
21
+ /** per-queue submission meter — the only resource hook reachable below
22
+ * the floor (guarantee 5); DO-6 lives here. A duplicate charges it
23
+ * like an admitted submission (§5a.5) and stores nothing. */
24
+ meterQueue?: (rkid: string, bytes: number) => boolean;
25
+ /** global occupancy — s6, unreachable below the floor. */
26
+ hasCapacity?: (bytes: number) => boolean;
27
+ /** room for one more binding — r4, never consulted for a held one. */
28
+ hasBindingRoom?: () => boolean;
29
+ }
30
+ export type RegistrationVerdict = {
31
+ verdict: 'registered' | 'registered(idempotent)' | 'rebound';
32
+ } | {
33
+ verdict: 'refused(malformed)' | 'refused(possession-failed)';
34
+ } | {
35
+ verdict: 'refused(stale-generation)';
36
+ heldGeneration: number;
37
+ } | {
38
+ verdict: 'registration-refused(capacity)' | 'refused(admission-resource)';
39
+ retriable: true;
40
+ };
41
+ export type SessionVerdict = {
42
+ verdict: 'served';
43
+ } | {
44
+ verdict: 'refused(no-such-queue)' | 'refused(malformed)' | 'refused(possession-failed)';
45
+ } | {
46
+ verdict: 'refused(admission-resource)';
47
+ retriable: true;
48
+ };
49
+ export type SubmissionVerdict = {
50
+ verdict: 'admitted' | 'duplicate';
51
+ } | {
52
+ verdict: 'refused(no-such-queue)' | 'refused(bounds)';
53
+ } | {
54
+ verdict: 'refused(admission-resource)' | 'refused(queue-saturated)' | 'refused(capacity)';
55
+ retriable: true;
56
+ };
57
+ export interface CarrierProof {
58
+ v: string;
59
+ type: string;
60
+ purpose: 'register' | 'rebind' | 'collect' | 'conclude';
61
+ carrier: string;
62
+ principal: string;
63
+ rkid: string;
64
+ generation?: number;
65
+ principalChallenge: string;
66
+ addressChallenge?: string;
67
+ sig: string;
68
+ }
69
+ export declare const canonicalGenerationSpelling: (raw: string) => boolean;
70
+ /** r1, the SYNTACTIC half only — no cryptography happens here, so a
71
+ * request refused at r1 or r2 has cost the carrier no key operation
72
+ * (guarantee 3). `rawGeneration` is REQUIRED for register/rebind: a
73
+ * parsed number cannot carry its own spelling, and an adapter that
74
+ * cannot supply the received bytes cannot claim the check (round-44
75
+ * M-4 of the port review: optional was fail-open). */
76
+ export declare function checkProofShape(p: CarrierProof, expectedCarrier: string, rawGeneration?: string): 'refused(malformed)' | null;
77
+ /** compatibility shim for the shape+signature question alone (tests,
78
+ * tooling): stateless, no challenge semantics. */
79
+ export declare function verifyProofShape(p: CarrierProof, expectedCarrier: string, rawGeneration?: string): Promise<'refused(malformed)' | 'refused(possession-failed)' | null>;
80
+ export declare function checkEnvelopeBytes(bytes: Uint8Array, rkid: string): boolean;
81
+ export interface CarrierEvents {
82
+ onRelease?: (rkid: string, tombstoneGeneration: number) => void;
83
+ onGiveUp?: (rkid: string, digest: string) => void;
84
+ onEvict?: (rkid: string) => void;
85
+ }
86
+ export declare class Carrier {
87
+ #private;
88
+ /** the declaration as published — a copy; mutating it changes nothing
89
+ * (port-review-2 M-3: the validated state must not be reachable from
90
+ * outside the validated paths). */
91
+ get decl(): CarrierDeclaration;
92
+ private policy;
93
+ private events;
94
+ private bindings;
95
+ private tombstones;
96
+ private releaseSeq;
97
+ private challenges;
98
+ private clock;
99
+ constructor(decl: CarrierDeclaration, policy?: CarrierPolicy, events?: CarrierEvents);
100
+ private advance;
101
+ tick(now: number): void;
102
+ /** The gated challenge entry — guarantee 3 BY CONSTRUCTION
103
+ * (port-review-3 M-3): the admission gate runs INSIDE, before any
104
+ * entropy is drawn, so a refused request costs neither randomness nor
105
+ * sealing. `draw` is invoked only past the gate; its `addressValue`
106
+ * (for registration challenges) is the value the adapter will seal to
107
+ * the rkid — the carrier remembers it and a proof must return exactly
108
+ * it. Every challenge is BOUND to its rkid (port-review-3 B-1: a
109
+ * null-rkid challenge disabled the address proof).
110
+ * Returns null when the gate refuses — retriable, guarantee 2. */
111
+ issueChallenge(now: number, rkid: string, draw: () => {
112
+ entropy: Uint8Array;
113
+ addressValue?: string;
114
+ }): string | null;
115
+ /** consume-first (§5a.3): the first attempt takes the challenge before
116
+ * anything is verified; expiry and rkid binding are checked HERE, so a
117
+ * stale or transplanted challenge dies without buying a verification. */
118
+ private consume;
119
+ register(proof: CarrierProof, opts: {
120
+ now: number;
121
+ rawGeneration: string;
122
+ }): Promise<RegistrationVerdict>;
123
+ private freshBinding;
124
+ private reopen;
125
+ collect(proof: CarrierProof, opts: {
126
+ now: number;
127
+ }): Promise<SessionVerdict & {
128
+ deposits?: Array<{
129
+ bytes: Uint8Array;
130
+ digest: string;
131
+ }>;
132
+ }>;
133
+ conclude(proof: CarrierProof, digest: string, opts: {
134
+ now: number;
135
+ }): Promise<SessionVerdict>;
136
+ private session;
137
+ submit(rkid: string, callerBytes: Uint8Array, opts: {
138
+ now: number;
139
+ }): Promise<SubmissionVerdict>;
140
+ private pendingSeqInstant;
141
+ private installTombstone;
142
+ private trimTombstones;
143
+ /** guarantee 1: the declaration binds, and a revision is itself
144
+ * validated; a lowered tombstone bound trims in the same step
145
+ * (round-45 B-3 — standing state is not a running act). */
146
+ reviseDeclaration(next: Partial<CarrierDeclaration>): void;
147
+ stateOf(rkid: string): 'unbound' | 'live' | 'closing' | 'released';
148
+ tombstoneOf(rkid: string): number | null;
149
+ bindingOf(rkid: string): {
150
+ generation: number;
151
+ principal: string;
152
+ deposits: number;
153
+ deadline?: number;
154
+ } | null;
155
+ tombstoneLabels(): string[];
156
+ }
157
+ //# sourceMappingURL=carrier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"carrier.d.ts","sourceRoot":"","sources":["../src/carrier.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAA;CACxB;AAYD,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAE,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAapE;AAID,eAAO,MAAM,gBAAgB,2DAA2D,CAAA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