├── .github └── workflows │ └── auto-publish.yml ├── .pr-preview.json ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── FPWD └── 2021-08-26 │ ├── diagrams │ └── representation-specific-and-foreign-entries.png │ └── index.html ├── LICENSE.md ├── README.md ├── diagrams └── representation-specific-and-foreign-entries.png ├── index.html ├── reports ├── did-criteria-v4.0-public.pdf └── did-sec-priv-criteria-overview-public.pdf └── w3c.json /.github/workflows/auto-publish.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: {} 4 | push: 5 | branches: [main] 6 | jobs: 7 | main: 8 | name: Build, Validate and Deploy 9 | runs-on: ubuntu-20.04 10 | steps: 11 | - uses: actions/checkout@v2 12 | - uses: w3c/spec-prod@v2 13 | with: 14 | W3C_ECHIDNA_TOKEN: ${{ secrets.W3C_TR_TOKEN }} 15 | W3C_WG_DECISION_URL: https://www.w3.org/2019/did-wg/Meetings/Minutes/2021-08-17-did#resolution3 16 | W3C_BUILD_OVERRIDE: | 17 | shortName: did-imp-guide 18 | specStatus: WG-NOTE 19 | -------------------------------------------------------------------------------- /.pr-preview.json: -------------------------------------------------------------------------------- 1 | { 2 | "src_file": "index.html", 3 | "type": "respec" 4 | } 5 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. Unless a later match takes precedence, 3 | # they will be requested for review when someone opens a 4 | # pull request. 5 | * @msporny @OR13 @mprorock 6 | 7 | # See CODEOWNERS syntax here: https://help.github.com/articles/about-codeowners/#codeowners-syntax 8 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | Contributing to all documentation, code, and communication under this 4 | repository is covered by the 5 | [W3C Code of Ethics and Professional Conduct](https://www.w3.org/Consortium/cepc/). 6 | -------------------------------------------------------------------------------- /FPWD/2021-08-26/diagrams/representation-specific-and-foreign-entries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/w3c/did-imp-guide/ea63906a944687d0c10bc8067a20a3f050cc6b18/FPWD/2021-08-26/diagrams/representation-specific-and-foreign-entries.png -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | All documents in this Repository are licensed by contributors 2 | under the 3 | [W3C Document License](https://www.w3.org/Consortium/Legal/copyright-documents). 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![W3C Logo](https://www.w3.org/Icons/w3c_home) 3 | 4 | # DID Implementation Guide v1.0 5 | 6 | This repository contains a guide created by the 7 | [W3C Decentralized Identifier Working Group](https://www.w3.org/2019/did-wg/) 8 | (DID WG) for the purpose of helping implementers write software to 9 | interact with the DID ecosystem. 10 | 11 | An Editor's Draft of this repository is available at 12 | https://w3c.github.io/did-imp-guide/. 13 | 14 | ## Contributing to the Repository 15 | 16 | Use the standard fork, branch, and pull request workflow to propose changes to 17 | the registry. Please make branch names informative—by including the issue or 18 | bug number for example. 19 | 20 | Editorial changes that improve the readability of the registry or correct 21 | spelling or grammatical mistakes are welcome. 22 | 23 | Non-editorial changes MUST go through a review and approval process that is 24 | detailed in the registry. 25 | 26 | Please read [CONTRIBUTING.md](CONTRIBUTING.md), about licensing contributions. 27 | 28 | ## Code of Conduct 29 | 30 | W3C functions under a [code of conduct](https://www.w3.org/Consortium/cepc/). 31 | 32 | ## DID Working Group Repositories 33 | 34 | * [W3C DID Core Specification v1.0](https://github.com/w3c/did-core) 35 | * [W3C DID Working Group](https://github.com/w3c/did-wg) 36 | * [W3C DID Rubric v1.0](https://github.com/w3c/did-rubric) 37 | * [W3C DID Use Cases v1.0](https://github.com/w3c/did-use-cases) 38 | * [W3C DID Test Suite and Implementation Report](https://github.com/w3c/did-test-suite) 39 | -------------------------------------------------------------------------------- /diagrams/representation-specific-and-foreign-entries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/w3c/did-imp-guide/ea63906a944687d0c10bc8067a20a3f050cc6b18/diagrams/representation-specific-and-foreign-entries.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | DID Implementation Guide v1.0 6 | 7 | 12 | 13 | 15 | 17 | 18 | 111 | 131 | 132 | 133 | 134 |
135 |

136 | This document provides guidance to 137 | DID method 138 | developers, related to serialization, cryptographic primitive selection, 139 | governance, and interoperability. 140 |

141 |

142 | This document acts as a technical narrative for the implementation of 143 | DID methods and is expected to cover many topics related to that subject 144 | that a developer may wish to consider, including guidance around 145 | implementation details that may also be used for third party evaluation 146 | of an authored DID method via the DID-RUBRIC. 147 |

148 |

149 | Inclusion of discussion related to one subject matter or another does not 150 | imply a greater or lesser level of importance for that topic, only that 151 | some members of the W3C DID WG 152 | found importance in bringing a developer's attention to a particular topic. 153 |

154 |

155 | Guidance provided in this document does not necessarily reflect consensus 156 | of the W3C DID WG, although 157 | some members of the WG have contributed to it. 158 |

159 |
160 | 161 |
162 |

163 | Implementers are advised to consult this guide if they are directly 164 | involved with the W3C DID Working Group or are actively involved in 165 | authoring a DID method. 166 |

167 |
168 | 169 |
170 | 171 |
172 |

Terminology

173 |

174 | See [[DID-CORE]] for definitions of commonly-used 175 | DID terminology. 176 |

177 | 178 |
179 |
180 | 181 |
182 |

Methods

183 | 184 |

185 | See [[DID-CORE]] for normative requirements associated with developing 186 | DID methods. 187 |

188 | 189 |

