-
Notifications
You must be signed in to change notification settings - Fork 15
/
pollux-openapi-spec.yaml
602 lines (581 loc) · 20.9 KB
/
pollux-openapi-spec.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
openapi: 3.0.3
info:
title: Pollux OpenAPI specification
description: OpenAPI specification for Schema and Verifiable Credentials operations
version: 1.0.0
contact:
name: Core DID
email: atala-coredid@iohk.io
servers:
- url: "https://api.atala.io"
tags:
- name: Schema Registry
description: Schema Registry REST API
- name: Issue Credentials
description: Verifiable Credentials creation and issuance REST API
- name: Verify Credentials
description: Verifiable Credentials verification REST API
- name: Revoke Credentials
description: Verifiable Credentials revocation REST API
paths:
/schema-registry/v1/schemas:
post:
tags: ["Schema Registry"]
operationId: createSchema
summary: Publish new schema to the schema registry
description: |-
Publish the new schema with claims to the schema registry on behalf of Cloud Agent
Schema will be signed by the keys of Cloud Agent and issued by the DID that corresponds to it
requestBody:
description: SchemaInput object with the metadata and claims
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/W3CSchemaInput"
example:
name: ""
version: "1.0"
claims:
- name: "email"
type: "string"
responses:
"201":
description: The new schema is created
content:
application/json:
schema:
$ref: "#/components/schemas/W3CSchema"
"400":
description: Schema input document cannot be used for the schema creation
"401":
description: Client is unauthorized to call the API
get:
tags: ["Schema Registry"]
operationId: fetchSchemasByQuery
summary: Fetch schemas by query
description: |-
Lookup the schemas in the registry to query by the author, version, name
parameters:
- in: query
name: author
description: Fetch schemas by the author (issuer) DID
example: "did:prism:abcdefg"
schema:
type: string
- in: query
name: name
description: Fetch schemas by the name
example: UniversityDegree
schema:
type: string
- in: query
name: offset
description: Pagination offset
example: 15
schema:
type: integer
- in: query
name: limit
description: Pagination limit
example: 100
schema:
type: integer
responses:
"200":
description: Schemas are fetched by the query
content:
application/json:
schema:
$ref: "#/components/schemas/W3CSchemaPaginated"
/schema-registry/v1/schemas/{id}:
get:
tags: ["Schema Registry"]
operationId: getSchemaById
summary: Fetch the schema from the registry by id
description: |-
Fetch the schema by the unique identifier. Verifiable Credential Schema in json format is returned
parameters:
- in: path
name: id
schema:
type: string
required: true
description: Unique identifier of the schema published in the registry
example: "did:example:MDP8AsFhHzhwUvGNuYkX7T;id=06e126d1-fa44-4882-a243-1e326fbe21db;version=1.0"
responses:
"200":
description: Successful response, W3C compliant schema is returned
content:
application/json:
schema:
$ref: "#/components/schemas/W3CSchema"
"404":
description: Schema is not found by id
/issue-credentials/v1/credentials:
post:
tags: ["Issue Credentials"]
operationId: createCredentials
summary: Create a new instances of Verifiable Credentials objects
description: |-
New credentials are created and stored by Pollux backend in the database
Credentials can be fetched either by issuance batchId or credential id
Any other manipulations and the issuance protocols execution can be performed on this object
requestBody:
description: CredentialInput object with the metadata and claims
required: true
content:
application/json:
schema:
type: object
required: ["credentials"]
properties:
batchId:
type: string
description: Batch ID of the credential objects that will be created together
credentials:
type: array
items:
$ref: "#/components/schemas/W3CCredentialInput"
example:
- subjectId: "did:prism:subject123"
schemaId: "unique schema id"
claims:
alumni_of: "University"
degree: "Master"
responses:
"201":
description: "Array of created verifiable credentials objects"
content:
application/json:
schema:
type: object
properties:
batchId:
type: string
description: "BatchId of the current set of credentials"
count:
type: integer
description: "Total count of the credential object in a given batch"
credentials:
type: array
items:
$ref: "#/components/schemas/W3CCredential"
get:
tags: ["Issue Credentials"]
operationId: getCredentialsByBatchId
summary: Returns the list of the credentials associated with the given batchId
description: Returns the list of the credentials associated with the given batchId
parameters:
- in: query
name: batchId
description: "Issuance batchId associated with the set of credentials"
required: true
schema:
type: string
- in: query
name: offset
description: "Offset pagination parameter"
required: false
schema:
type: integer
- in: query
name: limit
description: "Limit pagination parameter"
required: false
schema:
type: integer
responses:
"200":
description: "Paginated response of the verifiable credentials objects"
content:
application/json:
schema:
$ref: "#/components/schemas/W3CCredentialsPaginated"
/issue-credentials/v1/credentials/{id}:
get:
tags: ["Issue Credentials"]
operationId: getCredentialById
summary: Fetch the credential by id
description: |-
Fetch the credential by id
parameters:
- in: path
name: id
schema:
type: string
required: true
description: Identifier of the credential
example: "06e126d1-fa44-4882-a243-1e326fbe21db"
responses:
"200":
description: Successful response, instance of Verifiable Credential is returned
content:
application/json:
schema:
$ref: "#/components/schemas/W3CCredential"
"404":
description: Schema is not found by id
put:
tags: ["Issue Credentials"]
operationId: updateCredentialById
summary: Update the credential by id
description: Update the credential by id
parameters:
- in: path
name: id
schema:
type: string
required: true
description: Identifier of the credential
example: "06e126d1-fa44-4882-a243-1e326fbe21db"
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/W3CCredentialInput"
responses:
"200":
description: "Credential was updated successfully"
content:
application/json:
schema:
$ref: "#/components/schemas/W3CCredential"
delete:
tags: ["Issue Credentials"]
operationId: deleteCredentialById
summary: Delete the credential by id
description: Delete the credential by id
parameters:
- in: path
name: id
schema:
type: string
required: true
description: Identifier of the credential
example: "06e126d1-fa44-4882-a243-1e326fbe21db"
responses:
"204":
description: "Credential was deleted"
/issue-credentials/v1/issuance-batches:
get:
tags: ["Issue Credentials"]
operationId: getIssuanceBatches
summary: Fetch the available list of issuance-batches
description: Fetch the list of issuance-batches
parameters:
- in: query
name: limit
schema:
type: integer
- in: query
name: offset
schema:
type: integer
responses:
"200":
description: Returns the paginated list of issuance-batch objects
content:
application/json:
schema:
$ref: "#/components/schemas/W3CIssuanceBatchPaginated"
/issue-credentials/v1/issuance-batches/{batchId}/actions:
post:
tags: ["Issue Credentials"]
summary: "Submit the list of actions performed on the credentials associated with the issuance-batch"
operationId: "submitIssuanceBatchActions"
description: |-
List of action is submitted, actions are scheduled and IDs are returned for tracking the status
Each action is executed asynchronously in the sequential order according to the state of the issuance batch
Sign -> Issue -> Send
parameters:
- in: path
name: batchId
description: "The batchId of the issuance-batch object"
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/W3CIssuanceBatchAction"
responses:
"200":
description: "Returns the set of actions performed on the issuance-batch"
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/W3CIssuanceBatchAction"
get:
tags: ["Issue Credentials"]
operationId: "getIssuanceBatchActions"
summary: "Fetch the actions performed on the issuance-batch"
description: "Fetch the actions performed on the issuance-batch"
parameters:
- in: path
name: batchId
description: "The batchId of the issuance-batch object"
schema:
type: string
required: true
responses:
"200":
description: "Returns the set of actions performed on the issuance-batch"
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/W3CIssuanceBatchAction"
components:
schemas:
W3CProof:
description: "Proof object implemented according https://w3c.github.io/vc-data-integrity/ specification"
externalDocs:
url: "https://w3c.github.io/vc-data-integrity/"
required:
["type", "created", "verificationMethod", "proofPurpose", "proofValue"]
properties:
type:
type: string
description: "The specific proof type used. For example, an Ed25519Signature2020 type indicates that the proof includes a digital signature produced by an ed25519 cryptographic key."
example: "JcsSignature2020"
created:
type: string
description: "The string value of an [ISO8601] combined date and time string generated by the Proof Algorithm"
example: "2020-11-05T19:23:24Z"
verificationMethod:
type: string
description: "A set of parameters required to independently verify the proof, such as an identifier for a public/private key pair that would be used in the proof."
example: "https://di.example/issuer#z6MkjLrk3gKS2nnkeWcmcxiZPGskmesDpuwRBorgHxUXfxnG"
proofPurpose:
type: string
description: "The specific intent for the proof, the reason why an entity created it. Acts as a safeguard to prevent the proof from being misused for a purpose other than the one it was intended for. For example, a proof can be used for purposes of authentication, for asserting control of a Verifiable Credential (assertionMethod), and several others."
example: "assertionMethod"
proofValue:
type: string
description: "One of any number of valid representations of proof value generated by the Proof Algorithm."
example: "zQeVbY4oey5q2M3XKaxup3tmzN4DRFTLVqpLMweBrSxMY2xHX5XTYV8nQApmEcqaqA3Q1gVHMrXFkXJeV6doDwLWx"
domain:
type: string
description: "A string value specifying the restricted domain of the proof."
W3CSchemaInput:
description: SchemaInput object with the metadata and claims
required: ["name", "version", "claims"]
properties:
name:
type: string
description: Human friendly name of the schema
example: UniversityDegree
version:
type: string
description: SemVer of the schema
example: "1.0"
description:
type: string
description: Schema description
claims:
type: "array"
description: "List of claims"
items:
type: "object"
properties:
name:
type: "string"
description: "Name of the claim attribute"
type:
type: "string"
description: "Type of the claim attribute (bool, string, datetime, integer)"
W3CSchemaMeta:
description: Schema metadata
properties:
type:
type: string #should be URI
description: The URI of the schema
example: "https://w3c-ccg.github.io/vc-json-schemas/schema/2.0/schema.json"
version:
type: string
description: Semantic version of the schema
example: "1.0"
id:
type: string
description: Globally unique identifier of the schema (composed of issuer did, schema id and version)
example: "did:example:MDP8AsFhHzhwUvGNuYkX7T;id=06e126d1-fa44-4882-a243-1e326fbe21db;version=1.0"
name:
type: string
description: Human readable schema name
example: "UniversityDegree"
author:
type: string
description: Issuer DID
example: "did:example:MDP8AsFhHzhwUvGNuYkX7T"
authored:
type: string
description: Datetime of the schema issuance in ISO format
example: "2021-01-01T00:00:00+00:00"
W3CSchemaClaims:
description: Verifiable Credentials Schema Claims
properties:
$schema:
type: string
description: "Schema reference that can be used for validation"
example: "https://json-schema.org/draft/2019-09/schema"
$id:
type: string
description: UID of this Schema
example: "06e126d1-fa44-4882-a243-1e326fbe21db"
description:
type: string
description: "Schema description"
type:
type: string
description: "OpenAPI specification field that describes the object declaration"
example: "object"
properties:
type: object
description: "Set of clames"
additionalProperties: true
required:
type: array
items:
type: string
description: "Defines the set of required claims"
additionalProperties:
type: boolean
description: "Restrict the claims set to have additional attributes"
W3CSchema:
description: "W3C Json format of the verifiable credentials schema according to VC Data Model"
allOf:
- $ref: "#/components/schemas/W3CSchemaMeta"
- type: object
properties:
schema:
$ref: "#/components/schemas/W3CSchemaClaims"
proof:
$ref: "#/components/schemas/W3CProof"
W3CSchemaPaginated:
description: "Paginated response that contains an array of the schema objects"
properties:
data:
type: array
items:
$ref: "#/components/schemas/W3CSchema"
offset:
type: integer
limit:
type: integer
count:
type: integer
W3CCredentialInput:
description: |-
Credential input object based on which the new instance of the verifiable credentials is created.
Object contains the minimal set of the fields required to create the credentials for the given subject.
All other required fields of the verifiable credential depend on the context of the cloud agent
properties:
schemaId:
type: string
description: "Identity of the Verifiable Credentials Schema associated with this object"
example: "did:example:MDP8AsFhHzhwUvGNuYkX7T;id=06e126d1-fa44-4882-a243-1e326fbe21db;version=1.0"
subjectId:
type: string
description: "Subject DID of the verifiable credentials object"
example: "did:prism:subjectofverifiablecredentials"
claims:
type: object
additionalProperties: true
description: "Clams associated with given credentials object (for now it's just a key/value, later should be more complex"
W3CCredential:
description: "Verifiable Credential Object according to W3C specification"
required: ["id", "type", "issuer", "issuanceDate"]
properties:
id:
type: string
description: "Credential id or url that can be used to get the status of revoke the credential"
example: "http://example.edu/credentials/1872"
type:
type: string
description: "Credential type according to W3C specification. Must include VerifiableCredentials and type of concrete credentials"
example: '["VerifiableCredential", "AlumniCredential"]'
issuer:
type: string
description: "Issuer DID"
example: "did:prism:issuerdid"
issuanceDate:
type: string
description: "Datetime in ISO format that corresponds to the date of issuance"
example: "2010-01-01T19:23:24Z"
credentialSubject:
type: object
additionalProperties: true
required: ["id"]
description: "Credentials subject DID and claims according to the schema object"
example:
id: "did:prism:subject12345"
alumni_of: "University"
degree: "master of openapi specification"
properties:
id:
type: string
description: "DID of the subject of the credential"
proof:
$ref: "#/components/schemas/W3CProof"
W3CCredentialsPaginated:
description: "Paginated response that contains an array of the credential objects"
properties:
data:
type: array
items:
$ref: "#/components/schemas/W3CCredential"
offset:
type: integer
limit:
type: integer
count:
type: integer
W3CIssuanceBatch:
description: "An issuance batch object that is associated with thelist of verifiable credentials"
properties:
id:
type: string
description: "Issuance batch id"
count:
type: integer
description: "Count of the verifiable credentials object in the batch"
actions:
type: array
items:
$ref: "#/components/schemas/W3CIssuanceBatchAction"
W3CIssuanceBatchAction:
description: "Action performed on the list of credentials associated with the issuance batch"
properties:
action:
description: "Action name"
type: string
enum: ["sign", "issue", "send"]
example: "issue"
id:
description: "Action id for tracking"
type: string
example: "uid"
status:
description: "Action status"
type: string
enum: ["scheduled", "pending", "completed", "failed"]
W3CIssuanceBatchPaginated:
description: "Paginated response that contains an array of the issuance-batch objects"
properties:
data:
type: array
items:
$ref: "#/components/schemas/W3CIssuanceBatch"
offset:
type: integer
limit:
type: integer
count:
type: integer