Create a DID:key

DIDs with a method of key are the most basic type of DID. The public key forms the DID and has no further data associated with it.

did:key is the only DID available in the MATTR Showcase wallet, as it has the advantage of being lightweight and easy to manage. However, introducing support for additional methods is being considered.

Constraints

  • This DID method does not support key rotation, and therefore there are limitations on using it in a long-term setting. When keys need to be rotated for any reason, all credentials issued using this DID must be revoked and reissued using the new key.

  • This DID method does not advertise a service endpoint, where a DID document advertises a public endpoint that could be used to send messages intended for the DID owner. As this DID method does not support this capability, any messages will need to be routed by different means (e.g. a static inbox).

DIDs created on your tenant can be viewed on our Self Service Portal.

Request

Make the following request to create a did:key:

http
Copy to clipboard.
1POST https://YOUR_TENANT_URL/v1/dids
json
Copy to clipboard.
1{
2  "method": "key",
3  "options": {
4    "keyType": "Ed25519"
5  }
6}
  • method: Set to key in order to create a did:key.

  • keyType:

    • Supported keyType for did:key are Ed25519 and Bls12381G2.

    • If the keyType is omitted, the default keyType is Ed25519. This keytype can be used as a Verifier DID.

    • If the keyType is set to Bls12381G2 the created DID supports BBS+ signatures for creating ZKP-enabled credentials. You can read more about our work on privacy-preserving verifiable credentials on our blog.

    • As did:key only support Ed25519 or Bls12381G2 key types, you can only use it to create Web Credentials. If you wish to create Compact Credentials, create a DID using a keyType of P-256, such as did:web.

    • Bls12381G2 cannot be used as a Verifier DID as it does not support symmetric key signing required to verify messages.

Response

json
Copy to clipboard.
1{
2    "did": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX",
3    "registrationStatus": "COMPLETED",
4    "localMetadata": {
5        "keys": [
6            {
7                "didDocumentKeyId": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX",
8                "kmsKeyId": "FiBZLe1WzR9LDJ9jpqYMaEYrUgSuCY8ULDzAHVV2Mzh9"
9            },
10            {
11                "didDocumentKeyId": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6LSgjkRLLbm634tqaMMtrwmk1svFDVEeGX4ke25A8o72ter",
12                "kmsKeyId": "64aFp2ntzaM9kBybNDRpRRfSQ4x7wfLusfJPfg9aKWt6"
13            }
14        ],
15        "registered": 1601004096785,
16        "initialDidDocument": {
17            "@context": [
18                "https://w3.org/ns/did/v1",
19                "https://w3id.org/security/suites/x25519-2019/v1",
20                "https://w3id.org/security/suites/ed25519-2018/v1"
21            ],
22            "id": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX",
23            "verificationMethod": [
24                {
25                    "id": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX",
26                    "type": "Ed25519VerificationKey2018",
27                    "controller": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX",
28                    "publicKeyBase58": "FiBZLe1WzR9LDJ9jpqYMaEYrUgSuCY8ULDzAHVV2Mzh9"
29                }
30            ],
31            "authentication": [
32                "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX"
33            ],
34            "assertionMethod": [
35                "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX"
36            ],
37            "capabilityDelegation": [
38                "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX"
39            ],
40            "capabilityInvocation": [
41                "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX"
42            ],
43            "keyAgreement": [
44                {
45                    "id": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX#z6LSgjkRLLbm634tqaMMtrwmk1svFDVEeGX4ke25A8o72ter",
46                    "type": "X25519KeyAgreementKey2019",
47                    "controller": "did:key:z6MkuASbvtFxKxdoKnzSWQWCRL6rJFikcRNq2Eu67mT3HDUX",
48                    "publicKeyBase58": "64aFp2ntzaM9kBybNDRpRRfSQ4x7wfLusfJPfg9aKWt6"
49                }
50            ]
51        }
52    }
53
  • did: This is the resulting did:key.

  • registrationStatus: MATTR VII automatically registers created DIDs when applicable. Any did:key will always have a registrationStatus of COMPLETED as it is instantly available to be used and resolved.

The above example used Ed25519 as keyType. Notice that when using Bls12381G2 as keyType the public key in the DID Document is larger:

json
Copy to clipboard.
1{
2    "did": "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v",
3    "registrationStatus": "COMPLETED",
4    "localMetadata": {
5        "keys": [
6            {
7                "didDocumentKeyId": "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v#zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v",
8                "kmsKeyId": "25voPUCTSWXcDLCZNfZeTWuNaDcM3KgQZqwkvuY1s2GNGJ3tJ3UubY8uFR4X8Ykhdb2xTnXkGffugi9rHsM4A3J5FRPCyoAh4ZrdcCWUSEj29pGahY1cUA7uR1ns52JeZBQc"
9            }
10        ],
11        "registered": 1600918030673,
12        "initialDidDocument": {
13            "@context": [
14                "https://w3.org/ns/did/v1",
15                "https://w3id.org/security/suites/x25519-2019/v1",
16                "https://w3id.org/security/bbs/v1"
17            ],
18            "id": "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v",
19            "verificationMethod": [
20                {
21                    "id": "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v#zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v",
22                    "type": "Bls12381G2Key2020",
23                    "controller": "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v",
24                    "publicKeyBase58": "25voPUCTSWXcDLCZNfZeTWuNaDcM3KgQZqwkvuY1s2GNGJ3tJ3UubY8uFR4X8Ykhdb2xTnXkGffugi9rHsM4A3J5FRPCyoAh4ZrdcCWUSEj29pGahY1cUA7uR1ns52JeZBQc"
25                }
26            ],
27            "authentication": [
28                "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v#zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v"
29            ],
30            "assertionMethod": [
31                "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v#zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v"
32            ],
33            "capabilityDelegation": [
34                "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v#zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v"
35            ],
36            "capabilityInvocation": [
37                "did:key:zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v#zUC7KmMGXt7fs9URk9EDqWLfpCjVTtfFMexViLLkPPUfm9j4heqvk9JkLarva3sP54FGjFNLpwc63ZTef2aR2cPssFbyDj75kopYqWL16j7JigA2BAvJcwnaKvKPUybxbroRg1v"
38            ]
39        }
40    }
41}