190 | Avoid introducing requirements in your DID method specification that are 191 | neither described in [[DID-CORE]] nor registered in the 192 | [[DID-SPEC-REGISTRIES]]. 193 |

194 | 195 |

196 | Avoid constructing a new DID Method that is nearly identical to an 197 | existing DID Method. 198 |

199 | 200 |

201 | There are several "families" of DID methods, including 202 | Hyperledger 203 | Indy, Sidetree, and 205 | various methods that share similar smart contracts or rely on shared 206 | content addressing technology. 207 |

208 | 209 |

210 | Implementers are cautioned to write and regularly run integration and 211 | interoperability tests that span these "families", in order to ensure 212 | methods have sufficient support for open standards and real 213 | interoperability. 214 |

215 | 216 |

217 | The primary user-facing aspects of a DID method are its 218 | DID Syntax and its 219 | Verifiable Data Registry. 220 | Together these determine most of the unique properties of a DID method, 221 | and its privacy and security properties for comparison to other methods. 222 |

223 | 224 |

225 | DID method developers are encouraged to review and apply the 226 | [[DID-RUBRIC]] as early as possible in their development process to 227 | ensure that they are evaluating their DID method appropriately for the 228 | requirements of the problem they are attempting to solve with the 229 | introduction of a new DID method. 230 |

231 | 232 |
233 |

Method Reuse is Encouraged

234 |

235 | While many forms of decentralization are desired, some convergence upon 236 | widely useful DID methods is considered beneficial. 237 | If you are considering defining a new DID method, consider first 238 | surveying existing defined DID methods to see if there may be an 239 | already existing method that may meet your needs. Many DID method 240 | specifications can be found listed in the [[DID-SPEC-REGISTRIES]]. Some 241 | DID methods have been evaluated against various criteria in the 242 | [[DID-RUBRIC]]. Some DID methods have implementation data in the 243 | DID Test Suite, 244 | which could be useful as references for some criteria. If no existing 245 | DID method fully meets your needs, but some appear that they may be 246 | modifiable or extensible to do so, consider contacting the DID method 247 | specification author(s) or following other established procedures 248 | to see if collaboration may be possible to support your use case. Some 249 | DID methods have built-in extensibility points (such as 250 | registry-like mechanisms) to support new key types, discovery methods, 251 | etc. 252 |

253 |
254 | 255 |
256 |

DID Syntax

257 |

258 | See [[DID-CORE]] for normative requirements associated with developing 259 | DID Syntax. 260 |

261 |

262 | Avoid allowing users to control the structure of the DID Unique 263 | Suffix, also referred to as the method-specific-id in the 264 | DID Syntax ABNF. This 265 | can be accomplished by coupling the 266 | Create operation 267 | canonical representation to the method-specific-id. It can 268 | also be accomplished by leveraging sources of entropy. 269 |

270 | 271 |

272 | Avoid vanity DIDs such as, for example, 273 | did:example:deadbeef1f236.... The structure of the 274 | identifier should not be relied on for anything other than collision 275 | resistance. Be especially careful of trusting a relationship between a 276 | DID subject and 277 | DID controller 278 | without relying on a cryptographically secure 279 | verification 280 | relationship 281 | for authentication. 282 | Anyone can claim a DID, but only someone who controls the associated 283 | keys can authenticate their association with the DID. 284 | For example `did:example:xyzcorp` should not be assumed to belong to 285 | XYZ Corp. 286 |

287 | 288 |

289 | Depending on the nature of the 290 | VDR, publishing 291 | type or kind might be advantageous for 292 | decentralized discovery or mass surveillance. Implementers are not to 293 | rely on conformance to specification text while implementing 294 | decentralized identifiers. 295 |

296 |
297 | 298 |
299 |

Verifiable Data Registry

300 | 301 |

302 | See [[DID-CORE]] for normative requirements associated with developing 303 | Verifiable Data 304 | Registries. 305 |

306 | 307 |

308 | The VDR is the system to which 309 | DID method operations 310 | such as Create, Resolve, Update, and Deactivate are applied. 311 |

312 | 313 |

314 | Typically a globally-unique, tamper-evident, immutable log is used to 315 | produce a verifiable data registry. 316 |

317 | 318 |

319 | Blockchains or distributed ledgers are popular choices for building 320 | verifiable data registries, but there are other solutions. Each yield 321 | unique security pros and cons. 322 |

323 | 324 |

325 | Some DID methods rely on centralized trusted service providers and 326 | Merkle proofs to provide tamper-evident logs without the costs 327 | associated with distributed consensus. 328 |

329 | 330 |

331 | Some DID methods rely on multiple registries that may not be globally 332 | available. 333 |

334 | 335 |

336 | Some DID methods might rely on legacy security infrastructure, such as 337 | Transport Layer 338 | Security or 339 | Tor. 340 |

341 | 342 |

343 | Few DID methods support portability across verifiable data 344 | registries. Altering the VDR associated with a DID will almost 345 | certainly impact Privacy and Security considerations. 346 |

347 | 348 |

349 | Instead of designing complex DID methods with registry portability, 350 | consider supporting multiple DID methods that have each been designed 351 | to support disjoint security and/or privacy consideration, such as 352 | global discoverability, offline functionality, pairwise uniqueness, 353 | linkage to existing roots of trust such as websites, etc. 354 |

355 | 356 |

357 | Depending on the nature of the VDR, it may be desirable to store data 358 | other than DID documents, such as verifiable credentials, 359 | templates or schemas for credentials, discovery metadata, or integrity- 360 | or content-addressable identifiers for related information. 361 |

362 |
363 | 364 |
365 |

Establishing a DID

366 | 367 |

368 | In order to create secure DID systems, it is important to consider the 369 | process of establishing a Decentralized Identifier. 370 |

371 | 372 | 373 |

374 | Establishing cryptographic assurances for the identifier from its 375 | inception is critical to ensuring that the security of the system isn't 376 | compromised through attacks against the creation process. 377 |

378 | 379 |

A commonly observed process for establishing a decentralized identifier 380 | is:

