github.com/hyperledger/aries-framework-go@v0.3.2/pkg/doc/presexch/schema.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package presexch 8 9 // DefinitionJSONSchemaV1 is the JSONSchema definition for PresentationDefinition. 10 // nolint:lll 11 // https://github.com/decentralized-identity/presentation-exchange/blob/9a6abc6d2b0f08b6339c9116132fa94c4c834418/test/presentation-definition/schema.json 12 const DefinitionJSONSchemaV1 = ` 13 { 14 "$schema":"http://json-schema.org/draft-07/schema#", 15 "title":"Presentation Definition", 16 "definitions":{ 17 "schema":{ 18 "type":"object", 19 "properties":{ 20 "uri":{ 21 "type":"string" 22 }, 23 "required":{ 24 "type":"boolean" 25 } 26 }, 27 "required":[ 28 "uri" 29 ], 30 "additionalProperties":false 31 }, 32 "filter":{ 33 "type":"object", 34 "properties":{ 35 "type":{ 36 "type":"string" 37 }, 38 "format":{ 39 "type":"string" 40 }, 41 "pattern":{ 42 "type":"string" 43 }, 44 "minimum":{ 45 "type":[ 46 "number", 47 "string" 48 ] 49 }, 50 "minLength":{ 51 "type":"integer" 52 }, 53 "maxLength":{ 54 "type":"integer" 55 }, 56 "exclusiveMinimum":{ 57 "type":[ 58 "number", 59 "string" 60 ] 61 }, 62 "exclusiveMaximum":{ 63 "type":[ 64 "number", 65 "string" 66 ] 67 }, 68 "maximum":{ 69 "type":[ 70 "number", 71 "string" 72 ] 73 }, 74 "const":{ 75 "type":[ 76 "number", 77 "string" 78 ] 79 }, 80 "enum":{ 81 "type":"array", 82 "items":{ 83 "type":[ 84 "number", 85 "string" 86 ] 87 } 88 }, 89 "not":{ 90 "type":"object", 91 "minProperties":1 92 } 93 }, 94 "required":[ 95 "type" 96 ], 97 "additionalProperties":false 98 }, 99 "format":{ 100 "type":"object", 101 "patternProperties":{ 102 "^jwt$|^jwt_vc$|^jwt_vp$":{ 103 "type":"object", 104 "properties":{ 105 "alg":{ 106 "type":"array", 107 "minItems":1, 108 "items":{ 109 "type":"string" 110 } 111 } 112 }, 113 "required":[ 114 "alg" 115 ], 116 "additionalProperties":false 117 }, 118 "^ldp_vc$|^ldp_vp$|^ldp$":{ 119 "type":"object", 120 "properties":{ 121 "proof_type":{ 122 "type":"array", 123 "minItems":1, 124 "items":{ 125 "type":"string" 126 } 127 } 128 }, 129 "required":[ 130 "proof_type" 131 ], 132 "additionalProperties":false 133 }, 134 "additionalProperties":false 135 }, 136 "additionalProperties":false 137 }, 138 "submission_requirements":{ 139 "type":"object", 140 "oneOf":[ 141 { 142 "properties":{ 143 "name":{ 144 "type":"string" 145 }, 146 "purpose":{ 147 "type":"string" 148 }, 149 "rule":{ 150 "type":"string", 151 "enum":[ 152 "all", 153 "pick" 154 ] 155 }, 156 "count":{ 157 "type":"integer", 158 "minimum":1 159 }, 160 "min":{ 161 "type":"integer", 162 "minimum":0 163 }, 164 "max":{ 165 "type":"integer", 166 "minimum":0 167 }, 168 "from":{ 169 "type":"string" 170 } 171 }, 172 "required":[ 173 "rule", 174 "from" 175 ], 176 "additionalProperties":false 177 }, 178 { 179 "properties":{ 180 "name":{ 181 "type":"string" 182 }, 183 "purpose":{ 184 "type":"string" 185 }, 186 "rule":{ 187 "type":"string", 188 "enum":[ 189 "all", 190 "pick" 191 ] 192 }, 193 "count":{ 194 "type":"integer", 195 "minimum":1 196 }, 197 "min":{ 198 "type":"integer", 199 "minimum":0 200 }, 201 "max":{ 202 "type":"integer", 203 "minimum":0 204 }, 205 "from_nested":{ 206 "type":"array", 207 "minItems":1, 208 "items":{ 209 "$ref":"#/definitions/submission_requirements" 210 } 211 } 212 }, 213 "required":[ 214 "rule", 215 "from_nested" 216 ], 217 "additionalProperties":false 218 } 219 ] 220 }, 221 "input_descriptors":{ 222 "type":"object", 223 "properties":{ 224 "id":{ 225 "type":"string" 226 }, 227 "name":{ 228 "type":"string" 229 }, 230 "purpose":{ 231 "type":"string" 232 }, 233 "group":{ 234 "type":"array", 235 "items":{ 236 "type":"string" 237 } 238 }, 239 "schema":{ 240 "type":"array", 241 "items":{ 242 "$ref":"#/definitions/schema" 243 } 244 }, 245 "constraints":{ 246 "type":"object", 247 "properties":{ 248 "limit_disclosure":{ 249 "type":"string", 250 "enum":[ 251 "required", 252 "preferred" 253 ] 254 }, 255 "statuses":{ 256 "type":"object", 257 "properties":{ 258 "active":{ 259 "type":"object", 260 "properties":{ 261 "directive":{ 262 "type":"string", 263 "enum":[ 264 "required", 265 "allowed", 266 "disallowed" 267 ] 268 } 269 } 270 }, 271 "suspended":{ 272 "type":"object", 273 "properties":{ 274 "directive":{ 275 "type":"string", 276 "enum":[ 277 "required", 278 "allowed", 279 "disallowed" 280 ] 281 } 282 } 283 }, 284 "revoked":{ 285 "type":"object", 286 "properties":{ 287 "directive":{ 288 "type":"string", 289 "enum":[ 290 "required", 291 "allowed", 292 "disallowed" 293 ] 294 } 295 } 296 } 297 } 298 }, 299 "fields":{ 300 "type":"array", 301 "items":{ 302 "$ref":"#/definitions/field" 303 } 304 }, 305 "subject_is_issuer":{ 306 "type":"string", 307 "enum":[ 308 "required", 309 "preferred" 310 ] 311 }, 312 "is_holder":{ 313 "type":"array", 314 "items":{ 315 "type":"object", 316 "properties":{ 317 "field_id":{ 318 "type":"array", 319 "items":{ 320 "type":"string" 321 } 322 }, 323 "directive":{ 324 "type":"string", 325 "enum":[ 326 "required", 327 "preferred" 328 ] 329 } 330 }, 331 "required":[ 332 "field_id", 333 "directive" 334 ], 335 "additionalProperties":false 336 } 337 }, 338 "same_subject":{ 339 "type":"array", 340 "items":{ 341 "type":"object", 342 "properties":{ 343 "field_id":{ 344 "type":"array", 345 "items":{ 346 "type":"string" 347 } 348 }, 349 "directive":{ 350 "type":"string", 351 "enum":[ 352 "required", 353 "preferred" 354 ] 355 } 356 }, 357 "required":[ 358 "field_id", 359 "directive" 360 ], 361 "additionalProperties":false 362 } 363 } 364 }, 365 "additionalProperties":false 366 } 367 }, 368 "required":[ 369 "id", 370 "schema" 371 ], 372 "additionalProperties":false 373 }, 374 "field":{ 375 "type":"object", 376 "oneOf":[ 377 { 378 "properties":{ 379 "id":{ 380 "type":"string" 381 }, 382 "path":{ 383 "type":"array", 384 "items":{ 385 "type":"string" 386 } 387 }, 388 "purpose":{ 389 "type":"string" 390 }, 391 "filter":{ 392 "$ref":"#/definitions/filter" 393 } 394 }, 395 "required":[ 396 "path" 397 ], 398 "additionalProperties":false 399 }, 400 { 401 "properties":{ 402 "id":{ 403 "type":"string" 404 }, 405 "path":{ 406 "type":"array", 407 "items":{ 408 "type":"string" 409 } 410 }, 411 "purpose":{ 412 "type":"string" 413 }, 414 "filter":{ 415 "$ref":"#/definitions/filter" 416 }, 417 "predicate":{ 418 "type":"string", 419 "enum":[ 420 "required", 421 "preferred" 422 ] 423 } 424 }, 425 "required":[ 426 "path", 427 "filter", 428 "predicate" 429 ], 430 "additionalProperties":false 431 } 432 ] 433 } 434 }, 435 "type":"object", 436 "properties":{ 437 "presentation_definition":{ 438 "type":"object", 439 "properties":{ 440 "id":{ 441 "type":"string" 442 }, 443 "name":{ 444 "type":"string" 445 }, 446 "purpose":{ 447 "type":"string" 448 }, 449 "format":{ 450 "$ref":"#/definitions/format" 451 }, 452 "submission_requirements":{ 453 "type":"array", 454 "items":{ 455 "$ref":"#/definitions/submission_requirements" 456 } 457 }, 458 "input_descriptors":{ 459 "type":"array", 460 "items":{ 461 "$ref":"#/definitions/input_descriptors" 462 } 463 } 464 }, 465 "required":[ 466 "id", 467 "input_descriptors" 468 ], 469 "additionalProperties":false 470 } 471 } 472 }` 473 474 // DefinitionJSONSchemaV2 is the JSONSchema definition for PresentationDefinition. 475 // nolint:lll 476 const DefinitionJSONSchemaV2 = ` 477 { 478 "$schema": "http://json-schema.org/draft-07/schema#", 479 "title": "Presentation Definition Envelope", 480 "definitions": { 481 "status_directive": { 482 "type": "object", 483 "additionalProperties": false, 484 "properties": { 485 "directive": { 486 "type": "string", 487 "enum": ["required", "allowed", "disallowed"] 488 }, 489 "type": { 490 "type": "array", 491 "minItems": 1, 492 "items": { "type": "string" } 493 } 494 } 495 }, 496 "field": { 497 "type": "object", 498 "oneOf": [ 499 { 500 "properties": { 501 "id": { "type": "string" }, 502 "path": { 503 "type": "array", 504 "items": { "type": "string" } 505 }, 506 "purpose": { "type": "string" }, 507 "intent_to_retain": { "type": "boolean" }, 508 "optional": { "type": "boolean" }, 509 "filter": { "$ref": "http://json-schema.org/draft-07/schema#" } 510 }, 511 "required": ["path"], 512 "additionalProperties": false 513 }, 514 { 515 "properties": { 516 "id": { "type": "string" }, 517 "path": { 518 "type": "array", 519 "items": { "type": "string" } 520 }, 521 "purpose": { "type": "string" }, 522 "intent_to_retain": { "type": "boolean" }, 523 "filter": { "$ref": "http://json-schema.org/draft-07/schema#" }, 524 "predicate": { 525 "type": "string", 526 "enum": ["required", "preferred"] 527 } 528 }, 529 "required": ["path", "filter", "predicate"], 530 "additionalProperties": false 531 } 532 ] 533 }, 534 "input_descriptor": { 535 "type": "object", 536 "additionalProperties": false, 537 "properties": { 538 "id": { "type": "string" }, 539 "name": { "type": "string" }, 540 "purpose": { "type": "string" }, 541 "format": { 542 "$schema": "http://json-schema.org/draft-07/schema#", 543 "title": "Presentation Definition Claim Format Designations", 544 "type": "object", 545 "additionalProperties": false, 546 "patternProperties": { 547 "^jwt$|^jwt_vc$|^jwt_vp$": { 548 "type": "object", 549 "additionalProperties": false, 550 "properties": { 551 "alg": { 552 "type": "array", 553 "minItems": 1, 554 "items": { "type": "string" } 555 } 556 } 557 }, 558 "^ldp_vc$|^ldp_vp$|^ldp$": { 559 "type": "object", 560 "additionalProperties": false, 561 "properties": { 562 "proof_type": { 563 "type": "array", 564 "minItems": 1, 565 "items": { "type": "string" } 566 } 567 } 568 } 569 } 570 }, 571 "group": { "type": "array", "items": { "type": "string" } }, 572 "constraints": { 573 "type": "object", 574 "additionalProperties": false, 575 "properties": { 576 "limit_disclosure": { "type": "string", "enum": ["required", "preferred"] }, 577 "statuses": { 578 "type": "object", 579 "additionalProperties": false, 580 "properties": { 581 "active": { "$ref": "#/definitions/status_directive" }, 582 "suspended": { "$ref": "#/definitions/status_directive" }, 583 "revoked": { "$ref": "#/definitions/status_directive" } 584 } 585 }, 586 "fields": { 587 "type": "array", 588 "items": { "$ref": "#/definitions/field" } 589 }, 590 "subject_is_issuer": { "type": "string", "enum": ["required", "preferred"] }, 591 "is_holder": { 592 "type": "array", 593 "items": { 594 "type": "object", 595 "additionalProperties": false, 596 "properties": { 597 "field_id": { 598 "type": "array", 599 "items": { "type": "string" } 600 }, 601 "directive": { 602 "type": "string", 603 "enum": ["required", "preferred"] 604 } 605 }, 606 "required": ["field_id", "directive"] 607 } 608 }, 609 "same_subject": { 610 "type": "array", 611 "items": { 612 "type": "object", 613 "additionalProperties": false, 614 "properties": { 615 "field_id": { 616 "type": "array", 617 "items": { "type": "string" } 618 }, 619 "directive": { 620 "type": "string", 621 "enum": ["required", "preferred"] 622 } 623 }, 624 "required": ["field_id", "directive"] 625 } 626 } 627 } 628 } 629 }, 630 "required": ["id"] 631 }, 632 "submission_requirement": { 633 "type": "object", 634 "oneOf": [ 635 { 636 "properties": { 637 "name": { "type": "string" }, 638 "purpose": { "type": "string" }, 639 "rule": { 640 "type": "string", 641 "enum": ["all", "pick"] 642 }, 643 "count": { "type": "integer", "minimum": 1 }, 644 "min": { "type": "integer", "minimum": 0 }, 645 "max": { "type": "integer", "minimum": 0 }, 646 "from": { "type": "string" } 647 }, 648 "required": ["rule", "from"], 649 "additionalProperties": false 650 }, 651 { 652 "properties": { 653 "name": { "type": "string" }, 654 "purpose": { "type": "string" }, 655 "rule": { 656 "type": "string", 657 "enum": ["all", "pick"] 658 }, 659 "count": { "type": "integer", "minimum": 1 }, 660 "min": { "type": "integer", "minimum": 0 }, 661 "max": { "type": "integer", "minimum": 0 }, 662 "from_nested": { 663 "type": "array", 664 "minItems": 1, 665 "items": { 666 "$ref": "#/definitions/submission_requirement" 667 } 668 } 669 }, 670 "required": ["rule", "from_nested"], 671 "additionalProperties": false 672 } 673 ] 674 }, 675 "presentation_definition": { 676 "type": "object", 677 "properties": { 678 "id": { "type": "string" }, 679 "name": { "type": "string" }, 680 "purpose": { "type": "string" }, 681 "format": { 682 "$schema": "http://json-schema.org/draft-07/schema#", 683 "title": "Presentation Definition Claim Format Designations", 684 "type": "object", 685 "additionalProperties": false, 686 "patternProperties": { 687 "^jwt$|^jwt_vc$|^jwt_vp$": { 688 "type": "object", 689 "additionalProperties": false, 690 "properties": { 691 "alg": { 692 "type": "array", 693 "minItems": 1, 694 "items": { "type": "string" } 695 } 696 } 697 }, 698 "^ldp_vc$|^ldp_vp$|^ldp$": { 699 "type": "object", 700 "additionalProperties": false, 701 "properties": { 702 "proof_type": { 703 "type": "array", 704 "minItems": 1, 705 "items": { "type": "string" } 706 } 707 } 708 } 709 } 710 }, 711 "frame": { 712 "type": "object", 713 "additionalProperties": true 714 }, 715 "submission_requirements": { 716 "type": "array", 717 "items": { 718 "$ref": "#/definitions/submission_requirement" 719 } 720 }, 721 "input_descriptors": { 722 "type": "array", 723 "items": { "$ref": "#/definitions/input_descriptor" } 724 } 725 }, 726 "required": ["id", "input_descriptors"], 727 "additionalProperties": false 728 } 729 }, 730 "type": "object", 731 "properties": { 732 "presentation_definition": {"$ref": "#/definitions/presentation_definition"} 733 } 734 }`