@kubun/plugin-p2p 0.10.1 → 0.12.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/lib/context/delegation.js +130 -1
- package/lib/context/group.js +1646 -1
- package/lib/context/hub.js +151 -1
- package/lib/context/join.js +115 -1
- package/lib/context/peer.d.ts +92 -0
- package/lib/context/peer.js +1216 -0
- package/lib/context/require-admin.d.ts +57 -0
- package/lib/context/require-admin.js +57 -0
- package/lib/context/sync.d.ts +12 -0
- package/lib/context/sync.js +252 -1
- package/lib/context/types.d.ts +58 -22
- package/lib/context/types.js +48 -1
- package/lib/groups/access-default-token.d.ts +44 -0
- package/lib/groups/access-default-token.js +103 -0
- package/lib/groups/admin-roster.d.ts +55 -0
- package/lib/groups/admin-roster.js +69 -0
- package/lib/groups/anchor-store.d.ts +15 -0
- package/lib/groups/anchor-store.js +37 -0
- package/lib/groups/app-cursor-store.d.ts +17 -0
- package/lib/groups/app-cursor-store.js +34 -0
- package/lib/groups/broadcast-codec.js +6 -1
- package/lib/groups/broadcast.d.ts +238 -106
- package/lib/groups/broadcast.js +702 -1
- package/lib/groups/catalog-token.d.ts +50 -0
- package/lib/groups/catalog-token.js +96 -0
- package/lib/groups/circle-projection.d.ts +90 -0
- package/lib/groups/circle-projection.js +202 -0
- package/lib/groups/circle-reducers.d.ts +139 -0
- package/lib/groups/circle-reducers.js +128 -0
- package/lib/groups/commit-adoption.d.ts +77 -0
- package/lib/groups/commit-adoption.js +108 -0
- package/lib/groups/commit-journal.d.ts +14 -0
- package/lib/groups/commit-journal.js +65 -0
- package/lib/groups/control-request.d.ts +66 -0
- package/lib/groups/control-request.js +101 -0
- package/lib/groups/events.d.ts +19 -2
- package/lib/groups/events.js +10 -1
- package/lib/groups/group-anchor.d.ts +24 -0
- package/lib/groups/group-anchor.js +22 -0
- package/lib/groups/group-crypto.d.ts +42 -0
- package/lib/groups/group-crypto.js +159 -0
- package/lib/groups/group-handle-registry.d.ts +138 -9
- package/lib/groups/group-handle-registry.js +533 -1
- package/lib/groups/group-handlers.d.ts +30 -0
- package/lib/groups/group-handlers.js +218 -0
- package/lib/groups/group-health-monitor.d.ts +11 -0
- package/lib/groups/group-health-monitor.js +139 -1
- package/lib/groups/group-mls.d.ts +66 -0
- package/lib/groups/group-mls.js +696 -0
- package/lib/groups/group-peer-manager.d.ts +301 -0
- package/lib/groups/group-peer-manager.js +1336 -0
- package/lib/groups/group-protocols.d.ts +754 -0
- package/lib/groups/group-protocols.js +448 -0
- package/lib/groups/invite-payload.d.ts +49 -1
- package/lib/groups/invite-payload.js +26 -1
- package/lib/groups/join-request-identity.d.ts +21 -0
- package/lib/groups/join-request-identity.js +43 -0
- package/lib/groups/join-utils.d.ts +61 -0
- package/lib/groups/join-utils.js +366 -1
- package/lib/groups/ledger-affected-events.d.ts +20 -0
- package/lib/groups/ledger-affected-events.js +85 -0
- package/lib/groups/ledger-commit-fold.d.ts +107 -0
- package/lib/groups/ledger-commit-fold.js +167 -0
- package/lib/groups/ledger-ingest.d.ts +124 -0
- package/lib/groups/ledger-ingest.js +212 -0
- package/lib/groups/ledger.d.ts +44 -0
- package/lib/groups/ledger.js +30 -0
- package/lib/groups/manager.d.ts +217 -85
- package/lib/groups/manager.js +798 -1
- package/lib/groups/mls-codec.d.ts +28 -7
- package/lib/groups/mls-codec.js +33 -1
- package/lib/groups/mls-encryptor.d.ts +2 -2
- package/lib/groups/mls-encryptor.js +33 -1
- package/lib/groups/mls-group-handle.d.ts +37 -2
- package/lib/groups/mls-group-handle.js +18 -1
- package/lib/groups/mls-json.js +17 -1
- package/lib/groups/mls-receive-errors.d.ts +27 -0
- package/lib/groups/mls-receive-errors.js +39 -0
- package/lib/groups/mls-state.d.ts +6 -4
- package/lib/groups/mls-state.js +79 -1
- package/lib/groups/peer-presence.d.ts +90 -0
- package/lib/groups/peer-presence.js +295 -0
- package/lib/groups/peer-selection.d.ts +37 -0
- package/lib/groups/peer-selection.js +72 -0
- package/lib/groups/roster-projection.d.ts +53 -0
- package/lib/groups/roster-projection.js +65 -0
- package/lib/groups/store-received-grant.d.ts +7 -3
- package/lib/groups/store-received-grant.js +161 -1
- package/lib/groups/store-received-revocation.d.ts +19 -16
- package/lib/groups/store-received-revocation.js +83 -1
- package/lib/hub/ack-backoff.d.ts +22 -0
- package/lib/hub/ack-backoff.js +88 -0
- package/lib/hub/http-client.d.ts +18 -10
- package/lib/hub/http-client.js +15 -1
- package/lib/hub/hub-like.d.ts +75 -0
- package/lib/hub/hub-like.js +1022 -0
- package/lib/hub/loopback-log-hub.d.ts +20 -0
- package/lib/hub/loopback-log-hub.js +178 -0
- package/lib/hub/manager.d.ts +25 -40
- package/lib/hub/manager.js +155 -1
- package/lib/hub/peer-scoped-hub-view.d.ts +35 -0
- package/lib/hub/peer-scoped-hub-view.js +92 -0
- package/lib/hub/sender-scoped-hub-view.d.ts +41 -0
- package/lib/hub/sender-scoped-hub-view.js +59 -0
- package/lib/hub/server-did.d.ts +67 -0
- package/lib/hub/server-did.js +131 -0
- package/lib/hub/wiring.d.ts +77 -51
- package/lib/hub/wiring.js +189 -1
- package/lib/index.d.ts +58 -22
- package/lib/index.js +563 -1
- package/lib/peer/connection-registry.d.ts +45 -0
- package/lib/peer/connection-registry.js +52 -0
- package/lib/peer/handlers.d.ts +69 -0
- package/lib/peer/handlers.js +110 -0
- package/lib/protocol.d.ts +214 -1
- package/lib/protocol.js +519 -1
- package/lib/schema.d.ts +3 -1
- package/lib/schema.js +1150 -39
- package/lib/sync/access-default-sender.d.ts +23 -0
- package/lib/sync/access-default-sender.js +80 -0
- package/lib/sync/authorize.d.ts +58 -4
- package/lib/sync/authorize.js +114 -1
- package/lib/sync/broadcast-queue.d.ts +3 -4
- package/lib/sync/broadcast-queue.js +182 -1
- package/lib/sync/broadcast-sender.js +179 -1
- package/lib/sync/catalog-scope.d.ts +8 -7
- package/lib/sync/catalog-scope.js +84 -1
- package/lib/sync/errors.d.ts +12 -2
- package/lib/sync/errors.js +29 -1
- package/lib/sync/forwarder.d.ts +13 -19
- package/lib/sync/forwarder.js +271 -1
- package/lib/sync/handlers.js +200 -1
- package/lib/sync/hub-tunnel-sync-listener.d.ts +19 -5
- package/lib/sync/hub-tunnel-sync-listener.js +261 -1
- package/lib/sync/hub-tunnel-sync-provider.d.ts +34 -14
- package/lib/sync/hub-tunnel-sync-provider.js +113 -1
- package/lib/sync/merkle-apply.d.ts +5 -0
- package/lib/sync/merkle-apply.js +194 -1
- package/lib/sync/merkle-channel.d.ts +11 -3
- package/lib/sync/merkle-channel.js +0 -0
- package/lib/sync/merkle-tree.js +120 -1
- package/lib/sync/peer-registry.d.ts +15 -11
- package/lib/sync/peer-registry.js +82 -1
- package/lib/sync/receive-access-gate.js +24 -1
- package/lib/sync/scope-resolver.js +41 -1
- package/lib/sync/sync-client.d.ts +14 -4
- package/lib/sync/sync-client.js +254 -1
- package/lib/sync/sync-manager.d.ts +24 -6
- package/lib/sync/sync-manager.js +301 -1
- package/lib/sync/tunnel-listeners.d.ts +52 -0
- package/lib/sync/tunnel-listeners.js +175 -0
- package/lib/sync/tunnel-observability.d.ts +25 -0
- package/lib/sync/tunnel-observability.js +63 -0
- package/lib/sync/tunnel-topics.d.ts +20 -0
- package/lib/sync/tunnel-topics.js +28 -0
- package/lib/types.d.ts +704 -22
- package/lib/types.js +1 -1
- package/lib/util/handler-error.d.ts +16 -0
- package/lib/util/handler-error.js +64 -0
- package/lib/util/mutex.d.ts +14 -1
- package/lib/util/mutex.js +44 -1
- package/lib/utils.js +21 -1
- package/package.json +58 -47
- package/lib/groups/broadcast-service.d.ts +0 -263
- package/lib/groups/broadcast-service.js +0 -1
- package/lib/groups/rejoin-codec.d.ts +0 -14
- package/lib/groups/rejoin-codec.js +0 -1
- package/lib/groups/wire-frame.d.ts +0 -34
- package/lib/groups/wire-frame.js +0 -1
- package/lib/hub/circle-catchup-requester.d.ts +0 -58
- package/lib/hub/circle-catchup-requester.js +0 -1
- package/lib/hub/circle-catchup-responder.d.ts +0 -50
- package/lib/hub/circle-catchup-responder.js +0 -1
- package/lib/hub/connection-pool.d.ts +0 -43
- package/lib/hub/connection-pool.js +0 -1
- package/lib/hub/did-observing-transport.d.ts +0 -64
- package/lib/hub/did-observing-transport.js +0 -1
- package/lib/hub/epoch-stale-detector.d.ts +0 -18
- package/lib/hub/epoch-stale-detector.js +0 -1
- package/lib/hub/errors.d.ts +0 -30
- package/lib/hub/errors.js +0 -1
- package/lib/hub/forward-remote-broadcast.d.ts +0 -15
- package/lib/hub/forward-remote-broadcast.js +0 -1
- package/lib/hub/group-channel.d.ts +0 -89
- package/lib/hub/group-channel.js +0 -1
- package/lib/hub/hub-connection.d.ts +0 -96
- package/lib/hub/hub-connection.js +0 -1
- package/lib/hub/receive-handler.d.ts +0 -51
- package/lib/hub/receive-handler.js +0 -1
- package/lib/hub/rejoin-manager.d.ts +0 -78
- package/lib/hub/rejoin-manager.js +0 -1
- package/lib/hub/rejoin-responder.d.ts +0 -32
- package/lib/hub/rejoin-responder.js +0 -1
- package/lib/hub/relay-manager.d.ts +0 -142
- package/lib/hub/relay-manager.js +0 -1
- package/lib/hub/send-handler.d.ts +0 -40
- package/lib/hub/send-handler.js +0 -1
- package/lib/hub/tunnel-inbox.d.ts +0 -20
- package/lib/hub/tunnel-inbox.js +0 -1
- package/lib/hub/wait-for-gate.d.ts +0 -14
- package/lib/hub/wait-for-gate.js +0 -1
package/lib/protocol.js
CHANGED
|
@@ -1 +1,519 @@
|
|
|
1
|
-
export const syncProtocol=
|
|
1
|
+
export const syncProtocol = {
|
|
2
|
+
'sync/negotiate': {
|
|
3
|
+
type: 'request',
|
|
4
|
+
param: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
scopes: {
|
|
8
|
+
type: 'array',
|
|
9
|
+
items: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
modelID: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
},
|
|
15
|
+
ownerDID: {
|
|
16
|
+
type: 'string'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
required: [
|
|
20
|
+
'modelID',
|
|
21
|
+
'ownerDID'
|
|
22
|
+
],
|
|
23
|
+
additionalProperties: false
|
|
24
|
+
},
|
|
25
|
+
description: 'Requested sync scopes as (model, owner) pairs'
|
|
26
|
+
},
|
|
27
|
+
delegationTokens: {
|
|
28
|
+
type: 'array',
|
|
29
|
+
items: {
|
|
30
|
+
type: 'string'
|
|
31
|
+
},
|
|
32
|
+
description: 'JWT delegation tokens for authorization'
|
|
33
|
+
},
|
|
34
|
+
catalogIDs: {
|
|
35
|
+
type: 'array',
|
|
36
|
+
items: {
|
|
37
|
+
type: 'string'
|
|
38
|
+
},
|
|
39
|
+
description: 'Catalog IDs to resolve sync scope from criteria'
|
|
40
|
+
},
|
|
41
|
+
knownModelIDs: {
|
|
42
|
+
type: 'array',
|
|
43
|
+
items: {
|
|
44
|
+
type: 'string'
|
|
45
|
+
},
|
|
46
|
+
description: 'Model IDs the requester already has — used to identify missing clusters'
|
|
47
|
+
},
|
|
48
|
+
direction: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
enum: [
|
|
51
|
+
'push',
|
|
52
|
+
'pull',
|
|
53
|
+
'both'
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
required: [
|
|
58
|
+
'delegationTokens'
|
|
59
|
+
],
|
|
60
|
+
additionalProperties: false
|
|
61
|
+
},
|
|
62
|
+
result: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
direction: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
enum: [
|
|
68
|
+
'push',
|
|
69
|
+
'pull',
|
|
70
|
+
'both'
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
acceptedScopes: {
|
|
74
|
+
type: 'array',
|
|
75
|
+
items: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: {
|
|
78
|
+
modelID: {
|
|
79
|
+
type: 'string'
|
|
80
|
+
},
|
|
81
|
+
ownerDID: {
|
|
82
|
+
type: 'string'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
required: [
|
|
86
|
+
'modelID',
|
|
87
|
+
'ownerDID'
|
|
88
|
+
],
|
|
89
|
+
additionalProperties: false
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
excludedDocumentIDs: {
|
|
93
|
+
type: 'array',
|
|
94
|
+
items: {
|
|
95
|
+
type: 'string'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
missingClusters: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
description: 'Cluster definitions for models the requester does not have yet',
|
|
101
|
+
additionalProperties: true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
required: [
|
|
105
|
+
'acceptedScopes',
|
|
106
|
+
'excludedDocumentIDs'
|
|
107
|
+
],
|
|
108
|
+
additionalProperties: false
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
'sync/merkle-sync': {
|
|
112
|
+
type: 'channel',
|
|
113
|
+
param: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties: {
|
|
116
|
+
scopes: {
|
|
117
|
+
type: 'array',
|
|
118
|
+
items: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
modelID: {
|
|
122
|
+
type: 'string'
|
|
123
|
+
},
|
|
124
|
+
ownerDID: {
|
|
125
|
+
type: 'string'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
required: [
|
|
129
|
+
'modelID',
|
|
130
|
+
'ownerDID'
|
|
131
|
+
],
|
|
132
|
+
additionalProperties: false
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
excludedDocumentIDs: {
|
|
136
|
+
type: 'array',
|
|
137
|
+
items: {
|
|
138
|
+
type: 'string'
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
tree: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
description: 'Merkle tree bucket hashes from requester',
|
|
144
|
+
additionalProperties: {
|
|
145
|
+
type: 'string'
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
direction: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
enum: [
|
|
151
|
+
'push',
|
|
152
|
+
'pull',
|
|
153
|
+
'both'
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
delegationTokens: {
|
|
157
|
+
type: 'array',
|
|
158
|
+
items: {
|
|
159
|
+
type: 'string'
|
|
160
|
+
},
|
|
161
|
+
description: 'Delegation JWTs authorizing the caller for non-owned scopes'
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
required: [
|
|
165
|
+
'scopes',
|
|
166
|
+
'excludedDocumentIDs',
|
|
167
|
+
'tree',
|
|
168
|
+
'direction'
|
|
169
|
+
],
|
|
170
|
+
additionalProperties: false
|
|
171
|
+
},
|
|
172
|
+
send: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {
|
|
175
|
+
type: {
|
|
176
|
+
type: 'string',
|
|
177
|
+
enum: [
|
|
178
|
+
'mutations',
|
|
179
|
+
'complete'
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
mutationJWTs: {
|
|
183
|
+
type: 'array',
|
|
184
|
+
items: {
|
|
185
|
+
type: 'string'
|
|
186
|
+
},
|
|
187
|
+
description: 'Signed mutation JWTs for divergent time buckets'
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
required: [
|
|
191
|
+
'type'
|
|
192
|
+
],
|
|
193
|
+
additionalProperties: false
|
|
194
|
+
},
|
|
195
|
+
receive: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
type: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
enum: [
|
|
201
|
+
'tree',
|
|
202
|
+
'mutations',
|
|
203
|
+
'complete'
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
tree: {
|
|
207
|
+
type: 'object',
|
|
208
|
+
description: 'Responder merkle tree bucket hashes',
|
|
209
|
+
additionalProperties: {
|
|
210
|
+
type: 'string'
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
mutationJWTs: {
|
|
214
|
+
type: 'array',
|
|
215
|
+
items: {
|
|
216
|
+
type: 'string'
|
|
217
|
+
},
|
|
218
|
+
description: 'Signed mutation JWTs for divergent time buckets'
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
required: [
|
|
222
|
+
'type'
|
|
223
|
+
],
|
|
224
|
+
additionalProperties: false
|
|
225
|
+
},
|
|
226
|
+
result: {
|
|
227
|
+
type: 'object',
|
|
228
|
+
properties: {
|
|
229
|
+
success: {
|
|
230
|
+
type: 'boolean'
|
|
231
|
+
},
|
|
232
|
+
divergentBuckets: {
|
|
233
|
+
type: 'number'
|
|
234
|
+
},
|
|
235
|
+
mutationsSent: {
|
|
236
|
+
type: 'number'
|
|
237
|
+
},
|
|
238
|
+
mutationsReceived: {
|
|
239
|
+
type: 'number'
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
required: [
|
|
243
|
+
'success',
|
|
244
|
+
'divergentBuckets',
|
|
245
|
+
'mutationsSent',
|
|
246
|
+
'mutationsReceived'
|
|
247
|
+
],
|
|
248
|
+
additionalProperties: false
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Peer protocol — the wire leg of the high-level peer ops. Served as a sibling
|
|
254
|
+
* to {@link syncProtocol} and advertised in `/info` under its own name so a
|
|
255
|
+
* connecting device can discover it independently of the data-sync protocol.
|
|
256
|
+
*
|
|
257
|
+
* The GraphQL mutations remain the app-facing surface; these procedures are the
|
|
258
|
+
* device-to-device leg the mutations dispatch to. `peer/groups` returns the
|
|
259
|
+
* serving device's DID and its groups for the `connectPeer` payload. The MLS
|
|
260
|
+
* dance procedures (`group/prepare-join`, `group/invite`, `group/complete-join`)
|
|
261
|
+
* extend this same protocol in later work.
|
|
262
|
+
*/ export const peerProtocol = {
|
|
263
|
+
'peer/groups': {
|
|
264
|
+
type: 'request',
|
|
265
|
+
param: {
|
|
266
|
+
type: 'object',
|
|
267
|
+
properties: {},
|
|
268
|
+
additionalProperties: false
|
|
269
|
+
},
|
|
270
|
+
result: {
|
|
271
|
+
type: 'object',
|
|
272
|
+
properties: {
|
|
273
|
+
did: {
|
|
274
|
+
type: 'string',
|
|
275
|
+
description: 'DID of the serving device'
|
|
276
|
+
},
|
|
277
|
+
groups: {
|
|
278
|
+
type: 'array',
|
|
279
|
+
items: {
|
|
280
|
+
type: 'object',
|
|
281
|
+
properties: {
|
|
282
|
+
id: {
|
|
283
|
+
type: 'string'
|
|
284
|
+
},
|
|
285
|
+
name: {
|
|
286
|
+
type: 'string'
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
required: [
|
|
290
|
+
'id',
|
|
291
|
+
'name'
|
|
292
|
+
],
|
|
293
|
+
additionalProperties: false
|
|
294
|
+
},
|
|
295
|
+
description: "The serving device's groups (id + name)"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
required: [
|
|
299
|
+
'did',
|
|
300
|
+
'groups'
|
|
301
|
+
],
|
|
302
|
+
additionalProperties: false
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
// The peer leg of the MLS invite dance. `group/prepare-join` and
|
|
306
|
+
// `group/complete-join` wrap the SAME context ops as the `prepareJoinRequest`
|
|
307
|
+
// and `completeJoin` GraphQL mutations — the serving (joining) device mints
|
|
308
|
+
// its KeyPackage bundle, then processes the Welcome the caller returns. Gated
|
|
309
|
+
// exactly like `peer/groups` (forged-`sub` rejection + `checkPeerAccess`).
|
|
310
|
+
'group/prepare-join': {
|
|
311
|
+
type: 'request',
|
|
312
|
+
param: {
|
|
313
|
+
type: 'object',
|
|
314
|
+
properties: {},
|
|
315
|
+
additionalProperties: false
|
|
316
|
+
},
|
|
317
|
+
result: {
|
|
318
|
+
type: 'object',
|
|
319
|
+
properties: {
|
|
320
|
+
joinRequest: {
|
|
321
|
+
type: 'string',
|
|
322
|
+
description: "The serving device's encoded join request (its KeyPackage)"
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
required: [
|
|
326
|
+
'joinRequest'
|
|
327
|
+
],
|
|
328
|
+
additionalProperties: false
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
'group/complete-join': {
|
|
332
|
+
type: 'request',
|
|
333
|
+
param: {
|
|
334
|
+
type: 'object',
|
|
335
|
+
properties: {
|
|
336
|
+
invitePayload: {
|
|
337
|
+
type: 'string',
|
|
338
|
+
description: 'The invite payload (Welcome + seeds) minted by the caller'
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
required: [
|
|
342
|
+
'invitePayload'
|
|
343
|
+
],
|
|
344
|
+
additionalProperties: false
|
|
345
|
+
},
|
|
346
|
+
result: {
|
|
347
|
+
type: 'object',
|
|
348
|
+
properties: {
|
|
349
|
+
groupID: {
|
|
350
|
+
type: [
|
|
351
|
+
'string',
|
|
352
|
+
'null'
|
|
353
|
+
],
|
|
354
|
+
description: 'The joined group ID, or null when the group row was not found'
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
required: [
|
|
358
|
+
'groupID'
|
|
359
|
+
],
|
|
360
|
+
additionalProperties: false
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
// The inviter leg of the inbound dance (`joinPeerGroup`). The caller (joiner)
|
|
364
|
+
// sends the group it wants to join plus its KeyPackage bundle; the serving
|
|
365
|
+
// device (inviter) adds the caller to the group's share circles, runs the
|
|
366
|
+
// invite as ITSELF, and returns the Welcome + invite payload. Gated exactly
|
|
367
|
+
// like the other peer procedures (forged-`sub` rejection + `checkPeerAccess`
|
|
368
|
+
// against the inviter's `autoAcceptPeers`), so only a trusted caller can pull
|
|
369
|
+
// an invite from this device.
|
|
370
|
+
'group/invite': {
|
|
371
|
+
type: 'request',
|
|
372
|
+
param: {
|
|
373
|
+
type: 'object',
|
|
374
|
+
properties: {
|
|
375
|
+
groupID: {
|
|
376
|
+
type: 'string',
|
|
377
|
+
description: 'The group the caller wants to join'
|
|
378
|
+
},
|
|
379
|
+
joinRequest: {
|
|
380
|
+
type: 'string',
|
|
381
|
+
description: "The caller's encoded join request (its KeyPackage)"
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
required: [
|
|
385
|
+
'groupID',
|
|
386
|
+
'joinRequest'
|
|
387
|
+
],
|
|
388
|
+
additionalProperties: false
|
|
389
|
+
},
|
|
390
|
+
result: {
|
|
391
|
+
type: 'object',
|
|
392
|
+
properties: {
|
|
393
|
+
invitePayload: {
|
|
394
|
+
type: 'string',
|
|
395
|
+
description: 'The invite payload (Welcome + seeds) for the caller to complete the join'
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
required: [
|
|
399
|
+
'invitePayload'
|
|
400
|
+
],
|
|
401
|
+
additionalProperties: false
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
// The caller hands the serving device its own access-default rows over the
|
|
405
|
+
// held connection, so the serving device applies them without waiting on hub
|
|
406
|
+
// fan-out (which is dropped for a group with no live binding). The source is
|
|
407
|
+
// UNTRUSTED: access-default rows are sender-bound (owner must equal the
|
|
408
|
+
// verified token issuer AND the authenticated caller). Gated exactly like
|
|
409
|
+
// `group/invite` (forged-`sub` rejection + `checkPeerAccess`).
|
|
410
|
+
'group/push-control': {
|
|
411
|
+
type: 'request',
|
|
412
|
+
param: {
|
|
413
|
+
type: 'object',
|
|
414
|
+
properties: {
|
|
415
|
+
groupID: {
|
|
416
|
+
type: 'string',
|
|
417
|
+
description: 'The group whose control state is being pushed'
|
|
418
|
+
},
|
|
419
|
+
accessDefaults: {
|
|
420
|
+
type: 'array',
|
|
421
|
+
items: {
|
|
422
|
+
type: 'object',
|
|
423
|
+
properties: {
|
|
424
|
+
ownerDID: {
|
|
425
|
+
type: 'string'
|
|
426
|
+
},
|
|
427
|
+
modelID: {
|
|
428
|
+
type: 'string'
|
|
429
|
+
},
|
|
430
|
+
permissionType: {
|
|
431
|
+
type: 'string',
|
|
432
|
+
enum: [
|
|
433
|
+
'read',
|
|
434
|
+
'write'
|
|
435
|
+
]
|
|
436
|
+
},
|
|
437
|
+
rule: {
|
|
438
|
+
type: 'object',
|
|
439
|
+
properties: {
|
|
440
|
+
level: {
|
|
441
|
+
type: 'string'
|
|
442
|
+
},
|
|
443
|
+
allowedDIDs: {
|
|
444
|
+
type: [
|
|
445
|
+
'array',
|
|
446
|
+
'null'
|
|
447
|
+
],
|
|
448
|
+
items: {
|
|
449
|
+
type: 'string'
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
allowedCircles: {
|
|
453
|
+
type: [
|
|
454
|
+
'array',
|
|
455
|
+
'null'
|
|
456
|
+
],
|
|
457
|
+
items: {
|
|
458
|
+
type: 'string'
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
allowedGroups: {
|
|
462
|
+
type: [
|
|
463
|
+
'array',
|
|
464
|
+
'null'
|
|
465
|
+
],
|
|
466
|
+
items: {
|
|
467
|
+
type: 'string'
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
required: [
|
|
472
|
+
'level',
|
|
473
|
+
'allowedDIDs',
|
|
474
|
+
'allowedCircles',
|
|
475
|
+
'allowedGroups'
|
|
476
|
+
],
|
|
477
|
+
additionalProperties: false
|
|
478
|
+
},
|
|
479
|
+
hlc: {
|
|
480
|
+
type: 'string'
|
|
481
|
+
},
|
|
482
|
+
auth: {
|
|
483
|
+
type: 'string'
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
required: [
|
|
487
|
+
'ownerDID',
|
|
488
|
+
'modelID',
|
|
489
|
+
'permissionType',
|
|
490
|
+
'rule',
|
|
491
|
+
'hlc',
|
|
492
|
+
'auth'
|
|
493
|
+
],
|
|
494
|
+
additionalProperties: false
|
|
495
|
+
},
|
|
496
|
+
description: "The caller's own signed access-default rows (sender-bound on apply)"
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
required: [
|
|
500
|
+
'groupID',
|
|
501
|
+
'accessDefaults'
|
|
502
|
+
],
|
|
503
|
+
additionalProperties: false
|
|
504
|
+
},
|
|
505
|
+
result: {
|
|
506
|
+
type: 'object',
|
|
507
|
+
properties: {
|
|
508
|
+
accessDefaultsApplied: {
|
|
509
|
+
type: 'number',
|
|
510
|
+
description: 'Count of pushed access-default rows applied (sender-bound, LWW)'
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
required: [
|
|
514
|
+
'accessDefaultsApplied'
|
|
515
|
+
],
|
|
516
|
+
additionalProperties: false
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
};
|
package/lib/schema.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { SchemaExtension } from '@kubun/engine';
|
|
2
|
+
import { type Logger } from '@kubun/logger';
|
|
2
3
|
import { type P2PEventEmitter } from './groups/events.js';
|
|
3
|
-
|
|
4
|
+
import type { SyncManager } from './sync/sync-manager.js';
|
|
5
|
+
export declare function createP2PSchemaExtension(emitter: P2PEventEmitter, syncManager: SyncManager, logger?: Logger): SchemaExtension;
|