381 |
    382 |
  1. 383 | Obtain entropy from a source of randomness that is as 384 | close to actually random as possible. 385 |
  2. 386 |
  3. Generate a first verification method from entropy.
  4. 387 |
  5. Use the first verification method to perform a DID Create 389 | operation.
  6. 390 |
391 |

392 | The Create Operation will often use the first verification method 393 | directly, or a deterministic 394 | function thereof, such as a hash, to construct and register the DID. 395 |

396 |

397 | True randomness is hard to get. Public sources such as the 398 | NIST 400 | Randomness Beacon 401 | are reliable but not appropriate for use directly as a secret key. See 402 | the section on Randomness for more information. 403 |

404 |
405 | 406 | 407 | 408 |
409 |

DID Resolution

410 | 411 |

412 | See [[DID-CORE]] for normative requirements associated with developing 413 | DID Resolution. 414 |

415 | 416 |

417 | DID resolution is a function which takes a DID, and produces a DID 418 | resolution result in a representation, most commonly 419 | JSON. 420 |

421 | 422 | 423 | 424 |

425 | DID resolution can be proxied through intermediaries such as 426 | command-line 427 | tools or HTTP servers. Because the DID document contains key 428 | material, such intermediaries represent excellent targets for attackers, 429 | who can use the intermediaries to tamper with verification 430 | relationships. 431 |

432 | 433 |

434 | Avoid tampering with a DID document that has been returned by a 435 | DID resolver. 436 | It is better to throw an error than to attempt to solve problems 437 | in the underlying DID method. 438 |

439 | 440 |

441 | Avoid transforming DID documents without the consent of the DID subject 442 | or controller. 443 |

444 | 445 |

446 | Whenever possible, run all software necessary to support a DID Method 447 | yourself. 448 |

449 | 450 |
451 |

DID URL Syntax

452 | 453 |

454 | See [[DID-CORE]] for normative requirements associated with developing 455 | DID URL Syntax. 456 |

457 | 458 |

459 | DID URLs 460 | can be used to identify sub-resources inside a DID document, 461 | older versions of a DID document, or resources outside of a DID 462 | document. 463 |

464 | 465 |
 467 |         did:example:123#primary
 468 |         
469 | 470 |
 472 |           did:example:123#agent
 473 |           
474 | 475 |
 477 |           did:example:123?service=packages@relativeRef=/jose/versions/v0.1.2/archive.zip
 478 |           
479 | 480 |

481 | Adjusting any part of a DID URL, including the did, 482 | path, or query, changes the identifier. 483 |

484 | 485 |

486 | The resource identifiers did:example:123, 487 | did:example:123/path and 488 | did:example:123?args=1 each identify a unique resource. 489 |

490 | 491 |
492 |

Path

493 | 494 |

495 | See [[DID-CORE]] for normative requirements associated with 496 | developing 497 | Path. 498 |

499 |

500 | Avoid using path; as of this writing, there are not 501 | enough 502 | implementations that make use of it. 503 |

504 | 505 |
 507 |           did:example:123/ephemeral/77d66171-b290-489c-abf1-95ae10725201#primary
 508 |           
509 |
510 | 511 |
512 |

Query

513 | 514 |

515 | See [[DID-CORE]] for normative requirements associated with 516 | developing 517 | Query. 518 |

519 | 520 |

521 | Avoid using query; as of this writing, there are not 522 | enough 523 | implementations that make use of it. 524 |

525 | 526 |
 528 |           did:example:123?versionId=77d66171-b290-489c-abf1-95ae10725201#primary
 529 |         
530 |
531 | 532 |
533 |

Fragment

534 | 535 |

536 | See [[DID-CORE]] for normative requirements associated with 537 | developing 538 | Fragment. 539 |

540 | 541 |
 543 |           did:example:123#primary
 544 |         
545 | 546 |

547 | Fragments identify sub-resources of a resource identified with a 548 | DID URL. 549 |

550 | 551 |

552 | The interpretation of the fragment is determined by the 553 | Media Type 554 | (formerly known as a MIME type). 555 |

556 |
557 |
558 | 559 |
560 |

Representations

561 | 562 |

563 | See [[DID-CORE]] for normative requirements associated with developing 564 | Representations. 565 |

566 | 567 |

568 | The [[DID-CORE]] specification describes representations. The 569 | [[DID-SPEC-REGISTRIES]] supports the registration of an unbounded 570 | number of alternative representations. 571 |

572 | 573 |

Each representation has unique pros and cons.

574 | 575 |

576 | DID methods are responsible for producing a DID document in the 577 | requested representation. 578 |

579 | 580 |

581 | DID method implementers may choose to return verification methods in 582 | alternate formats for representations, for example, an implementer 583 | might prefer to return verification material encoded with 584 | publicKeyJwk for application/did+json and 585 | publicKeyBase58 for application/did+ld+json. 586 |

587 | 588 | 589 |

590 | This sentence above is contested, see 592 | this conversation. 593 |

594 | 595 |

596 | Avoid allowing arbitrary unknown properties such as 597 | __proto__ 598 | or other characters that might be used to attack JSON parsing into 599 | application/did+json . 600 |

601 | 602 |

603 | While application/did+json is very flexible and allows 604 | for arbitrary JSON, implementers are cautioned to implement security 605 | in depth. 606 |

607 | 608 |

609 | Implementers are cautioned to review 610 | OWASP Top 10 611 |

612 | 613 |

614 | Implementers should confirm that each representation they decide to 615 | support is interoperable with the same representation in other DID 616 | Methods. 617 |

618 | 619 |

620 | Implementers should avoid guessing about conformance to [[DID-CORE]]. 621 |

622 | 623 |
624 |

DID URL Dereferencing

625 |

626 | See [[DID-CORE]] for normative requirements associated with 627 | developing 628 | DID URL 629 | Dereferencing. 630 |

631 | 632 |

