p2party 0.14.2 → 0.14.7

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 (126) hide show
  1. package/README.md +230 -30
  2. package/docs/getting-started.md +15 -0
  3. package/docs/protocol-v4-security.md +40 -0
  4. package/docs/references.md +28 -8
  5. package/docs/session-api.md +10 -2
  6. package/lib/api/signalingServerApi.d.ts +13 -2
  7. package/lib/api/webrtc/applyIceConfiguration.d.ts +9 -0
  8. package/lib/api/webrtc/dataChannelHandler.d.ts +10 -0
  9. package/lib/api/webrtc/deleteRoomData.d.ts +13 -0
  10. package/lib/api/webrtc/disconnectFromAllRoomsQuery.d.ts +2 -1
  11. package/lib/api/webrtc/disconnectFromRoomQuery.d.ts +2 -1
  12. package/lib/api/webrtc/disconnectQuery.d.ts +2 -1
  13. package/lib/api/webrtc/iceRepair.d.ts +3 -1
  14. package/lib/api/webrtc/index.d.ts +2 -1
  15. package/lib/api/webrtc/interfaces.d.ts +37 -0
  16. package/lib/api/webrtc/negotiationLock.d.ts +24 -0
  17. package/lib/api/webrtc/pendingOffer.d.ts +29 -0
  18. package/lib/api/webrtc/rebindDeadline.d.ts +61 -0
  19. package/lib/api/webrtc/remoteTransportChange.d.ts +142 -0
  20. package/lib/api/webrtc/retiredRemoteTransports.d.ts +70 -0
  21. package/lib/api/webrtc/roomEdgeBudget.d.ts +10 -0
  22. package/lib/api/webrtc/setDescriptionQuery.d.ts +8 -1
  23. package/lib/api/webrtc/settleOnClose.d.ts +36 -0
  24. package/lib/blindRendezvous/admissionInput.d.ts +11 -0
  25. package/lib/blindRendezvous/admissionPolicy.d.ts +217 -0
  26. package/lib/blindRendezvous/canonicalSchema.d.ts +139 -0
  27. package/lib/blindRendezvous/carrierEnvelope.d.ts +105 -0
  28. package/lib/blindRendezvous/coreReduce.d.ts +199 -0
  29. package/lib/blindRendezvous/derivations.d.ts +381 -0
  30. package/lib/blindRendezvous/identityHelloAdmission.d.ts +89 -0
  31. package/lib/blindRendezvous/identityHelloAdmissionPersistence.d.ts +133 -0
  32. package/lib/blindRendezvous/identityHelloHistoricalEvidence.d.ts +52 -0
  33. package/lib/blindRendezvous/identityHelloOpen.d.ts +167 -0
  34. package/lib/blindRendezvous/identityHelloTrial.d.ts +271 -0
  35. package/lib/blindRendezvous/localAdmissibleProject.d.ts +101 -0
  36. package/lib/blindRendezvous/localPresenceKeyBinding.d.ts +108 -0
  37. package/lib/blindRendezvous/localStableIdentityCustody.d.ts +46 -0
  38. package/lib/blindRendezvous/normativeKernel.d.ts +222 -0
  39. package/lib/blindRendezvous/operation.d.ts +137 -0
  40. package/lib/blindRendezvous/operationPayload.d.ts +134 -0
  41. package/lib/blindRendezvous/pairBootstrapSuite.d.ts +93 -0
  42. package/lib/blindRendezvous/pairCrypto.d.ts +122 -0
  43. package/lib/blindRendezvous/pairLedger.d.ts +154 -0
  44. package/lib/blindRendezvous/pairOpenBudget.d.ts +67 -0
  45. package/lib/blindRendezvous/pairOpenReservation.d.ts +157 -0
  46. package/lib/blindRendezvous/pairPlaintext.d.ts +240 -0
  47. package/lib/blindRendezvous/pairStepEnvelope.d.ts +60 -0
  48. package/lib/blindRendezvous/plannerState.d.ts +61 -0
  49. package/lib/blindRendezvous/projections.d.ts +71 -0
  50. package/lib/blindRendezvous/publicWindow.d.ts +330 -0
  51. package/lib/blindRendezvous/retainedOperationStore.d.ts +187 -0
  52. package/lib/blindRendezvous/roomInviteV2.d.ts +92 -0
  53. package/lib/blindRendezvous/roomPolicyV4.d.ts +90 -0
  54. package/lib/blindRendezvous/schemas.d.ts +221 -0
  55. package/lib/blindRendezvous/storeDescriptor.d.ts +160 -0
  56. package/lib/cryptography/aeadWasm.d.ts +18 -0
  57. package/lib/cryptography/byteInput.d.ts +12 -0
  58. package/lib/cryptography/carrierAead.d.ts +23 -0
  59. package/lib/cryptography/chacha20poly1305.d.ts +7 -0
  60. package/lib/cryptography/fips202.d.ts +10 -0
  61. package/lib/cryptography/hpke.d.ts +84 -0
  62. package/lib/cryptography/hpkeSuite.d.ts +39 -0
  63. package/lib/cryptography/hybridKem.d.ts +42 -0
  64. package/lib/cryptography/hybridKemSuite.d.ts +22 -0
  65. package/lib/cryptography/interfaces.d.ts +3 -0
  66. package/lib/cryptography/mlkem.d.ts +27 -1
  67. package/lib/cryptography/mnemonic.d.ts +65 -1
  68. package/lib/cryptography/ownedEd25519KeyMaterial.d.ts +27 -0
  69. package/lib/cryptography/webCryptoSha256.d.ts +20 -0
  70. package/lib/cryptography/x25519.d.ts +18 -0
  71. package/lib/cryptography/xchacha20poly1305.d.ts +7 -0
  72. package/lib/db/api.d.ts +6 -3
  73. package/lib/db/identityEd25519ClientBoundary.d.ts +13 -0
  74. package/lib/db/src/getDB.d.ts +2 -2
  75. package/lib/db/types.d.ts +52 -4
  76. package/lib/db.worker.js +1 -1
  77. package/lib/handlers/coverChannelRegistry.d.ts +22 -0
  78. package/lib/handlers/edgeTeardownFollowUp.d.ts +35 -0
  79. package/lib/handlers/handleChallenge.d.ts +2 -1
  80. package/lib/handlers/handleConnectToPeer.d.ts +1 -1
  81. package/lib/handlers/handleHandshake.d.ts +2 -6
  82. package/lib/handlers/handleSendMessage.d.ts +60 -7
  83. package/lib/handlers/handleWebSocketMessage.d.ts +1 -1
  84. package/lib/handlers/handshakeCore.d.ts +2 -7
  85. package/lib/handlers/handshakeFrame.d.ts +25 -0
  86. package/lib/handlers/ratchetGateWait.d.ts +13 -0
  87. package/lib/handlers/reconcile.d.ts +24 -0
  88. package/lib/handlers/requestRoom.d.ts +30 -0
  89. package/lib/handlers/roomResponse.d.ts +53 -0
  90. package/lib/index.d.ts +99 -12
  91. package/lib/index.js +1 -1
  92. package/lib/index.min.js +1 -1
  93. package/lib/index.mjs +1 -1
  94. package/lib/libcrypto.provenance.json +5 -5
  95. package/lib/libcrypto.wasm +0 -0
  96. package/lib/middleware/roomListenerMiddleware.d.ts +4 -1
  97. package/lib/reducers/commonSlice.d.ts +3 -2
  98. package/lib/reducers/keyPairSlice.d.ts +3 -6
  99. package/lib/reducers/roomSlice.d.ts +81 -5
  100. package/lib/reducers/signalingServerSlice.d.ts +3 -2
  101. package/lib/session.d.ts +6 -3
  102. package/lib/session.js +1 -1
  103. package/lib/session.mjs +1 -1
  104. package/lib/store.d.ts +4 -2
  105. package/lib/utils/constants.d.ts +12 -0
  106. package/lib/utils/correlationId.d.ts +4 -0
  107. package/lib/utils/identityRestore.d.ts +108 -0
  108. package/lib/utils/interfaces.d.ts +25 -6
  109. package/lib/utils/roomConnectAdmission.d.ts +15 -0
  110. package/lib/utils/roomLeaveCoordinator.d.ts +38 -0
  111. package/lib/utils/roomRequestCoordinator.d.ts +104 -0
  112. package/lib/utils/roomRosterReconciler.d.ts +83 -0
  113. package/lib/utils/sdpFingerprint.d.ts +6 -0
  114. package/lib/utils/signalingAttemptLifecycle.d.ts +33 -0
  115. package/lib/utils/signalingAuth.d.ts +21 -2
  116. package/lib/utils/signalingBounds.d.ts +6 -0
  117. package/lib/utils/signalingFrame.d.ts +21 -0
  118. package/lib/utils/signalingHeartbeatWatchdog.d.ts +45 -0
  119. package/lib/utils/signalingIngressQueue.d.ts +49 -0
  120. package/lib/utils/signalingPeerRequestDebouncer.d.ts +13 -0
  121. package/lib/utils/signalingRoomLifecycle.d.ts +7 -0
  122. package/lib/utils/signalingRoomOperationLifecycle.d.ts +14 -0
  123. package/lib/utils/signalingServerBoundary.d.ts +11 -0
  124. package/lib/utils/terminalSettlement.d.ts +53 -0
  125. package/lib/utils/transportIdentity.d.ts +5 -0
  126. package/package.json +1 -1
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Canonical pair-private plaintext codec (Sections 4.11–4.13).
3
+ *
4
+ * This module begins only after pair AEAD has authenticated a candidate. It
5
+ * owns the closed body union, initial direction/sequence/predecessor shapes,
6
+ * candidate-ID ordering, and the unique class-sized all-zero padding suffix.
7
+ * Pair secrets, HPKE, AEAD, admission, exact predecessor IDs, and durable fork
8
+ * state deliberately remain outside this codec.
9
+ *
10
+ * Status: PROPOSED, NOT FROZEN. Release use still requires the Phase-0
11
+ * canonical vectors and registry freeze named by the specification.
12
+ */
13
+ import { PAIR_BOOTSTRAP_SUITE_ID_V1 } from "./pairBootstrapSuite";
14
+ import type { AdmissionGrantV1 } from "./operationPayload";
15
+ import type { OperationPayloadClassV1 } from "./operation";
16
+ import type { RoomPqMode } from "../roomPolicy";
17
+ export type PairStepKindV1 = "IDENTITY_HELLO" | "IDENTITY_ACCEPT" | "TRANSPORT_OFFER" | "TRANSPORT_ANSWER" | "V4_HANDSHAKE" | "PQ_CONTROL" | "QUIESCE_PROPOSE" | "QUIESCE_ACK" | "HEAL_COMPLETE" | "PAIR_CHECKPOINT";
18
+ export type PairAttemptModeV1 = "planner" | "explicit";
19
+ export interface StableIdentityBundleV1 {
20
+ readonly ed25519PublicKey: Uint8Array;
21
+ readonly x25519PublicKey: Uint8Array;
22
+ readonly x25519CrossSignature: Uint8Array;
23
+ }
24
+ export interface PairIdentityHelloUnsignedV1 {
25
+ readonly version: 1;
26
+ readonly attemptMode: PairAttemptModeV1;
27
+ readonly senderIdentity: StableIdentityBundleV1;
28
+ readonly senderPresenceCommitment: Uint8Array;
29
+ readonly senderAdmissionGrant: AdmissionGrantV1 | null;
30
+ readonly responseHybridKemPublicKey: Uint8Array;
31
+ }
32
+ export interface PairIdentityHelloV1 extends PairIdentityHelloUnsignedV1 {
33
+ readonly identityTranscriptSignature: Uint8Array;
34
+ }
35
+ export interface PairIdentityAcceptUnsignedV1 {
36
+ readonly version: 1;
37
+ readonly responderIdentity: StableIdentityBundleV1;
38
+ readonly responderPresenceCommitment: Uint8Array;
39
+ readonly responderAdmissionGrant: AdmissionGrantV1 | null;
40
+ }
41
+ export interface PairIdentityAcceptV1 extends PairIdentityAcceptUnsignedV1 {
42
+ readonly identityTranscriptSignature: Uint8Array;
43
+ }
44
+ export interface StableEdgeAttemptClaimUnsignedV1 {
45
+ readonly version: 1;
46
+ readonly stableEdgeId: Uint8Array;
47
+ readonly pairEdgeId: Uint8Array;
48
+ readonly confirmedPairTranscriptId: Uint8Array;
49
+ readonly claimantStableEd25519PublicKey: Uint8Array;
50
+ readonly claimNotBeforeLogicalWindow: bigint;
51
+ readonly claimNotAfterLogicalWindow: bigint;
52
+ }
53
+ export interface StableEdgeAttemptClaimV1 extends StableEdgeAttemptClaimUnsignedV1 {
54
+ readonly claimantSignature: Uint8Array;
55
+ }
56
+ export type PairTransportCandidateV1 = {
57
+ readonly version: 1;
58
+ readonly kind: "webrtc-complete";
59
+ readonly exactSdpUtf8: Uint8Array;
60
+ } | {
61
+ readonly version: 1;
62
+ readonly kind: "operation-carrier";
63
+ } | {
64
+ readonly version: 1;
65
+ readonly kind: "registered-local-link";
66
+ readonly adapterProtocolId: number;
67
+ readonly fixedCanonicalCandidate: Uint8Array;
68
+ };
69
+ export interface PairTransportOfferV1 {
70
+ readonly version: 1;
71
+ readonly initiatorStableEdgeClaim: StableEdgeAttemptClaimV1;
72
+ readonly candidates: readonly PairTransportCandidateV1[];
73
+ }
74
+ export interface PairTransportAnswerV1 {
75
+ readonly version: 1;
76
+ readonly responderStableEdgeClaim: StableEdgeAttemptClaimV1;
77
+ readonly selectedOfferCandidateId: Uint8Array;
78
+ readonly answer: PairTransportCandidateV1;
79
+ }
80
+ export interface QuiesceProposeV1 {
81
+ readonly version: 1;
82
+ readonly pqEpoch: bigint;
83
+ }
84
+ export interface QuiesceAckV1 {
85
+ readonly version: 1;
86
+ readonly pqEpoch: bigint;
87
+ }
88
+ export interface HealCompleteV1 {
89
+ readonly version: 1;
90
+ readonly newPqEpoch: bigint;
91
+ }
92
+ export interface PairCheckpointV1 {
93
+ readonly version: 1;
94
+ readonly pqEpoch: bigint;
95
+ }
96
+ export type PairStepBodyV1 = {
97
+ readonly kind: "IDENTITY_HELLO";
98
+ readonly value: PairIdentityHelloV1;
99
+ } | {
100
+ readonly kind: "IDENTITY_ACCEPT";
101
+ readonly value: PairIdentityAcceptV1;
102
+ } | {
103
+ readonly kind: "TRANSPORT_OFFER";
104
+ readonly value: PairTransportOfferV1;
105
+ } | {
106
+ readonly kind: "TRANSPORT_ANSWER";
107
+ readonly value: PairTransportAnswerV1;
108
+ } | {
109
+ readonly kind: "V4_HANDSHAKE";
110
+ readonly value: Uint8Array;
111
+ } | {
112
+ readonly kind: "PQ_CONTROL";
113
+ readonly value: Uint8Array;
114
+ } | {
115
+ readonly kind: "QUIESCE_PROPOSE";
116
+ readonly value: QuiesceProposeV1;
117
+ } | {
118
+ readonly kind: "QUIESCE_ACK";
119
+ readonly value: QuiesceAckV1;
120
+ } | {
121
+ readonly kind: "HEAL_COMPLETE";
122
+ readonly value: HealCompleteV1;
123
+ } | {
124
+ readonly kind: "PAIR_CHECKPOINT";
125
+ readonly value: PairCheckpointV1;
126
+ };
127
+ export interface PairPlaintextV1 {
128
+ readonly version: 1;
129
+ readonly kind: PairStepKindV1;
130
+ readonly pairEdgeId: Uint8Array;
131
+ readonly endpointPresenceOperationIds: readonly [Uint8Array, Uint8Array];
132
+ readonly direction: 0 | 1;
133
+ readonly pairSequence: bigint;
134
+ readonly previousPairOperationId: Uint8Array | null;
135
+ readonly pairDependencies: readonly Uint8Array[];
136
+ readonly body: PairStepBodyV1;
137
+ readonly pairPadding: Uint8Array;
138
+ }
139
+ export type PairIdentityUnsignedBodyV1 = {
140
+ readonly kind: "IDENTITY_HELLO";
141
+ readonly value: PairIdentityHelloUnsignedV1;
142
+ } | {
143
+ readonly kind: "IDENTITY_ACCEPT";
144
+ readonly value: PairIdentityAcceptUnsignedV1;
145
+ };
146
+ export interface PairIdentityUnsignedProjectionV1 {
147
+ readonly version: 1;
148
+ readonly kind: "IDENTITY_HELLO" | "IDENTITY_ACCEPT";
149
+ readonly pairEdgeId: Uint8Array;
150
+ readonly endpointPresenceOperationIds: readonly [Uint8Array, Uint8Array];
151
+ readonly direction: 0 | 1;
152
+ readonly pairSequence: bigint;
153
+ readonly previousPairOperationId: Uint8Array | null;
154
+ readonly pairDependencies: readonly Uint8Array[];
155
+ readonly body: PairIdentityUnsignedBodyV1;
156
+ readonly pairPadding: Uint8Array;
157
+ }
158
+ export interface PairOuterPrebindingV1 {
159
+ readonly version: 1;
160
+ readonly roomContextConfirmation: Uint8Array;
161
+ readonly policyHash: Uint8Array;
162
+ readonly logicalWindow: bigint;
163
+ readonly expiresAfterWindow: bigint;
164
+ readonly lifetime: "PAIR_CAUSAL";
165
+ readonly authorEpochEd25519Key: Uint8Array;
166
+ readonly authorSequence: bigint;
167
+ readonly previousAuthorOperationId: Uint8Array | null;
168
+ readonly kind: "PAIR_STEP";
169
+ readonly dependencies: readonly [];
170
+ readonly operationPayloadClass: OperationPayloadClassV1;
171
+ readonly bootstrapHeaderHash: Uint8Array;
172
+ readonly nonce: Uint8Array | null;
173
+ }
174
+ export interface PairOuterBindingV1 {
175
+ readonly prebinding: PairOuterPrebindingV1;
176
+ readonly pairRoutingTag: Uint8Array;
177
+ readonly semanticSlot: Uint8Array;
178
+ }
179
+ export interface PairFlightSlotV1 {
180
+ readonly kind: PairStepKindV1;
181
+ readonly direction: 0 | 1;
182
+ readonly pairSequence: bigint;
183
+ }
184
+ export type PairBootstrapRecipientBindingV1 = {
185
+ readonly kind: "presence";
186
+ readonly presenceOperationId: Uint8Array;
187
+ } | {
188
+ readonly kind: "hello-response";
189
+ readonly helloOperationId: Uint8Array;
190
+ };
191
+ export interface PairBootstrapInfoV1 {
192
+ readonly version: 1;
193
+ readonly pairBootstrapSuite: typeof PAIR_BOOTSTRAP_SUITE_ID_V1;
194
+ readonly roomContextConfirmation: Uint8Array;
195
+ readonly policyHash: Uint8Array;
196
+ readonly stepKind: "IDENTITY_HELLO" | "IDENTITY_ACCEPT";
197
+ readonly logicalWindow: bigint;
198
+ readonly expiresAfterWindow: bigint;
199
+ readonly authorEpochEd25519Key: Uint8Array;
200
+ readonly authorSequence: bigint;
201
+ readonly previousAuthorOperationId: Uint8Array | null;
202
+ readonly operationPayloadClass: OperationPayloadClassV1;
203
+ readonly recipientBinding: PairBootstrapRecipientBindingV1;
204
+ }
205
+ export declare class PairPlaintextError extends Error {
206
+ readonly name = "PairPlaintextError";
207
+ constructor(message: string);
208
+ }
209
+ export declare const validatePairFlightSlotV1: (value: PairFlightSlotV1) => void;
210
+ export declare const validatePairBootstrapInfoV1: (value: PairBootstrapInfoV1) => void;
211
+ /** Canonical HPKE `info` bytes after the complete bootstrap-info gate. */
212
+ export declare const encodePairBootstrapInfoV1: (value: PairBootstrapInfoV1) => Uint8Array;
213
+ /**
214
+ * Select the numerically smallest class for an empty-padding plaintext.
215
+ *
216
+ * This calculation is intentionally available before encryption. A receiver
217
+ * invokes the same rule only after AEAD opening exposes the plaintext.
218
+ */
219
+ export declare const pairOperationPayloadClassForV1: (plaintextWithEmptyPadding: PairPlaintextV1, bootstrapHeaderPresent: boolean) => OperationPayloadClassV1;
220
+ /** Validate an already decoded pair plaintext without mutating caller bytes. */
221
+ export declare const validatePairPlaintextV1: (plaintext: PairPlaintextV1, operationPayloadClass: OperationPayloadClassV1, bootstrapHeaderPresent: boolean, roomPqMode: RoomPqMode) => Promise<void>;
222
+ /**
223
+ * Fill the unique authenticated zero suffix and return the selected outer
224
+ * class together with an independently owned plaintext.
225
+ */
226
+ export declare const padPairPlaintextV1: (plaintextWithEmptyPadding: PairPlaintextV1, bootstrapHeaderPresent: boolean, roomPqMode: RoomPqMode) => Promise<{
227
+ readonly operationPayloadClass: OperationPayloadClassV1;
228
+ readonly plaintext: PairPlaintextV1;
229
+ }>;
230
+ /** Encode only the one canonical, minimally classified, target-sized value. */
231
+ export declare const encodePairPlaintextV1: (plaintext: PairPlaintextV1, operationPayloadClass: OperationPayloadClassV1, bootstrapHeaderPresent: boolean, roomPqMode: RoomPqMode) => Promise<Uint8Array>;
232
+ /** Strictly decode and validate the signed outer class/header state. */
233
+ export declare const decodePairPlaintextV1: (encoded: Uint8Array, operationPayloadClass: OperationPayloadClassV1, bootstrapHeaderPresent: boolean, roomPqMode: RoomPqMode) => Promise<PairPlaintextV1>;
234
+ /**
235
+ * Remove exactly the nested stable-identity transcript signature.
236
+ *
237
+ * The result uses a record descriptor rather than a new top-level union tag;
238
+ * every outer field and the exact pair padding remain in the projection.
239
+ */
240
+ export declare const pairIdentityUnsignedProjectionV1: (plaintext: PairPlaintextV1) => PairIdentityUnsignedProjectionV1;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Canonical room-visible pair envelope framing (Section 4.11).
3
+ *
4
+ * This is deliberately only the endpoint-independent outer boundary. It
5
+ * validates routing-tag framing, bootstrap-header/nonce state, and exact
6
+ * class-sized ciphertext framing without opening pair AEAD or interpreting a
7
+ * `PairPlaintextV1`. Tag expectation/one-use, admission, and the edge-local
8
+ * pair state machine remain outside this module.
9
+ *
10
+ * Status: PROPOSED, NOT FROZEN. This implements the Phase-0 outer boundary,
11
+ * but does not by itself publish a release-registry vector or interoperability
12
+ * claim.
13
+ *
14
+ * The schema and operation class table are the size SSOTs. Framing overhead is
15
+ * measured from a canonical empty-ciphertext encoding, then the exact
16
+ * ciphertext and plaintext targets are derived from it. No second target table
17
+ * is maintained here.
18
+ */
19
+ import { PAIR_BOOTSTRAP_SUITE_ID_V1 } from "./pairBootstrapSuite";
20
+ import type { OperationPayloadClassV1 } from "./operation";
21
+ export declare const PAIR_STEP_ENVELOPE_VERSION_V1 = 1;
22
+ export declare const PAIR_BOOTSTRAP_HEADER_VERSION_V1 = 1;
23
+ export { PAIR_BOOTSTRAP_SUITE_ID_V1 } from "./pairBootstrapSuite";
24
+ export declare const PAIR_AEAD_TAG_BYTES_V1: number;
25
+ export interface PairBootstrapHeaderV1 {
26
+ version: 1;
27
+ suiteId: typeof PAIR_BOOTSTRAP_SUITE_ID_V1;
28
+ hybridKemCiphertext: Uint8Array;
29
+ }
30
+ export interface PairStepEnvelopeV1 {
31
+ version: 1;
32
+ pairRoutingTag: Uint8Array;
33
+ bootstrapHeader: PairBootstrapHeaderV1 | null;
34
+ nonce: Uint8Array | null;
35
+ pairCiphertextAndTag: Uint8Array;
36
+ }
37
+ export declare class PairStepEnvelopeError extends Error {
38
+ readonly name = "PairStepEnvelopeError";
39
+ constructor(message: string);
40
+ }
41
+ /**
42
+ * These exported values are projections of the schema above, not literals.
43
+ * Changing an optional tag, fixed field, or length prefix changes them
44
+ * automatically and therefore changes every derived target/vector.
45
+ */
46
+ export declare const PAIR_BOOTSTRAP_ENVELOPE_OVERHEAD_BYTES_V1: number;
47
+ export declare const PAIR_ESTABLISHED_ENVELOPE_OVERHEAD_BYTES_V1: number;
48
+ /**
49
+ * Exact `pairCiphertextAndTag` bytes for one permitted outer envelope form.
50
+ * Suite 1 deliberately has no class-1 bootstrap form.
51
+ */
52
+ export declare const pairCiphertextAndTagTargetBytesV1: (operationPayloadClass: OperationPayloadClassV1, bootstrap: boolean) => number;
53
+ /** Exact authenticated pair-plaintext target after removing the AEAD tag. */
54
+ export declare const pairPlaintextTargetBytesV1: (operationPayloadClass: OperationPayloadClassV1, bootstrap: boolean) => number;
55
+ /** Validate a decoded envelope against its signed outer payload class. */
56
+ export declare const validatePairStepEnvelopeV1: (envelope: PairStepEnvelopeV1, operationPayloadClass: OperationPayloadClassV1) => void;
57
+ /** Encode only after all class-dependent outer invariants hold. */
58
+ export declare const encodePairStepEnvelopeV1: (envelope: PairStepEnvelopeV1, operationPayloadClass: OperationPayloadClassV1) => Uint8Array;
59
+ /** Decode uniquely, then enforce the signed class-dependent invariants. */
60
+ export declare const decodePairStepEnvelopeV1: (encoded: Uint8Array, operationPayloadClass: OperationPayloadClassV1) => PairStepEnvelopeV1;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Canonical local planner/topology persistence state.
3
+ *
4
+ * Core room reduction deliberately contains no local topology preference.
5
+ * This module is the one local SSOT for planner policy, explicit requests,
6
+ * provisional pair edges, and active stable edges. Counts are always derived
7
+ * from canonical edge sets; there are no independently mutable counters.
8
+ *
9
+ * This module deliberately exposes no desired-neighbor or reservation
10
+ * authority yet. That transition must consume an opaque result of the trusted
11
+ * local `Project`, then compare-and-swap this exact captured row with every
12
+ * other admission fence. Raw caller-supplied "selected" booleans are not a
13
+ * planner proof.
14
+ */
15
+ export type ConnectionPlannerModeV1 = "explicit" | "sparse-ring" | "full-mesh-small-room";
16
+ export interface ConnectionPlannerPolicyV1 {
17
+ readonly version: 1;
18
+ readonly mode: ConnectionPlannerModeV1;
19
+ readonly sparseRadius: number;
20
+ readonly maxProvisionalEdges: number;
21
+ readonly maxActiveStableEdges: number;
22
+ readonly fullMeshMaxMembers: number;
23
+ readonly allowOnDemandEdges: boolean;
24
+ }
25
+ export interface ProvisionalTopologyEdgeV1 {
26
+ readonly pairEdgeId: Uint8Array;
27
+ readonly endpointPresenceOperationIds: readonly [Uint8Array, Uint8Array];
28
+ readonly remoteLocalPeerId: string;
29
+ }
30
+ export interface ActiveStableTopologyEdgeV1 {
31
+ readonly stableEdgeId: Uint8Array;
32
+ readonly remoteLocalPeerId: string;
33
+ }
34
+ export interface PlannerAndExplicitStateV1 {
35
+ readonly version: 1;
36
+ readonly roomContextId: Uint8Array;
37
+ readonly plannerPolicy: ConnectionPlannerPolicyV1;
38
+ readonly requestedExplicitPeerIds: readonly string[];
39
+ readonly provisionalEdges: readonly ProvisionalTopologyEdgeV1[];
40
+ readonly activeStableEdges: readonly ActiveStableTopologyEdgeV1[];
41
+ }
42
+ export interface PlannerStateValidationLimitsV1 {
43
+ readonly maxRoomMembers: number;
44
+ readonly maxPairLedgerEntriesPerRoom: number;
45
+ }
46
+ export declare class PlannerStateError extends Error {
47
+ readonly name = "PlannerStateError";
48
+ constructor(message: string);
49
+ }
50
+ /** Strictly own and validate one complete planner/topology state. */
51
+ export declare const validateAndCopyPlannerAndExplicitStateV1: (value: unknown, limitsValue: PlannerStateValidationLimitsV1) => PlannerAndExplicitStateV1;
52
+ /** Canonical durable planner/topology bytes. */
53
+ export declare const encodePlannerAndExplicitStateV1: (value: unknown, limits: PlannerStateValidationLimitsV1) => Uint8Array;
54
+ /** Strictly restore and own one canonical durable planner/topology row. */
55
+ export declare const decodePlannerAndExplicitStateV1: (encoded: Uint8Array, limits: PlannerStateValidationLimitsV1) => PlannerAndExplicitStateV1;
56
+ /**
57
+ * Prove every persisted provisional edge is bound to this exact room.
58
+ *
59
+ * All state and room bytes are owned before the first hash promise begins.
60
+ */
61
+ export declare const assertPlannerStateRoomBindingV1: (stateValue: unknown, roomContextIdValue: Uint8Array, limits: PlannerStateValidationLimitsV1) => Promise<PlannerAndExplicitStateV1>;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Generated projections of the canonical binary schema.
3
+ *
4
+ * REQ-024 and AC-047 make this indirection mandatory rather than stylistic:
5
+ * types, codecs, fixtures, protocol tables, and UI claim keys are projections
6
+ * of the schema, never a second hand-maintained authority. A validator that
7
+ * kept its own key list would silently disagree with the wire format the day
8
+ * one field is added.
9
+ *
10
+ * Everything here is derived by `recordFieldNames`/`enumValues` at module load
11
+ * from `schemas.ts`. There is nothing to keep in sync by hand, which is the
12
+ * point: `tests/blindRendezvous/projections.test.ts` proves the derivation
13
+ * covers every validator table and every specified field.
14
+ */
15
+ export declare const KERNEL_MANIFEST_KEYS: ReadonlySet<string>;
16
+ export declare const KERNEL_MODULE_KEYS: ReadonlySet<string>;
17
+ export declare const KERNEL_ENTRYPOINT_KEYS: ReadonlySet<string>;
18
+ export declare const CLAIM_REGISTRY_KEYS: ReadonlySet<string>;
19
+ export declare const CLAIM_ASSUMPTION_KEYS: ReadonlySet<string>;
20
+ export declare const CLAIM_EVIDENCE_KIND_KEYS: ReadonlySet<string>;
21
+ export declare const CLAIM_DEFINITION_KEYS: ReadonlySet<string>;
22
+ export declare const CLAIM_WORDING_KEY_LIST: readonly string[];
23
+ export declare const CLAIM_WORDING_KEYS: ReadonlySet<string>;
24
+ export declare const CLAIM_EVALUATION_KEYS: ReadonlySet<string>;
25
+ export declare const CLAIM_EVALUATION_INPUT_KEYS: ReadonlySet<string>;
26
+ export declare const CLAIM_ASSUMPTION_FOUNDATIONAL_VERIFICATION_KEYS: ReadonlySet<string>;
27
+ export declare const CLAIM_ASSUMPTION_EVIDENCE_VERIFICATION_KEYS: ReadonlySet<string>;
28
+ export declare const FORMAL_REGISTRY_KEYS: ReadonlySet<string>;
29
+ export declare const FORMAL_OBLIGATION_KEYS: ReadonlySet<string>;
30
+ export declare const FORMAL_RESULT_KEYS: ReadonlySet<string>;
31
+ export declare const ROOM_POLICY_V4_KEYS: ReadonlySet<string>;
32
+ export declare const DELIVERY_PROFILE_V1_KEYS: ReadonlySet<string>;
33
+ export declare const AUTHENTICATED_ROOM_OPERATION_V1_KEYS: ReadonlySet<string>;
34
+ export declare const PAIR_BOOTSTRAP_HEADER_V1_KEYS: ReadonlySet<string>;
35
+ export declare const PAIR_STEP_ENVELOPE_V1_KEYS: ReadonlySet<string>;
36
+ export declare const PAIR_PLAINTEXT_V1_KEYS: ReadonlySet<string>;
37
+ export declare const PAIR_IDENTITY_UNSIGNED_PROJECTION_V1_KEYS: ReadonlySet<string>;
38
+ export declare const STABLE_IDENTITY_BUNDLE_V1_KEYS: ReadonlySet<string>;
39
+ export declare const PAIR_IDENTITY_HELLO_UNSIGNED_V1_KEYS: ReadonlySet<string>;
40
+ export declare const PAIR_IDENTITY_HELLO_V1_KEYS: ReadonlySet<string>;
41
+ export declare const PAIR_IDENTITY_ACCEPT_UNSIGNED_V1_KEYS: ReadonlySet<string>;
42
+ export declare const PAIR_IDENTITY_ACCEPT_V1_KEYS: ReadonlySet<string>;
43
+ export declare const PAIR_OUTER_PREBINDING_V1_KEYS: ReadonlySet<string>;
44
+ export declare const PAIR_OUTER_BINDING_V1_KEYS: ReadonlySet<string>;
45
+ export declare const PAIR_FLIGHT_SLOT_V1_KEYS: ReadonlySet<string>;
46
+ export declare const PAIR_BOOTSTRAP_INFO_V1_KEYS: ReadonlySet<string>;
47
+ export declare const PAIR_TRANSPORT_OFFER_V1_KEYS: ReadonlySet<string>;
48
+ export declare const PAIR_TRANSPORT_ANSWER_V1_KEYS: ReadonlySet<string>;
49
+ export declare const CARRIER_ENVELOPE_V1_KEYS: ReadonlySet<string>;
50
+ export declare const CLAIM_EVALUATION_STATES_ORDER: readonly string[];
51
+ export declare const CLAIM_SCOPE_KINDS_ORDER: readonly string[];
52
+ export declare const CLAIM_ASSUMPTION_KINDS_ORDER: readonly string[];
53
+ export declare const FORMAL_OBLIGATION_KINDS_ORDER: readonly string[];
54
+ export declare const FORMAL_PROOF_RESULTS_ORDER: readonly string[];
55
+ export declare const OPERATION_KINDS_ORDER: readonly string[];
56
+ export declare const OPERATION_LIFETIMES_ORDER: readonly string[];
57
+ export declare const PAIR_STEP_KINDS_ORDER: readonly string[];
58
+ export declare const PAIR_ATTEMPT_MODES_ORDER: readonly string[];
59
+ export declare const PAIR_BOOTSTRAP_RECIPIENT_KINDS_ORDER: readonly string[];
60
+ export declare const PAIR_TRANSPORT_CANDIDATE_KINDS_ORDER: readonly string[];
61
+ export declare const CLAIM_EVALUATION_STATES: ReadonlySet<string>;
62
+ export declare const CLAIM_SCOPE_KINDS: ReadonlySet<string>;
63
+ export declare const CLAIM_ASSUMPTION_KINDS: ReadonlySet<string>;
64
+ export declare const FORMAL_OBLIGATION_KINDS: ReadonlySet<string>;
65
+ export declare const FORMAL_PROOF_RESULTS: ReadonlySet<string>;
66
+ export declare const OPERATION_KINDS: ReadonlySet<string>;
67
+ export declare const OPERATION_LIFETIMES: ReadonlySet<string>;
68
+ export declare const PAIR_STEP_KINDS: ReadonlySet<string>;
69
+ export declare const PAIR_ATTEMPT_MODES: ReadonlySet<string>;
70
+ export declare const PAIR_BOOTSTRAP_RECIPIENT_KINDS: ReadonlySet<string>;
71
+ export declare const PAIR_TRANSPORT_CANDIDATE_KINDS: ReadonlySet<string>;