@metalabel/dfos-protocol 0.0.2 → 0.1.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/openapi.yaml DELETED
@@ -1,376 +0,0 @@
1
- openapi: 3.1.0
2
- info:
3
- title: DFOS Protocol Registry
4
- version: 0.1.0
5
- description: |
6
- Minimal registry API for the DFOS Protocol. Provides chain submission,
7
- resolution, and paginated operation history for identity chains and content
8
- chains. Linear chain enforcement — accepts same or longer chains, rejects forks.
9
-
10
- This spec defines the interoperability surface. Any implementation serving
11
- these endpoints with these semantics is a compatible DFOS registry.
12
-
13
- servers:
14
- - url: /
15
- description: Registry root
16
-
17
- # ---------------------------------------------------------------------------
18
-
19
- paths:
20
- /identities:
21
- post:
22
- operationId: submitIdentityChain
23
- summary: Submit or extend an identity chain
24
- description: |
25
- Verifies the chain, derives the DID from the genesis CID, and stores it.
26
- - 201: chain accepted (new or extended)
27
- - 200: chain already stored (noop)
28
- - 400: invalid chain (verification failed)
29
- - 409: chain conflicts with stored chain (fork)
30
- requestBody:
31
- required: true
32
- content:
33
- application/json:
34
- schema:
35
- $ref: '#/components/schemas/SubmitChainRequest'
36
- responses:
37
- '201':
38
- description: Chain accepted
39
- content:
40
- application/json:
41
- schema:
42
- $ref: '#/components/schemas/IdentityState'
43
- '200':
44
- description: Chain already stored (noop)
45
- content:
46
- application/json:
47
- schema:
48
- $ref: '#/components/schemas/IdentityState'
49
- '400':
50
- description: Invalid chain
51
- content:
52
- application/json:
53
- schema:
54
- $ref: '#/components/schemas/Error'
55
- '409':
56
- description: Fork conflict
57
- content:
58
- application/json:
59
- schema:
60
- $ref: '#/components/schemas/Error'
61
-
62
- /identities/{did}:
63
- get:
64
- operationId: resolveIdentity
65
- summary: Resolve current identity state
66
- parameters:
67
- - $ref: '#/components/parameters/did'
68
- responses:
69
- '200':
70
- description: Verified identity state
71
- content:
72
- application/json:
73
- schema:
74
- $ref: '#/components/schemas/IdentityState'
75
- '404':
76
- description: Identity not found
77
- content:
78
- application/json:
79
- schema:
80
- $ref: '#/components/schemas/Error'
81
-
82
- /identities/{did}/operations:
83
- get:
84
- operationId: listIdentityOperations
85
- summary: List identity chain operations (newest-first, paginated)
86
- parameters:
87
- - $ref: '#/components/parameters/did'
88
- - $ref: '#/components/parameters/cursor'
89
- - $ref: '#/components/parameters/limit'
90
- responses:
91
- '200':
92
- description: Paginated operation list
93
- content:
94
- application/json:
95
- schema:
96
- $ref: '#/components/schemas/PaginatedOperations'
97
- '404':
98
- description: Identity not found
99
- content:
100
- application/json:
101
- schema:
102
- $ref: '#/components/schemas/Error'
103
-
104
- /entities:
105
- post:
106
- operationId: submitContentChain
107
- summary: Submit or extend a content chain
108
- description: |
109
- Verifies the chain (resolving signing keys from stored identity chains),
110
- derives the entity ID from the genesis CID, and stores it.
111
- Same status code semantics as identity submission.
112
- requestBody:
113
- required: true
114
- content:
115
- application/json:
116
- schema:
117
- $ref: '#/components/schemas/SubmitChainRequest'
118
- responses:
119
- '201':
120
- description: Chain accepted
121
- content:
122
- application/json:
123
- schema:
124
- $ref: '#/components/schemas/EntityState'
125
- '200':
126
- description: Chain already stored (noop)
127
- content:
128
- application/json:
129
- schema:
130
- $ref: '#/components/schemas/EntityState'
131
- '400':
132
- description: Invalid chain
133
- content:
134
- application/json:
135
- schema:
136
- $ref: '#/components/schemas/Error'
137
- '409':
138
- description: Fork conflict
139
- content:
140
- application/json:
141
- schema:
142
- $ref: '#/components/schemas/Error'
143
-
144
- /entities/{entityId}:
145
- get:
146
- operationId: resolveEntity
147
- summary: Resolve current entity state
148
- parameters:
149
- - $ref: '#/components/parameters/entityId'
150
- responses:
151
- '200':
152
- description: Entity state
153
- content:
154
- application/json:
155
- schema:
156
- $ref: '#/components/schemas/EntityState'
157
- '404':
158
- description: Entity not found
159
- content:
160
- application/json:
161
- schema:
162
- $ref: '#/components/schemas/Error'
163
-
164
- /entities/{entityId}/operations:
165
- get:
166
- operationId: listEntityOperations
167
- summary: List content chain operations (newest-first, paginated)
168
- parameters:
169
- - $ref: '#/components/parameters/entityId'
170
- - $ref: '#/components/parameters/cursor'
171
- - $ref: '#/components/parameters/limit'
172
- responses:
173
- '200':
174
- description: Paginated operation list
175
- content:
176
- application/json:
177
- schema:
178
- $ref: '#/components/schemas/PaginatedOperations'
179
- '404':
180
- description: Entity not found
181
- content:
182
- application/json:
183
- schema:
184
- $ref: '#/components/schemas/Error'
185
-
186
- /operations/{cid}:
187
- get:
188
- operationId: resolveOperation
189
- summary: Resolve a single operation by CID
190
- parameters:
191
- - $ref: '#/components/parameters/cid'
192
- responses:
193
- '200':
194
- description: Operation found
195
- content:
196
- application/json:
197
- schema:
198
- $ref: '#/components/schemas/Operation'
199
- '404':
200
- description: Operation not found
201
- content:
202
- application/json:
203
- schema:
204
- $ref: '#/components/schemas/Error'
205
-
206
- # ---------------------------------------------------------------------------
207
-
208
- components:
209
- parameters:
210
- did:
211
- name: did
212
- in: path
213
- required: true
214
- schema:
215
- type: string
216
- pattern: '^did:dfos:[2346789acdefhknrtvz]{22}$'
217
- example: 'did:dfos:e3vvtck42d4eacdnzvtrn6'
218
-
219
- entityId:
220
- name: entityId
221
- in: path
222
- required: true
223
- schema:
224
- type: string
225
- pattern: '^[2346789acdefhknrtvz]{22}$'
226
- example: '67t27rzc83v7c22n9t6z7c'
227
-
228
- cid:
229
- name: cid
230
- in: path
231
- required: true
232
- schema:
233
- type: string
234
- example: 'bafyreieseogefhfjajtkzqq6ssq63nnt7bslwca7d5wbrfbdlhld5jos6i'
235
-
236
- cursor:
237
- name: cursor
238
- in: query
239
- required: false
240
- description: Opaque pagination cursor (CID of last item on previous page)
241
- schema:
242
- type: string
243
-
244
- limit:
245
- name: limit
246
- in: query
247
- required: false
248
- description: Page size (1-100, default 25)
249
- schema:
250
- type: integer
251
- minimum: 1
252
- maximum: 100
253
- default: 25
254
-
255
- schemas:
256
- SubmitChainRequest:
257
- type: object
258
- required: [chain]
259
- properties:
260
- chain:
261
- type: array
262
- minItems: 1
263
- items:
264
- type: string
265
- description: JWS compact token
266
- description: |
267
- Ordered array of JWS compact tokens, genesis-first.
268
- The registry verifies the chain and either accepts (same or longer
269
- than stored) or rejects (fork or invalid).
270
-
271
- MultikeyPublicKey:
272
- type: object
273
- required: [id, type, publicKeyMultibase]
274
- properties:
275
- id:
276
- type: string
277
- example: 'key_ref_controller_01'
278
- type:
279
- type: string
280
- enum: [Multikey]
281
- publicKeyMultibase:
282
- type: string
283
- description: W3C Multikey encoded Ed25519 public key (z6Mk... prefix)
284
- example: 'z6MkveUvhr2oyjZGmP4kHgsPSSa6t9mG9pWuPsYoGn2CzQ6o'
285
-
286
- IdentityState:
287
- type: object
288
- required: [did, isDeleted, authKeys, assertKeys, controllerKeys]
289
- properties:
290
- did:
291
- type: string
292
- example: 'did:dfos:e3vvtck42d4eacdnzvtrn6'
293
- isDeleted:
294
- type: boolean
295
- authKeys:
296
- type: array
297
- items:
298
- $ref: '#/components/schemas/MultikeyPublicKey'
299
- assertKeys:
300
- type: array
301
- items:
302
- $ref: '#/components/schemas/MultikeyPublicKey'
303
- controllerKeys:
304
- type: array
305
- items:
306
- $ref: '#/components/schemas/MultikeyPublicKey'
307
-
308
- EntityState:
309
- type: object
310
- required: [entityId, isDeleted, currentDocumentCID, genesisCID, headCID]
311
- properties:
312
- entityId:
313
- type: string
314
- example: '67t27rzc83v7c22n9t6z7c'
315
- isDeleted:
316
- type: boolean
317
- currentDocumentCID:
318
- type: string
319
- nullable: true
320
- description: CID of current document (null if cleared or deleted)
321
- genesisCID:
322
- type: string
323
- description: CID of the genesis operation
324
- headCID:
325
- type: string
326
- description: CID of the most recent operation
327
-
328
- OperationEntry:
329
- type: object
330
- required: [cid, jwsToken, createdAt]
331
- properties:
332
- cid:
333
- type: string
334
- description: dag-cbor CID of the operation payload
335
- jwsToken:
336
- type: string
337
- description: JWS compact token (the signed operation)
338
- createdAt:
339
- type: string
340
- format: date-time
341
- description: ISO 8601 timestamp from the operation payload
342
-
343
- PaginatedOperations:
344
- type: object
345
- required: [operations, nextCursor]
346
- properties:
347
- operations:
348
- type: array
349
- items:
350
- $ref: '#/components/schemas/OperationEntry'
351
- description: Operations ordered newest-first
352
- nextCursor:
353
- type: string
354
- nullable: true
355
- description: |
356
- Opaque cursor for the next page. Null when there are no more pages.
357
- Pass as ?cursor=xxx on the next request.
358
-
359
- Operation:
360
- type: object
361
- required: [cid, jwsToken]
362
- properties:
363
- cid:
364
- type: string
365
- jwsToken:
366
- type: string
367
-
368
- Error:
369
- type: object
370
- required: [error, message]
371
- properties:
372
- error:
373
- type: string
374
- enum: [BAD_REQUEST, NOT_FOUND, CONFLICT]
375
- message:
376
- type: string
@@ -1,37 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schemas.dfos.com/document-envelope/v1",
4
- "title": "Document Envelope",
5
- "description": "Standard wrapper for content committed to by content chains. The documentCID in a content chain operation is CID(dagCborEncode(envelope)).",
6
- "type": "object",
7
- "required": ["content", "baseDocumentCID", "createdByDID", "createdAt"],
8
- "properties": {
9
- "content": {
10
- "type": "object",
11
- "required": ["$schema"],
12
- "properties": {
13
- "$schema": {
14
- "type": "string",
15
- "format": "uri",
16
- "description": "URI identifying the JSON Schema that validates this content."
17
- }
18
- },
19
- "description": "Application-defined content payload. Opaque to chains — validated by the schema identified in $schema."
20
- },
21
- "baseDocumentCID": {
22
- "type": ["string", "null"],
23
- "description": "CID of the previous document version (edit lineage), or null for the first version."
24
- },
25
- "createdByDID": {
26
- "type": "string",
27
- "pattern": "^did:",
28
- "description": "DID of the identity that created this document version."
29
- },
30
- "createdAt": {
31
- "type": "string",
32
- "format": "date-time",
33
- "description": "ISO 8601 timestamp of document creation."
34
- }
35
- },
36
- "additionalProperties": false
37
- }