633 | Dereferencing is critical to integrating with cryptographic toolkits 634 | such as Linked Data 635 | Proofs, 636 | JOSE, 637 | PGP, or 638 | Anon 640 | Creds. 641 |

642 |
643 | 644 |
645 |

application/did+json

646 |
647 | 648 |
649 |

application/did+ld+json

650 |
651 |
652 |
653 | 654 |
655 |

Verification Relationships

656 |

657 | See [[DID-CORE]] for normative requirements associated with developing 658 | Verification 659 | Relationships. 660 |

661 | 662 |

663 | Verification relationships are loosely equivalent to the concept of key 664 | purpose. 665 |

666 | 667 |

668 | It is considered a security best practice not to reuse the same key for 669 | multiple purposes. 670 |

671 | 672 |
673 |

Authentication

674 |

675 | See [[DID-CORE]] for normative requirements associated with developing 676 | Authentication verification 677 | relationships. 678 |

679 |

680 | Implementers are advised to implement support for this relationship. 681 |

682 |

683 | Use this relationship for proofs or signatures associated 684 | with DID Subject authentication. 685 |

686 | 687 |

Avoid conflating authentication and authorization.

688 | 689 |

690 | Avoid leveraging alternative relationships for the purpose of 691 | authentication. 692 |

693 |
694 | 695 |
696 |

Assertion Method

697 |

698 | See [[DID-CORE]] for normative requirements associated with developing 699 | Assertion verification 700 | relationships. 701 |

702 |

703 | Implementers are advised to implement support for this relationship. 704 |

705 |

706 | Use this relationship for proofs or signatures associated 707 | with claims issued by this DID Subject about another identifier, which 708 | might be a DID. 709 |

710 | 711 |

712 | This method is described in the [[VC-DATA-MODEL]], see 713 | Proofs. 714 |

715 | 716 |

717 | Avoid leveraging alternative relationships for the purpose of issuing 718 | credentials. 719 |

720 |
721 |
722 | 723 |
724 | 725 |
726 |

Data Model and Representations

727 | 728 |

729 | See [[DID-CORE]] for normative requirements associated with the 730 | Data Model. 731 |

732 | 733 |

734 | See [[DID-CORE]] for normative requirements associated with 735 | Representations. 736 |

737 | 738 |

739 | There is no strong consensus regarding preserving data model properties 740 | across representations. 741 | Removing properties when converting a 742 | DID document can result in 743 | an inability to maintain 744 | interoperability with [[VC-DATA-MODEL]]. See Drawbacks and Benefits. 745 |

746 | 747 |
748 |

Drawbacks

749 | 750 |

751 | The DID document data model 752 | contains properties (such as `id`, 754 | `verificationMethod`, and `service`), which are 755 | defined in a way that is independent of a concrete representation. There 756 | are a number of known 757 | representations, 758 | including 759 | JSON 760 | and JSON-LD (defined by DID Core), and 762 | CBOR 764 | (defined by a DID WG Note). Additional representations 765 | (such as XML, YAML, CBOR-LD, and others) are possible and could be 766 | defined 767 | in the future. For each of these 768 | representations, a combination of production and consumption rules 769 | defines the concrete syntax of properties, 770 | but 771 | the semantics of properties are independent of any given representation. 772 | In other words, in every 773 | representation 774 | of a DID document, 775 | there is always a way to represent a `service` or a 776 | `verificationMethod`, and their meanings 777 | are consistent across conformant representations. 778 |

779 | 780 |

781 | In addition to properties, a DID document may contain 783 | representation-specific 785 | entries which may be 786 | required by certain representations in order to fully represent the 787 | DID document data model and its 788 | properties. For example, the JSON-LD 789 | representation of a DID document 790 | (with media type 791 | `application/did+ld+json`) requires the 792 | `@context` representation-specific entry, in order to correctly express 793 | the semantics of properties such as 794 | `id`, 795 | `verificationMethod` or `service` within the JSON-LD representation. 796 | This enables JSON-LD’s semantics which are 797 | based on a decentralized, permissionless, open-world data model. 798 |

799 | 800 |

801 | In contrast to this, the (non-LD) JSON 802 | representation (with media type `application/did+json`) does not 803 | have this semantic 804 | capability; instead, (non-LD) JSON documents always need agreement on 805 | semantics in some out-of-band way that is 806 | not part of the document itself. In the case of DID documents using the 807 | (non-LD) JSON representation, those 808 | semantics are 809 | typically established by the DID Spec 811 | Registries. 812 | Therefore, 813 | establishing semantics of DID document properties in the (non-LD) JSON 814 | representation does not require 815 | the representation-specific `@context` entry, as is required by the 816 | JSON-LD representation. 817 |

818 | 819 |

820 | As with the (non-LD) JSON representation compared to the JSON-LD 821 | representation, similar considerations apply between the (non-LD) CBOR 822 | representation and the CBOR-LD representation. 823 |

824 | 825 |

826 | Other examples of representation-specific 828 | entries could be XML 829 | namespace definitions or YAML tags, although 830 | these particular representations have not been defined at the time of 831 | this writing. 832 |

833 | 834 |

835 | If an entry that is specific to one representation appears in another 836 | representation, it can be called a 837 | representation-foreign entry. An example of this is a 838 | `@context` 839 | entry appearing in the 840 | `application/did+json` 841 | representation. 842 |

843 | 844 |

845 | Examples of representation-specific 847 | entries and 848 | representation-foreign entries: 849 |

850 | 851 |
852 | Examples of representation-specific and representation-foreign entries in various representations. 855 |
856 | Representation-specific and representation-foreign entries. 857 |
858 |
859 | 860 |
861 |

862 | Avoid representation-foreign entries 863 |

864 | 865 |

866 | It is bad practice and potentially harmful for producers to include 867 | "representation-foreign entries" in DID 868 | documents. 869 |

870 | 871 |

