├── .gitignore ├── LICENSE.md ├── README.md ├── terms.html ├── common.js └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .cache 3 | .project 4 | .settings 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | All documents in this Repository are licensed by contributors under the 2 | [W3C Software and Document License](https://www.w3.org/Consortium/Legal/copyright-software). 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # did:key method driver _(did-method-key)_ 2 | 3 | [![Build Status](https://travis-ci.org/digitalbazaar/did-method-key.png?branch=master)](https://travis-ci.org/digitalbazaar/did-method-key) 4 | 5 | > A [DID](https://w3c-ccg.github.io/did-spec/) (Decentralized Identifier) method driver for the `did-io` library and for standalone use 6 | 7 | ## Table of Contents 8 | 9 | - [Background](#background) 10 | * [Example DID Document](#example-did-document) 11 | - [Security](#security) 12 | - [Install](#install) 13 | - [Usage](#usage) 14 | - [Contribute](#contribute) 15 | - [Commercial Support](#commercial-support) 16 | - [License](#license) 17 | 18 | ## Background 19 | 20 | See also (related specs): 21 | 22 | * [Decentralized Identifiers (DIDs) - Data Model and Syntaxes](https://w3c-ccg.github.io/did-spec/) 23 | * [Linked Data Cryptographic Suite Registry](https://w3c-ccg.github.io/ld-cryptosuite-registry/) 24 | * [Linked Data Proofs](https://w3c-dvcg.github.io/ld-proofs/) 25 | 26 | A `did:key` method driver for the [`did-io`](https://github.com/digitalbazaar/did-io) 27 | client library and for standalone use. 28 | 29 | The `did:key` method is used to express public keys in a way that doesn't 30 | require a DID Registry of any kind. Its general format is: 31 | 32 | ``` 33 | did:key: 34 | ``` 35 | 36 | So, for example, the following DID would be derived from a base-58 encoded 37 | ed25519 public key: 38 | 39 | ``` 40 | did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH 41 | ``` 42 | 43 | That DID would correspond to the following DID Document: 44 | 45 | ### Example DID Document 46 | 47 | ```json 48 | { 49 | "@context": "https://w3id.org/did/v1", 50 | "id": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH", 51 | "publicKey": [ 52 | { 53 | "id": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH", 54 | "type": "Ed25519VerificationKey2018", 55 | "controller": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH", 56 | "publicKeyBase58": "B12NYF8RrR3h41TDCTJojY59usg3mbtbjnFs7Eud1Y6u" 57 | } 58 | ], 59 | "authentication": [ 60 | "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH" 61 | ], 62 | "assertionMethod": [ 63 | "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH" 64 | ], 65 | "capabilityDelegation": [ 66 | "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH" 67 | ], 68 | "capabilityInvocation": [ 69 | "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH" 70 | ], 71 | "keyAgreement": [ 72 | { 73 | "id": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH#zBzoR5sqFgi6q3iFia8JPNfENCpi7RNSTKF7XNXX96SBY4", 74 | "type": "X25519KeyAgreementKey2019", 75 | "controller": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH", 76 | "publicKeyBase58": "JhNWeSVLMYccCk7iopQW4guaSJTojqpMEELgSLhKwRr" 77 | } 78 | ] 79 | } 80 | ``` 81 | 82 | ## Security 83 | 84 | The `keyAgreement` key is a Curve25519 public key (suitable for 85 | Diffie-Hellman key exchange) that is deterministically _derived_ from the source 86 | Ed25519 key, using [`ed2curve-js`](https://github.com/dchest/ed2curve-js). 87 | 88 | Note that this derived key is optional -- there's currently 89 | [no proof](https://crypto.stackexchange.com/questions/3260/using-same-keypair-for-diffie-hellman-and-signing/3311#3311) 90 | that this is safe to do. 91 | 92 | ## Install 93 | 94 | Requires Node.js 8.3+ 95 | 96 | To install locally (for development): 97 | 98 | ``` 99 | git clone https://github.com/digitalbazaar/did-method-key.git 100 | cd did-method-key 101 | npm install 102 | ``` 103 | 104 | ## Usage 105 | 106 | To generate a new key and get its corresponding `did:key` method DID Document: 107 | 108 | ```js 109 | const didKeyDriver = require('did-method-key').driver(); 110 | 111 | const didDocument = await didKeyDriver.generate(); // Ed25519 key type by default 112 | 113 | JSON.stringify(didDocument, null, 2); 114 | ``` 115 | 116 | To get a DID Document for an existing `did:key` DID: 117 | 118 | ```js 119 | const didDocument = await didKeyDriver.get({did: 'did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH'}); 120 | ``` 121 | 122 | (Results in the [example DID Doc](#example-did-document) above). 123 | 124 | If you have an existing [`crypto-ld`](https://github.com/digitalbazaar/crypto-ld) 125 | key pair, you can convert it to a `did:key` method DID Doc: 126 | 127 | ```js 128 | const {Ed25519KeyPair} = require('crypto-ld'); 129 | const {keyToDidDoc} = require('did-method-key').driver(); 130 | 131 | const edKey = await Ed25519KeyPair.generate(); 132 | 133 | keyToDidDoc(edKey); 134 | 135 | // Returns a DID Document 136 | ``` 137 | 138 | ## Contribute 139 | 140 | See [the contribute file](https://github.com/digitalbazaar/bedrock/blob/master/CONTRIBUTING.md)! 141 | 142 | PRs accepted. 143 | 144 | Small note: If editing the Readme, please conform to the 145 | [standard-readme](https://github.com/RichardLitt/standard-readme) specification. 146 | 147 | ## Commercial Support 148 | 149 | Commercial support for this library is available upon request from 150 | Digital Bazaar: support@digitalbazaar.com 151 | 152 | ## License 153 | 154 | [New BSD License (3-clause)](LICENSE) © Digital Bazaar 155 | -------------------------------------------------------------------------------- /terms.html: -------------------------------------------------------------------------------- 1 |

2 | The following terms are used to describe concepts in this specification. 3 |

4 | 5 |
6 |
claim
7 |
8 | An assertion made about a subject. 9 |
10 |
credential
11 |
12 | A set of one or more claims made by an issuer. A 13 | verifiable credential is a 14 | tamper-evident credential that has authorship that can be cryptographically 15 | verified. Verifiable credentials can be used to build 16 | verifiable presentations, which can also be cryptographically verified. 17 | The claims in a credential can be about different subjects. 18 |
19 |
data minimization
20 |
21 | The act of limiting the amount of shared data strictly to the minimum 22 | necessary to successfully accomplish a task or goal. 23 |
24 |
decentralized identifier
25 |
26 | A portable URL-based identifier, also known as a DID, 27 | associated with an entity. These identifiers are most often used in a 28 | verifiable credential and are associated with subjects such that a 29 | verifiable credential itself can be easily ported from one 30 | repository to another without the need to reissue the credential. 31 | An example of a DID is did:example:123456abcdef. 32 |
33 |
decentralized identifier document
34 |
35 | Also referred to as a DID document, this is a document 36 | that is accessible using a verifiable data registry and contains 37 | information related to a specific decentralized identifier, such as the 38 | associated repository and public key information. 39 |
40 |
derived predicate
41 |
42 | A verifiable, boolean assertion about the value of another attribute in a 43 | verifiable credential. These are useful in zero-knowledge-proof-style 44 | verifiable presentations because they can limit information disclosure. 45 | For example, if a verifiable credential contains an attribute 46 | for expressing a specific height in centimeters, a derived predicate 47 | might reference the height attribute in the verifiable credential 48 | demonstrating that the issuer attests to a height value meeting the 49 | minimum height requirement, without actually disclosing the specific height 50 | value. For example, the subject is taller than 150 centimeters. 51 |
52 |
digital signature
53 |
54 | A mathematical scheme for demonstrating the authenticity of a digital message. 55 |
56 |
entity
57 |
58 | A thing with distinct and independent existence, such as a person, 59 | organization, or device that performs one or more roles in the ecosystem. 60 |
61 |
graph
62 |
63 | A network of information composed of subjects and their relationship 64 | to other subjects or data. 65 |
66 |
holder
67 |
68 | A role an entity might perform by possessing one or more 69 | verifiable credentials and generating presentations from them. 70 | A holder is usually, but not always, a subject of the verifiable 71 | credentials they are holding. Holders store their credentials in 72 | credential repositories. 73 |
74 |
identity
75 |
76 | The means for keeping track of entities across contexts. Digital 77 | identities enable tracking and customization of entity interactions 78 | across digital contexts, typically using identifiers and attributes. Unintended 79 | distribution or use of identity information can compromise privacy. Collection 80 | and use of such information should follow the principle of 81 | data minimization. 82 |
83 |
identity provider
84 |
85 | An identity provider, sometimes abbreviated as IdP, is a system 86 | for creating, maintaining, and managing identity information for 87 | holders, while providing authentication services to 88 | relying party applications within a federation or distributed network. 89 | In this case the holder is always the subject. Even if the 90 | verifiable credentials are bearer credentials, it is assumed the 91 | verifiable credentials remain with the subject, and if they are 92 | not, they were stolen by an attacker. This specification does not use this term 93 | unless comparing or mapping the concepts in this document to other 94 | specifications. This specification decouples the identity provider 95 | concept into two distinct concepts: the issuer and the holder. 96 |
97 |
issuer
98 |
99 | A role an entity can perform by asserting claims about one or 100 | more subjects, creating a verifiable credential from these 101 | claims, and transmitting the verifiable credential to a 102 | holder. 103 |
104 |
presentation
105 |
106 | Data derived from one or more verifiable credentials, issued by one or 107 | more issuers, that is shared with a specific verifier. A 108 | verifiable presentation 109 | is a tamper-evident presentation encoded in such a way that authorship of the 110 | data can be trusted after a process of cryptographic verification. Certain 111 | types of verifiable presentations might contain data that is synthesized from, 112 | but do not contain, the original verifiable credentials (for example, 113 | zero-knowledge proofs). 114 |
115 |
repository
116 |
117 | A program, such as a storage vault or personal verifiable credential 118 | wallet, that stores and protects access to holders' 119 | verifiable credentials. 120 |
121 |
selective disclosure
122 |
123 | The ability of a holder to make fine-grained decisions about what 124 | information to share. 125 |
126 |
subject
127 |
128 | A thing about which claims are made. 129 |
130 |
user agent
131 |
132 | A program, such as a browser or other Web client, that mediates the 133 | communication between holders, issuers, and verifiers. 134 |
135 |
validation
136 |
137 | The assurance that a verifiable credential or a 138 | verifiable presentation meets the needs of a verifier and other 139 | dependent stakeholders. This specification is constrained to verifying 140 | verifiable credentials and verifiable presentations regardless of 141 | their usage. Validating verifiable credentials or 142 | verifiable presentations is outside the scope of this specification. 143 |
144 |
verifiable data registry
145 |
146 | A role a system might perform by mediating the creation and verification 147 | of identifiers, keys, and other relevant data, such as 148 | verifiable credential schemas, revocation registries, issuer public keys, 149 | and so on, which might be required to use verifiable credentials. Some 150 | configurations might require correlatable identifiers for subjects. Some 151 | registries, such as ones for UUIDs and public keys, might just act as namespaces 152 | for identifiers. 153 |
154 |
verification
155 |
156 | The evaluation of whether a verifiable credential or verifiable presentation 157 | is an authentic and timely statement of the issuer or presenter, respectively. 158 | This includes checking that: the credential (or presentation) conforms to the specification; the proof method is 159 | satisfied; and, if present, the status check succeeds. 160 | 161 |
162 |
verifier
163 |
164 | A role an entity performs by receiving one or more 165 | verifiable credentials, optionally inside a 166 | verifiable presentation for processing. Other specifications might refer 167 | to this concept as a relying party. 168 |
169 |
URI
170 |
171 | A Uniform Resource Identifier, as defined by [[RFC3986]]. 172 |
173 |
174 | -------------------------------------------------------------------------------- /common.js: -------------------------------------------------------------------------------- 1 | /* globals omitTerms, respecConfig, $, require */ 2 | /* exported linkCrossReferences, restrictReferences, fixIncludes */ 3 | 4 | var ccg = { 5 | // Add as the respecConfig localBiblio variable 6 | // Extend or override global respec references 7 | localBiblio: { 8 | "REST": { 9 | title: "Architectural Styles and the Design of Network-based Software Architectures", 10 | date: "2000", 11 | href: "http://www.ics.uci.edu/~fielding/pubs/dissertation/", 12 | authors: [ 13 | "Fielding, Roy Thomas" 14 | ], 15 | publisher: "University of California, Irvine." 16 | }, 17 | "VC-USECASES": { 18 | title: "Verifiable Claims Use Cases", 19 | href: "https://www.w3.org/TR/verifiable-claims-use-cases/", 20 | authors: [ 21 | "Shane McCarron", 22 | "Daniel Burnett", 23 | "Gregg Kellogg", 24 | "Brian Sletten", 25 | "Manu Sporny" 26 | ], 27 | status: "NOTE", 28 | publisher: "Verifiable Claims Working Group" 29 | }, 30 | "VC-EXTENSION-REGISTRY": { 31 | title: "Verifiable Credentials Extension Registry", 32 | href: "https://w3c-ccg.github.io/vc-extension-registry/", 33 | authors: [ 34 | "Manu Sporny" 35 | ], 36 | status: "CG-DRAFT", 37 | publisher: "Credentials Community Group" 38 | }, 39 | "STRING-META": { 40 | title: "Strings on the Web: Language and Direction Metadata", 41 | href: "https://www.w3.org/TR/string-meta/", 42 | authors: [ 43 | "Addison Phillips", 44 | "Richard Ishida" 45 | ], 46 | status: "WD", 47 | publisher: "Internationalization Working Group" 48 | }, 49 | "LD-PROOFS": { 50 | title: "Linked Data Proofs", 51 | href: "https://w3c-dvcg.github.io/ld-proofs/", 52 | authors: [ 53 | "Manu Sporny", 54 | "Dave Longley" 55 | ], 56 | status: "CG-DRAFT", 57 | publisher: "Digital Verification Community Group" 58 | }, 59 | "LD-SIGNATURES": { 60 | title: "Linked Data Signatures", 61 | href: "https://w3c-dvcg.github.io/ld-signatures/", 62 | authors: [ 63 | "Manu Sporny", 64 | "Dave Longley" 65 | ], 66 | status: "CG-DRAFT", 67 | publisher: "Digital Verification Community Group" 68 | }, 69 | "LDS-RSA2018": { 70 | title: "The 2018 RSA Linked Data Signature Suite", 71 | href: "https://w3c-dvcg.github.io/lds-rsa2018/", 72 | authors: [ 73 | "Manu Sporny", 74 | "Dave Longley" 75 | ], 76 | status: "CG-DRAFT", 77 | publisher: "Digital Verification Community Group" 78 | }, 79 | "MULTIBASE": { 80 | title: "Multibase", 81 | href: "https://tools.ietf.org/html/draft-multiformats-multibase", 82 | authors: [ 83 | "Juan Benet", 84 | "Manu Sporny" 85 | ], 86 | status: "Independent Draft", 87 | publisher: "IETF" 88 | }, 89 | "MULTICODEC": { 90 | title: "Multibase", 91 | href: "https://github.com/multiformats/multicodec/blob/master/README.md", 92 | authors: [ 93 | "Juan Benet", 94 | "Manu Sporny" 95 | ], 96 | status: "Independent Draft", 97 | publisher: "IETF" 98 | }, 99 | "CL-SIGNATURES": { 100 | title: "A Signature Scheme with Efficient Protocols", 101 | href: "http://groups.csail.mit.edu/cis/pubs/lysyanskaya/cl02b.pdf", 102 | authors: [ 103 | "Jan Camenisch", 104 | "Anna Lysyanskaya" 105 | ], 106 | status: "Peer Reviewed Paper", 107 | publisher: "IBM Research" 108 | }, 109 | // aliases to known references 110 | "HTTP-SIGNATURES": { 111 | aliasOf: "http-signatures" 112 | }, 113 | "MACAROONS": { 114 | title: 'Macaroons', 115 | // TODO: create spec 116 | href: 'http://macaroons.io/', 117 | authors: ['Arnar Birgisson', 'Joe Gibbs Politz', 'Úlfar Erlingsson', 118 | 'Ankur Taly', 'Michael Vrable', 'Mark Lentczner'], 119 | status: 'unofficial', 120 | publisher: 'Credentials Community Group' 121 | }, 122 | 'OPEN-BADGES': { 123 | title: 'Open Badges', 124 | href: 'https://github.com/openbadges/openbadges-specification', 125 | authors: ['Brian Brennan', 'Mike Larsson', 'Chris McAvoy', 126 | 'Nate Otto', 'Kerri Lemoie'], 127 | status: 'BA-DRAFT', 128 | publisher: 'Badge Alliance Standard Working Group' 129 | }, 130 | 'RDF-NORMALIZATION': { 131 | title: 'RDF Dataset Normalization', 132 | href: 'http://json-ld.github.io/normalization/spec/', 133 | authors: ['Dave Longley', 'Manu Sporny'], 134 | status: 'CG-DRAFT', 135 | publisher: 'Credentials W3C Community Group' 136 | }, 137 | 'DEMOGRAPHICS': { 138 | title: 'Simple Demographics Often Identify People Uniquely', 139 | href: 'http://dataprivacylab.org/projects/identifiability/paper1.pdf', 140 | authors: ['Latanya Sweeney'], 141 | publisher: 'Data Privacy Lab' 142 | }, 143 | 'VC-IMP-GUIDE': { 144 | title: 'Verifiable Credentials Implementation Guidelines 1.0', 145 | href: 'https://w3c.github.io/vc-imp-guide/', 146 | authors: ['Andrei Sambra', 'Manu Sporny'], 147 | status: 'ED', 148 | publisher: 'Credentials Community Group' 149 | }, 150 | 'HASHLINK': { 151 | title: 'Cryptographic Hyperlinks', 152 | href: 'https://tools.ietf.org/html/draft-sporny-hashlink', 153 | authors: ['Manu Sporny'], 154 | status: 'Internet-Draft', 155 | publisher: 'Internet Engineering Task Force (IETF)' 156 | }, 157 | 'IPFS': { 158 | title: 'InterPlanetary File System (IPFS)', 159 | href: 'https://en.wikipedia.org/wiki/InterPlanetary_File_System', 160 | publisher: 'Wikipedia' 161 | }, 162 | 'JSON-SCHEMA-2018': { 163 | title: 'JSON Schema: A Media Type for Describing JSON Documents', 164 | href: 'https://tools.ietf.org/html/draft-handrews-json-schema', 165 | authors: ['Austin Wright', 'Henry Andrews'], 166 | status: 'Internet-Draft', 167 | publisher: 'Internet Engineering Task Force (IETF)' 168 | }, 169 | 'JSON-LD': { 170 | title: 'JSON-LD 1.1: A JSON-based Serialization for Linked Data', 171 | href: 'https://www.w3.org/TR/json-ld11/', 172 | authors: ['Gregg Kellogg', 'Manu Sporny', 'Dave Longley', 'Markus Lanthaler', 'Pierre-Antoine Champin', 'Niklas Lindström'], 173 | status: 'WD', 174 | publisher: 'W3C JSON-LD 1.1 Working Group' 175 | } 176 | } 177 | }; 178 | 179 | 180 | 181 | // We should be able to remove terms that are not actually 182 | // referenced from the common definitions 183 | // 184 | // the termlist is in a block of class "termlist", so make sure that 185 | // has an ID and put that ID into the termLists array so we can 186 | // interrogate all of the included termlists later. 187 | var termNames = [] ; 188 | var termLists = [] ; 189 | var termsReferencedByTerms = [] ; 190 | 191 | function restrictReferences(utils, content) { 192 | "use strict"; 193 | var base = document.createElement("div"); 194 | base.innerHTML = content; 195 | 196 | // New new logic: 197 | // 198 | // 1. build a list of all term-internal references 199 | // 2. When ready to process, for each reference INTO the terms, 200 | // remove any terms they reference from the termNames array too. 201 | $.each(base.querySelectorAll("dfn"), function(i, item) { 202 | var $t = $(item) ; 203 | var titles = $t.getDfnTitles(); 204 | var dropit = false; 205 | // do we have an omitTerms 206 | if (window.hasOwnProperty("omitTerms")) { 207 | // search for a match 208 | $.each(omitTerms, function(j, term) { 209 | if (titles.indexOf(term) !== -1) { 210 | dropit = true; 211 | } 212 | }); 213 | } 214 | // do we have an includeTerms 215 | if (window.hasOwnProperty("includeTerms")) { 216 | var found = false; 217 | // search for a match 218 | $.each(includeTerms, function(j, term) { 219 | if (titles.indexOf(term) !== -1) { 220 | found = true; 221 | } 222 | }); 223 | if (!found) { 224 | dropit = true; 225 | } 226 | } 227 | if (dropit) { 228 | $t.parent().next().remove(); 229 | $t.parent().remove(); 230 | } else { 231 | var n = $t.makeID("dfn", titles[0]); 232 | if (n) { 233 | termNames[n] = $t.parent() ; 234 | } 235 | } 236 | }); 237 | 238 | var $container = $(".termlist",base) ; 239 | var containerID = $container.makeID("", "terms") ; 240 | termLists.push(containerID) ; 241 | 242 | return (base.innerHTML); 243 | } 244 | // add a handler to come in after all the definitions are resolved 245 | // 246 | // New logic: If the reference is within a 'dl' element of 247 | // class 'termlist', and if the target of that reference is 248 | // also within a 'dl' element of class 'termlist', then 249 | // consider it an internal reference and ignore it. 250 | 251 | require(["core/pubsubhub"], function(respecEvents) { 252 | "use strict"; 253 | respecEvents.sub('end', function(message) { 254 | if (message === 'core/link-to-dfn') { 255 | // all definitions are linked; find any internal references 256 | $(".termlist a.internalDFN").each(function() { 257 | var $r = $(this); 258 | var id = $r.attr('href'); 259 | var idref = id.replace(/^#/,"") ; 260 | if (termNames[idref]) { 261 | // this is a reference to another term 262 | // what is the idref of THIS term? 263 | var $def = $r.closest('dd') ; 264 | if ($def.length) { 265 | var $p = $def.prev('dt').find('dfn') ; 266 | var tid = $p.attr('id') ; 267 | if (tid) { 268 | if (termsReferencedByTerms[tid]) { 269 | termsReferencedByTerms[tid].push(idref); 270 | } else { 271 | termsReferencedByTerms[tid] = [] ; 272 | termsReferencedByTerms[tid].push(idref); 273 | } 274 | } 275 | } 276 | } 277 | }) ; 278 | 279 | // clearRefs is recursive. Walk down the tree of 280 | // references to ensure that all references are resolved. 281 | var clearRefs = function(theTerm) { 282 | if ( termsReferencedByTerms[theTerm] ) { 283 | $.each(termsReferencedByTerms[theTerm], function(i, item) { 284 | if (termNames[item]) { 285 | delete termNames[item]; 286 | clearRefs(item); 287 | } 288 | }); 289 | } 290 | // make sure this term doesn't get removed 291 | if (termNames[theTerm]) { 292 | delete termNames[theTerm]; 293 | } 294 | }; 295 | 296 | // now termsReferencedByTerms has ALL terms that 297 | // reference other terms, and a list of the 298 | // terms that they reference 299 | $("a.internalDFN").each(function () { 300 | var $item = $(this) ; 301 | var t = $item.attr('href'); 302 | var r = t.replace(/^#/,"") ; 303 | // if the item is outside the term list 304 | if ( ! $item.closest('dl.termlist').length ) { 305 | clearRefs(r); 306 | } 307 | }); 308 | 309 | // delete any terms that were not referenced. 310 | /* 311 | Object.keys(termNames).forEach(function(term) { 312 | var $p = $("#"+term) ; 313 | if ($p) { 314 | var tList = $p.getDfnTitles(); 315 | $p.parent().next().remove(); 316 | $p.parent().remove() ; 317 | tList.forEach(function( item ) { 318 | console.log("CHECKING ITEM", item, respecConfig); 319 | if (respecConfig.definitionMap[item]) { 320 | delete respecConfig.definitionMap[item]; 321 | } 322 | }); 323 | } 324 | });*/ 325 | } 326 | }); 327 | }); 328 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The did:key Method v0.7 5 | 6 | 11 | 12 | 13 | 89 | 115 | 116 | 117 |
118 |

119 | Decentralized Identifiers (DIDs) are a new type of identifier for verifiable, 120 | decentralized digital identity. These new identifiers are designed to enable the 121 | controller of a DID to prove control over it and to be implemented independently 122 | of any centralized registry, identity provider, or certificate authority. 123 | These sorts of identifiers often utilize a heavy-weight registry, such as ones 124 | utilizing Decentralized Ledger Technologies (DLT), to create, read, update, 125 | and deactivate DIDs. This specification describes a non-registry based DID 126 | Method based on expanding a cryptographic public key into a DID Document. This 127 | approach provides the simplest possible implementation of a DID Method that 128 | is able to achive many, but not all, of the benefits of utilizing DIDs. 129 |

130 |
131 | 132 |
133 | 134 |

135 | Portions of the work on this specification have been funded by the 136 | United States Department of Homeland Security's Science and Technology 137 | Directorate under contract HSHQDC-17-C-00019. The content of this specification 138 | does not necessarily reflect the position or the policy of the U.S. Government 139 | and no official endorsement should be inferred. 140 |

141 | 142 |
143 | 144 |
145 |

Introduction

146 | 147 |

148 | Decentralized Identifiers (DIDs) [[DID-CORE]] are a new type of identifier for 149 | verifiable, decentralized digital identity. These new identifiers are designed 150 | to enable the controller of a DID to prove control over it and to be implemented 151 | independently of any centralized registry, identity provider, or certificate 152 | authority. These sorts of identifiers often utilize a heavy-weight registry, 153 | such as ones utilizing Decentralized Ledger Technologies (DLT), to create, read, 154 | update, and deactivate DIDs. 155 |

156 | 157 |

158 | While DLT-based DID Methods have great decentralization characteristics, and 159 | some of the more centralized DID Methods provide strong system control 160 | guarantees, the general approaches tend to be expensive to setup and operate. 161 | Some use cases requiring DIDs do not need the guarantees provided by these 162 | heavy-weight systems. For example, a DID that will only be used for a single, 163 | ephemeral interaction might not need to be registered, updated, or deactivated. 164 | It is for this class of use cases that the did:key method exists. 165 |

166 | 167 |

168 | The rest of this document outlines the syntax for the did:key method, 169 | the operations it supports, and some security and privacy considerations that 170 | implementers might want to be aware of when implementing. 171 |

172 | 173 |
174 | 175 | 176 | 177 |
178 |

The did:key Format

179 | 180 |

181 | The format for the did:key method conforms to the [[DID-CORE]] 182 | specification and is simple. It consists of the did:key prefix, 183 | followed by a Multibase [[MULTIBASE]] base58-btc encoded value that is a 184 | concatenation of the Multicodec [[MULTICODEC]] identifier for the public key 185 | type and the raw bytes associated with the public key format. 186 |

187 | 188 |

189 | The ABNF for the key format is described below: 190 |

191 | 192 |
193 | did-key-format := did:key:<mb-value>
194 | mb-value       := z[a-km-zA-HJ-NP-Z1-9]+
195 |       
196 | 197 |

198 | Alternatively, the encoding rules can also be thought of as the application 199 | of a series of transformation functions on the raw public key bytes: 200 |

201 | 202 | 203 | did-key-format := did:key:MULTIBASE(base58-btc, MULTICODEC(public-key-type, raw-public-key-bytes)) 204 | 205 | 206 |

207 | A simple example of a valid Ed25519 did:key DID is: 208 |

209 | 210 |
211 | did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH
212 |       
213 | 214 |
215 | 216 |
217 |

Operations

218 | 219 |

220 | The following section outlines the DID operations for the did:key 221 | method. Implementers might note that this DID Method is purely generative, 222 | requiring no look ups in a registry. Since did:key values are not 223 | stored in any registry, they cannot be updated or deactivated. 224 |

225 | 226 |
227 |

Create

228 | 229 |

230 | Creating a did:key value consists of creating a cryptographic key pair 231 | and encoding the public key using the format provided in Section . The creation of a DID Document is also performed by taking 233 | the public key value and expanding it into DID Document. An example is given 234 | below that expands the ed25519 did:key 235 | did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH into its 236 | associated DID Document: 237 |

238 | 239 |
240 | {
241 |   "@context": "https://w3id.org/did/v1",
242 |   "id": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH",
243 |   "publicKey": [{
244 |     "id": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH#pubkey",
245 |     "type": "Ed25519VerificationKey2018",
246 |     "controller": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH",
247 |     "publicKeyBase58": "B12NYF8RrR3h41TDCTJojY59usg3mbtbjnFs7Eud1Y6u"
248 |   }],
249 |   "authentication": [ "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH#pubkey" ],
250 |   "assertionMethod": [ "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH#pubkey" ],
251 |   "capabilityDelegation": [ "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH#pubkey" ],
252 |   "capabilityInvocation": [ "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH#pubkey" ],
253 |   "keyAgreement": [{
254 |     "id": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH#kakey",
255 |     "type": "X25519KeyAgreementKey2019",
256 |     "controller": "did:key:z6MkpTHR8VNsBxYAAWHut2Geadd9jSwuBV8xRoAnwWsdvktH",
257 |     "publicKeyBase58": "JhNWeSVLMYccCk7iopQW4guaSJTojqpMEELgSLhKwRr"
258 |   }]
259 | }
260 |         
261 |
262 | 263 |
264 |

Read

265 | 266 |

267 | Reading a did:key value is a matter of deterministically expanding the 268 | value to a DID Document. This process is described in Section . 270 |

271 |
272 | 273 |
274 |

Update

275 | 276 |

277 | This DID Method does not support updating the DID Document. 278 |

279 |
280 | 281 |
282 |

Deactivate

283 | 284 |

285 | This DID Method does not support deactivating the DID Document. 286 |

287 |
288 | 289 |
290 | 291 |
292 |

Security and Privacy Considerations

293 | 294 |

295 | There are a number of security and privacy considerations that implementers 296 | will want to take into consideration when implementing this specification. 297 |

298 | 299 |
300 |

Key Rotation Not Supported

301 | 302 |

303 | The did:key method is a purely generative method, which means that 304 | updates are not supported. This can be an issue if a did:key is 305 | expected to be used over a long period of time. For example, if a 306 | did:key is ever compromised, it is not possible to rotate the 307 | compromised key. For this reason, using a did:key for interactions 308 | that last weeks to months is strongly discouraged. 309 |

310 |
311 | 312 |
313 |

Deactivation Not Supported

314 | 315 |

316 | The did:key method is a purely generative method, which means that 317 | deactivations are not supported. This can be an issue if a did:key is 318 | expected to be used over a long period of time. For example, if a 319 | did:key is ever compromised, it is not possible to deactivate the DID 320 | to stop an attacker from using it. For this reason, using a did:key for 321 | interactions that last weeks to months is strongly discouraged. 322 |

323 |
324 | 325 |
326 |

Key Derivation Lacks Proof

327 | 328 |

329 | Some implementations might utlize a key derivation function when converting from 330 | an ed25519 public key to a Curve25519 ECDH key, used in the 331 | keyAgreement verification method. It is expected that this is a 332 | relatively safe operation, but implementers might consider that there exists no 333 | mathematical proof that confirms this assumption. 334 |

335 |
336 | 337 |
338 |

Long Term Usage is Discouraged

339 | 340 |

341 | Since there is no support for update and deactivate for the did:key 342 | method, it is not possible to recover from a security compromise. For this 343 | reason, using a did:key for interactions that last weeks to months is 344 | strongly discouraged. 345 |

346 |
347 | 348 |
349 | 350 | 351 | 352 |
353 |

Acknowledgements

354 | 355 |

356 | The Working Group would like to thank the following individuals for reviewing 357 | and providing feedback on the specification (in alphabetical order): 358 |

359 | 360 |

361 | TBD... 362 |

363 |
364 | 365 | 366 | --------------------------------------------------------------------------------