872 | Different implementations of DID document consumers may or may not be 873 | able to properly understand the meaning 874 | and processing rules of representation-foreign entries. Since DIDs and 875 | DID documents form an open ecosystem 876 | with 877 | many producers and consumers, a producer cannot anticipate the 878 | behavior of a consumer with regard to 879 | representation-foreign entries. 880 |

881 | 882 |

883 | For example, if a producer adds an 884 | @context 885 | entry to a DID document in the 886 | application/did+json 887 | representation, some consumers (those that understand JSON-LD, such as 888 | JSON-LD document loaders) may process 889 | it 890 | in one way, while other consumers (those that only understand plain 891 | JSON, without any JSON-LD specific rules) 892 | may process it in a different way. 893 |

894 | 895 |

896 | This can lead to inconsistent behavior by consumers that cannot be 897 | predicted by a producer. 898 |

899 | 900 |
901 | 902 |
903 |

904 | Reliance on representation-foreign entries 905 |

906 | 907 |

908 | It is bad practice and potentially harmful for consumers to rely on 909 | representation-foreign entries in DID 910 | documents. 911 |

912 | 913 |

914 | As a special case of the previous section, certain consumers may go as 915 | far as relying on the presence of 916 | representation-foreign entries. For example, an incorrectly 917 | implemented consumer of DID documents in the 918 | `application/did+json` representation may attempt to apply JSON-LD 919 | tooling to that representation. That 920 | tooling 921 | is dependent on the presence of the `@context` representation-foreign 922 | entry, which is not actually required 923 | (and 924 | in fact discouraged) to be used in the `application/did+json` 925 | representation. 926 |

927 | 928 |

929 | The result is lack of interoperability, since such consumers will 930 | throw errors even if the returned DID 931 | document 932 | representation is actually conformant. 933 |

934 | 935 |
936 | 937 |
938 |

939 | Security problems with representation-foreign entries 940 |

941 | 942 |

943 | If some implementations of DID document consumers process 944 | representation-foreign entries, and others don’t, 945 | then 946 | this can lead to security holes, since the semantics of DID document 947 | properties will not be interpreted in a 948 | predictable way. 949 |

950 | 951 |

952 | For example, consider the following DID document, and assume that the 953 | JSON-LD context 954 | `https://example.com/myextensions/other-definitions.jsonld` defines 955 | `blockchainAccountId` in a way that is different 956 | from the property 958 | listed in the DID 959 | Specification Registries. 960 |

961 | 962 |
 964 | {
 965 |   "@context":[
 966 |     "https://www.w3.org/ns/did/v1",
 967 |     "https://example.com/myextensions/other-definitions.jsonld"
 968 |   ],
 969 |   "id":"did:example:123456789abcdefghi",
 970 |   "verificationMethod":[{
 971 |     "id": "did:example:123456789abcdefghi#vm-3",
 972 |     "controller": "did:example:123456789abcdefghi",
 973 |     "type": "EcdsaSecp256k1RecoveryMethod2020",
 974 |     "blockchainAccountId": "eip155:1:0xF3beAC30C498D9E26865F34fCAa57dBB935b0D74"
 975 |   }]
 976 | }
 977 |       
978 | 979 |

980 | If this DID document is consumed as `application/did+json` by an 981 | implementation that doesn't understand 982 | JSON-LD, 983 | it will interpret `blockchainAccountId` as the property 985 | listed in the DID 986 | Specification Registries, and it will process it accordingly. 987 |

988 | 989 |

990 | If the exact same DID document is consumed as `application/did+json` 991 | by an implementation that understands 992 | JSON-LD, it may interpret `blockchainAccountId` using the provided 993 | JSON-LD context, and therefore process it 994 | differently. 995 |

996 | 997 |

998 | It is a common mistake to claim that "JSON-LD is just JSON", and to 999 | justify injecting the `@context` 1000 | representation-foreign entry into a DID document in the 1001 | `application/did+json` representation. This claim 1002 | however is true only on the syntax level, but wrong and dangerous on 1003 | the semantic level, especially when 1004 | security-related properties are involved. In the example above, 1005 | different consumer implementations are likely 1006 | to 1007 | come to different conclusions on how the DID can be controlled. 1008 |

1009 | 1010 |

1011 | Representation-foreign entries in DID documents should be avoided, 1012 | since they can lead to inconsistent and 1013 | unpredictable DID control decisions. 1014 |

1015 | 1016 |
1017 | 1018 |
1019 |

1020 | Conversion between Representations 1021 |

1022 | 1023 |

1024 | The DID document data model and the production/consumption rules of 1025 | representations have been designed to 1026 | enable 1027 | lossless conversion between representations. Conversion between 1028 | representations is achieved by executing the 1029 | consumption rules of the source representation, and then the 1030 | production rules of the target representation. 1031 |

1032 | 1033 |

1034 | The DID Specification Registries [[DID-SPEC-REGISTRIES]] provide additional 1035 | information about properties as well as representation-specific 1036 | entries that help with such conversion. For 1037 | example, a DID document in the `application/did+json` representation 1038 | can be converted to the 1039 | `application/did+ld+json` representation by adding a `@context` 1040 | representation-specific entry during 1041 | production, 1042 | using the JSON-LD context information in the DID Specification Registries [[DID-SPEC-REGISTRIES]]. 1043 |

1044 | 1045 |

1046 | Conversely, a DID document in the `application/did+ld+json` 1047 | representation can be converted to the 1048 | `application/did+json` representation by removing the `@context` 1049 | representation-specific entry during 1050 | consumption. 1051 |

1052 | 1053 |

1054 | Representation-foreign entries in DID documents should be avoided, 1055 | since the implications on lossless 1056 | conversion 1057 | between representations is unclear. 1058 |

1059 | 1060 |
1061 | 1062 |
1063 | 1064 |
1065 |

Benefits

1066 | 1067 |

1068 | Implementers are not required to support all representations. 1069 | For example, an implementation might choose to only support 1070 | application/did+json, 1071 | and choose not to support application/did+ld+json, 1072 | application/did+dag+cbor, 1073 | application/did+xml, application/did+yaml, 1074 | etc... 1075 |

1076 | 1077 |

1078 | Implementers might prefer to use JSON or YAML representations to 1079 | implement both the 1080 | abstract data model and concrete reprepresentations. 1081 |

1082 | 1083 |

1084 | When converting between an implementation of the abstract data model and 1085 | a 1086 | representation that is capable of preserving all properties, 1087 | all properties SHOULD be preserved. 1088 |

1089 | 1090 |

For example, preserving @context in YAML, 1091 | allows for the document to later be used with 1092 | documentLoaders 1094 | that use 1095 | JSON-LD Framing 1096 | to perform 1097 | dereferencing. 1098 |

1099 | 1100 |
1102 | ---
1103 | "@context":
1104 | - https://www.w3.org/ns/did/v1
1105 | - https://w3id.org/security/suites/jws-2020/v1
1106 | id: did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1107 | verificationMethod:
1108 | - id: did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6#z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1109 |   type: JsonWebKey2020
1110 |   controller: did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1111 |   publicKeyJwk:
1112 |     kty: EC
1113 |     crv: P-384
1114 |     x: ELYfgFzSi43VGgKlyuYBKeoW00DmNqf5VuMWD1iUTTHQ8NRQrR4KHShzH_DrvOhh
1115 |     y: sftqdHdso4JPQO3MLnsXmWbAFqjmHLgP8H_DZSLxx3ei9kLj_W3R6NhtH03bwE1C
1116 | assertionMethod:
1117 | - did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6#z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1118 | authentication:
1119 | - did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6#z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1120 | capabilityInvocation:
1121 | - did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6#z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1122 | capabilityDelegation:
1123 | - did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6#z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1124 | keyAgreement:
1125 | - did:key:z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6#z82Lkm8gN2PGD7WbUiTUKRHgSptPhGPAQG9HT9HybYE9LoKYwcikh5rAU9gGo3qTne3ZHf6
1126 | 
1127 |       
1128 | 1129 |

Preserving members across representations is also common 1130 | in 1131 | OpenAPI Specification 1132 | 3.1.0, 1133 | which supports 1134 | JSON 1136 | Schema 1137 | represented as YAML or JSON. 1138 |

1139 | 1140 |

DID methods that support both application/did+ld+json and 1141 | application/did+json 1142 | ought to return application/did+json with an 1143 | @context, because it enables 1144 | both representations to be used with tooling and standards that support 1145 | semantics (such as [[VC-DATA-MODEL]]), 1146 | and because the default behavior of JSON processors is to ignore object 1147 | members that are not understood. 1148 |

1149 | 1150 |

DID document representations produced by an implementation ought to be 1151 | treated as immutable, 1152 | since any tampering, including adding, removing, or reordering core or 1153 | representation specific entries 1154 | might be considered malicious, since it alters the integrity of the 1155 | produced DID document.

1156 | 1157 |
1158 |
1159 | 1160 |
1161 |

Privacy Considerations

1162 | 1163 |

1164 | Decentralized Identifiers, like any other technology, can be used to 1165 | enhance privacy as well as harm privacy. This section speaks to topics 1166 | that implementers might consider when thinking about the privacy 1167 | characteristics of their software systems. 1168 |

1169 | 1170 |
1171 |

1172 | Dealing with Personal Data 1173 |

1174 | 1175 |

1176 | Never store personal data, even in an encrypted format, on any 1177 | verifiable data 1178 | registry backed by immutable storage. 1179 |

1180 | 1181 |

1182 | It is the DID method implementer's responsibility to think about and 1183 | identify 1184 | the extent to which personal data may be included in a DID document. 1185 |

1186 | 1187 |

1188 | Software should at least display a warning and ask for confirmation 1189 | before creating 1190 | or updating any properties of a DID document that depend on user 1191 | provided inputs. 1192 |

1193 | 1194 |

1195 | A DID method specification should have a section dedicated to personal 1196 | data covering the extent to 1197 | which information published on the corresponding ledger can be updated 1198 | or deleted. 1199 | It should provide specific instructions of how to do so, if it is 1200 | possible. 1201 | Otherwise, it should clearly state that it is not possible. 1202 |

1203 | 1204 |

1205 | A DID method should avoid "phone home" or tracking characteristics that 1206 | would 1207 | permit tracing of a user in manner not understood or authorized by the 1208 | user 1209 | by some third party. 1210 |

1211 |
1212 | 1213 |
1214 |

Avoid correlation

1215 | 1216 |

1217 | Avoid reusing verification methods across DID Methods. 1218 |

1219 | 1220 |

1221 | Avoid reusing services with unique parameters across DID Methods. 1222 |

1223 | 1224 |

1225 | Any anonymous identifier, even if it is generated randomly, can be used 1226 | to 1227 | infer sensitive information about a 1228 | DID subject 1229 | if it is reused enough times. 1230 |

1231 | 1232 |

1233 | A DID method implementer should rotate keys and identifiers as often as 1234 | possible 1235 | to avoid correlation 1236 |

1237 |
1238 | 1239 |
1240 |

Anonymity

1241 | 1242 |

1243 | Consider formally modeling the privacy implications associated with 1244 | your implementation using 1245 | t-closeness or 1246 | other mechanisms. 1247 |

1248 | 1249 |

1250 | If your DID Method supports global enumeration and indexing, consider 1251 | exposing this information publicly. You may wish to provide alerts 1252 | similar to services that watch version control systems for sensitive 1253 | information that is accidentally leaked. 1254 |

1255 |
1256 | 1257 |
1258 |

Compliance

1259 | 1260 |

1261 | Review any applicable local law when considering developing or 1262 | operating a decentralized identifier method. 1263 |

1264 | 1265 |

Consider GDPR.

1266 | 1267 |

Consider CCPA.

1268 | 1269 |

Consider EAR. 1271 |

1272 |
1273 |
1274 | 1275 |
1276 |

Security Considerations

1277 | 1278 |

1279 | Decentralized Identifiers are security primitives that are often used to 1280 | secure important systems. This section speaks to topics that 1281 | implementers might consider when thinking about the security 1282 | characteristics of their software systems. 1283 |

1284 | 1285 |

1286 | Pay very close attention to the defense, cryptographic agility, and 1287 | political 1288 | acceptability of any cryptography you rely on for DID Method security. 1289 |

1290 | 1291 |

1292 | Avoid complex or slow signature formats, especially if they are poorly 1293 | documented, or do not have an open standard with well documented test 1294 | vectors. 1295 |

1296 | 1297 |

1298 | Avoid open source implementations that are declared a "defacto 1299 | standard", but lack open standard technical specifications. 1300 |

1301 | 1302 |

1303 | Support for legacy cryptography systems such as 1304 | JOSE 1305 | and OpenPGP should be considered 1306 | due to their prevalence in existing systems. 1307 |

1308 | 1309 |
1310 |

Vendor Lock In

1311 |

1312 | Competition, direct substitutability, interoperability, and mutual 1313 | feature support are key to reducing the barriers to adoption of, and 1314 | increasing confidence in, your DID Method. 1315 |

1316 | 1317 |

1318 | Avoid inventing "new features". Work with others to find a common way 1319 | to express any new features that are not unique to your DID Method. 1320 |

1321 | 1322 |

1323 | Avoid hard coupling to specific networks, such as Bitcoin or 1324 | Hyperledger Fabric. Design your method such that it may be adapted 1325 | to support multiple ledger systems. 1326 |

1327 | 1328 |

1329 | Transparency and openness in approaches related to security not only 1330 | lead to greater security, but promote interoprability and adoption. 1331 |

1332 |
1333 | 1334 |
1335 |

Digital Signatures

1336 | 1337 |

1338 | We recommend the user review 1339 | safecurves.cr.yp.to before 1340 | selecting elliptic curve types. A key note however, is that several 1341 | items on safecurves are less frequently updated. 1342 | In addition to safecurves you should always check the top level 1343 | standards 1344 | and any docs which superseed referenced standards in safecurves, 1345 | especially 1346 | 1347 | FIPS 186-4 and 1348 | 1350 | SP 800-56A Rev 3 when evalutating curves for use. 1351 |

1352 | 1353 |

Avoid secp256k1, RSA, P-256, P-384 and P-521.

1354 | 1355 |

1356 | Avoid relying on smart contracts for complex data management. If you 1357 | must use a smart contract, keep it simple and architect a solution 1358 | that supports data migration. 1359 |

1360 |
1361 | 1362 |
1363 |

Hashing Algorithms

1364 | 1365 |

Avoid MD5, SHA1, and other legacy hashing algorithms with known 1366 | weaknesses 1367 | or high collision rates. 1368 |

1369 |

1370 | When in doubt in selection of a hashing algorithm, consult the 1371 | 1372 | NIST documentation related to hash function selection, 1373 | 1374 | SHA-3 as described in FIPS 202 1375 | should be strongly considered for new implementations 1376 |

1377 |
1378 | 1379 |
1380 |

Randomness

1381 | When making an implemention carefully consider how you are sourcing 1382 | random numbers. Consult 1383 | RFC 4086: 1384 | Randomness Requirements for Security 1385 | when selecting an approach to get random bits, and pay careful attention 1386 | to the platform and any underlying hardware that may be in use as multiple 1387 | attacks have been performed in the wild due to improper selection of 1388 | random values in key material and other aspects of cryptography. 1389 |
1390 | 1391 |
1392 |

Zero Knowledge Proofs

1393 | 1394 |

1395 | Consider using 1396 | BBS+ Signatures 1397 | for selective disclosure and linked-secret–based JSON-LD 1398 | verifiable 1399 | credentials. 1400 |

1401 | 1402 |

1403 | The IETF document on 1404 | 1406 | Pairing Friendly Curves 1407 | should be consulted when selecting curves for usage with zero 1408 | knowledge proofs, 1409 | especially to ensure that appropriate embedding degrees are selected, 1410 | and that 1411 | the resulting equivalent bit characteristics are sufficient. 1412 |

1413 | 1414 |

1415 | Avoid zero knowledge proofs as described in the 1416 | AnonCredDerivedCredentialv1. 1418 | This proof format is coupled to specific ledger technologies, 1419 | similar to the concept of an ethereum virtual machine smart contract 1420 | only running on EVM compatible ledgers. Ledger-specific technologies 1421 | should be avoided when designing for portable, interoperable, and 1422 | open-standards–based zero knowledge proofs. 1423 |

1424 | 1425 |

1426 | Avoid storing credential schemas on ledgers. Many DID methods cannot 1427 | store information other than a DID Document, which reduces the direct 1428 | interoperability, substitutability, and cost effectiveness of 1429 | solutions that make use of rare or poorly supported features such as 1430 | credential schema definition storage. 1431 |

1432 |
1433 | 1434 |
1435 |

Biometrics

1436 | 1437 |

Avoid relying exclusively on biometrics.

1438 | 1439 |

1440 | Hardware-isolated keys protected by biometrics on devices may increase 1441 | the usability of DIDs. 1442 |

1443 | 1444 |

1445 | The addition of biometrics to other techniques can aid in certain tasks 1446 | such as reauthentication. 1447 | NIST SP 1448 | 800-63B 1449 | deals directly with digital identity and has several useful sections 1450 | that address appropriate language for describing biometrics usage as 1451 | well 1452 | as techniques for incorporating biometrics into an approach for solving 1453 | problems related to digital identity. 1454 |

1455 |
1456 |
1457 | 1458 |
1459 |

Ethical Considerations

1460 | 1461 |

1462 | The following section details certain key areas of focus when implementing a 1463 | new DID method, or implementing a solution that incorporates DIDs. 1464 |

1465 | 1466 |

1467 | The W3C TAG 1469 | Ethical Web Principles document is a helpful guide 1470 | when weighing ethical considerations of various technologies. 1471 |

1472 | 1473 |
1474 |

Broad Ethical Principles

1475 |

1476 | Decentralized Identifiers may come to underpin much of our digital life. This 1477 | may include public social and career personas, as well as more private personas 1478 | shared among friends and family. Identifiers representing these personas and 1479 | relationships may be some of the most important in our lives, so great care 1480 | will be taken when choosing an identifier system to support these critical 1481 | activities. As with all things, the appropriate and ethical use of technology 1482 | will be strongly considered when implementing items related to DIDs. 1483 |

1484 | 1485 |

1486 | As noted in the 1488 | Principles section of the Ethical Web Principles, there are key goals that 1489 | apply to all Web standards and technologies. DIDs are explicitly intended to 1490 | help users get closer to several of these goals, especially the following: 1491 |

1508 |

1509 |
1510 | 1511 |
1512 |

Other concerns as applied to DID method development

1513 |

1514 | The following section reflects the views of some members of the working group. 1515 | Additional PRs are welcome from the working group with additional points of view. 1516 |

1517 | 1518 |
1519 |

Environmental Considerations

1520 | 1521 |

1522 | The guiding principle that 1523 | the 1524 | web must be an environmentally sustainable platform should be followed. 1525 |
1526 | When implementing or utilizing a DID method, consideration should be given 1527 | to the environmental impacts caused by the method. 1528 |

1529 | 1530 |

1531 | Some members of the working group feel it important that the [[DID-RUBRIC]] 1532 | include environmental considerations in order that users might appropriately evaluate 1533 | and compare relevant aspects of DID methods that might be applicable to their use cases. 1534 |

1535 |

Many methods minimize environmental impact by leveraging existing infrastructure, such as 1536 | the World Wide Web (with did:web) and Bitcoin (with did:btcr and did:ion). When considering any 1537 | particular approach, whether creating a new method or selecting among current methods, care 1538 | should be taken to distinguish between the marginal impact of the additional use of such 1539 | infrastructure as a result of the DID method and the existing impact from current use. For example, 1540 | the did:web implementation is unlikely to have a significant additive environmental impact above 1541 | and beyond the existing World Wide Web. 1542 |

1543 |
1544 | 1545 |
1546 | 1547 |
1548 | 1549 |
1550 |

Additional Guidelines

1551 | 1552 | 1569 | 1570 |
1571 | 1572 |
1573 |

Future Work

1574 |

1575 | This section was copied from 1576 | w3c/did-imp-guide, and 1577 | adjusted based on changes made to DID 1578 | Core. 1579 |

1580 | 1581 |
1582 |

Upper Limits on DID Character Length

1583 | 1584 |

1585 | The current specification does not take a position on the maximum length 1586 | of a 1587 | DID. 1588 | The maximum interoperable URL length is currently about 1589 | 2048 characters. QR codes can handle about 4096 characters. Clients 1590 | using DIDs 1591 | will be responsible for storing many DIDs, 1593 | and some methods would be able to externalize some of their costs 1594 | onto clients by relying on more complicated signature schemes or by 1595 | adding state into DIDs 1597 | intended for temporary use. A future 1598 | version of this specification should set reasonable limits on 1599 | DID character 1600 | length to minimize externalities. 1601 |

1602 |
1603 |
1604 |

Verifiable Timestamps

1605 | 1606 |

1607 | 1608 | Verifiable Timestamps have significant utility for identifier 1609 | records. This is a good fit for DLTs, since 1611 | most 1612 | offer some 1613 | type of timestamp mechanism. Despite some transactional cost, they 1614 | are the among the most censorship-resistant transaction ordering 1615 | systems at the present, so they are nearly ideal for 1616 | DID document 1617 | timestamping. In some cases a DLT's 1619 | immediate timing is approximate, however their sense of "median time 1620 | past" 1621 | 1623 | (see Bitcoin BIP 113) 1624 | can be precisely defined. A generic DID document timestamping 1626 | mechanism could would work across all DLTs and 1628 | might operate 1629 | via a mechanism including either individual transactions or 1630 | transaction batches. Such a generic mechanism was deemed out of scope 1631 | for this version, although it may be included in a future version of 1632 | this specification. 1633 |

1634 |
1635 | 1636 |
1637 |

Verifiable Credentials

1638 | 1639 |

1640 | Although DIDs 1641 | and DID documents form a 1642 | foundation for 1643 | decentralized identity, they are only the first step in describing 1644 | their subjects. The rest of the descriptive power comes through 1645 | collecting and selectively using Verifiable Credentials 1646 | [[VC-DATA-MODEL]]. Future versions of the specification will 1647 | describe in more detail how DIDs 1649 | and DID document can 1650 | be integrated with — and help enable — the Verifiable 1651 | Credentials ecosystem. 1652 |

1653 |
1654 | 1655 |
1656 |

Alternate Serializations and Graph Models

1657 | 1658 |

1659 | This version of the specification relies on JSON-LD and the RDF 1660 | graph model for expressing a DID document. Future 1662 | versions of 1663 | this specification might specify other semantic graph formats for a 1664 | DID document. 1665 |

1666 |
1667 |
1668 | 1669 | 1670 | 1671 | -------------------------------------------------------------------------------- /reports/did-criteria-v4.0-public.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/w3c/did-imp-guide/ea63906a944687d0c10bc8067a20a3f050cc6b18/reports/did-criteria-v4.0-public.pdf -------------------------------------------------------------------------------- /reports/did-sec-priv-criteria-overview-public.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/w3c/did-imp-guide/ea63906a944687d0c10bc8067a20a3f050cc6b18/reports/did-sec-priv-criteria-overview-public.pdf -------------------------------------------------------------------------------- /w3c.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": [117488] 3 | , "contacts": ["iherman"] 4 | , "repo-type": "note" 5 | , "shortName": "did-imp-guide" 6 | } 7 | --------------------------------------------------------------------------------