A Dive Into Decentralised Identifiers

Decentralised Identifier in short DID is an address representing who you are on the decentralised web,it can represent a person, organisation, data model or an abstract entity.

DIDs are created and managed without depending on central authority which gives individuals or entities control over their own identity information and allowing them to share that information with others selectively and securely.

Below is how a DID is written.

More on DID Methods

DID Methods is a fancy way of saying different implementations of DID and there are two implementations as follows:

  • did:ion

    It is an implementation of the side-tree protocol, which logs a DID action on any decentralised anchoring system, like a blockchain or other distributed ledger which supports the ability to create, update, recover, and deactivate a DID for example did:ion anchors actions on the Bitcoin blockchain.

  • did:key

    it is a very fast implementation but with drawbacks such as being unable to update or delete but only create DIDs thus being only useful for single and short interactions

DIDs are secured with public-private key pairs

A sample code of how a DID is created automatically using Web5 SDK

import { Web5 } from '@web5/api';
const { web5, did: myDid } = await Web5.connect();

How the myDid object will look like

did:ion:EiD3a17O2DCebpcZli-1BHRtMQ0LtTfrU85hHnAux6LrRQ:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJkd24iLCJwdWJsaWNLZXlKd2siOnsiY3J2Ijoic2VjcDI1NmsxIiwia3R5IjoiRUMiLCJ4IjoiR1hoNkpFeHlqaWk0UHNiQ2NQdG5OWmlCT0MxZGVaSDdiYS1oVERXajlFZyIsInkiOiJ4SFF6VjhXR0VGdVZyelFIN0tFN1lQTDBEdWtkbUhwY0lOM1doQmlYSEhrIn0sInB1cnBvc2VzIjpbImF1dGhlbnRpY2F0aW9uIl0sInR5cGUiOiJKc29uV2ViS2V5MjAyMCJ9XX19XSwidXBkYXRlQ29tbWl0bWVudCI6IkVpQ3Z4bHlrZ0ZpeVZfLThxdUdVMjlkN0JTX1hMV0REVnFjUGxVVnBVNGFXU3cifSwic3VmZml4RGF0YSI6eyJkZWx0YUhhc2giOiJFaUQwT3didlJxQngwc1Atai16YjlXbzRZekp4Q1N3QU1oeUw2NnlySEVmSXR3IiwicmVjb3ZlcnlDb21taXRtZW50IjoiRWlEbk1JcVFLRTdPbWQwcFd0UHM0RmVKSFkxY1RCTllzMHdhX0stRWdnVEJFQSJ9fQ

Another sample code of how a DID is created but manually using Web5 SDK

import { Web5 } from '@web5/api';

const myDid = await Web5.did.create('ion');

How myDid object will look like this time

{
  id: 'did:ion:EiDkWWhFezuDhJkGDJBmuIGDO2oOmzWVaL6SgWIyjqaJTw:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJkd24iLCJwdWJsaWNLZXlKd2siOnsiY3J2Ijoic2VjcDI1NmsxIiwia3R5IjoiRUMiLCJ4IjoiOEpVUE5kSmxhQW50d2RyeUlDZEJUdEljeGdYRHJiXzRmYjJ5bFd3UlZrcyIsInkiOiJRR3o2QjhGTVRuaUhlMFhxY19SdmduTnQ4djJ0NFFJMW5mRVRiOXpsYldZIn0sInB1cnBvc2VzIjpbImF1dGhlbnRpY2F0aW9uIl0sInR5cGUiOiJKc29uV2ViS2V5MjAyMCJ9XX19XSwidXBkYXRlQ29tbWl0bWVudCI6IkVpQkFtTE5RaDdkX1NBcDRDOUV6SmV0M240ajJWNmJ6VVJGSUk4NE9mOS1KbUEifSwic3VmZml4RGF0YSI6eyJkZWx0YUhhc2giOiJFaUR3U05saVE3RjBXLU9zX2hRUkp1WnlPbzBTUTUzMjBCR3pBRG5Od053ZmJ3IiwicmVjb3ZlcnlDb21taXRtZW50IjoiRWlCUmYxY05pbUJFRXJZU1gtelJNNHdFSGRJZXdzUGZYNGRBVklYd0xKaFg0USJ9fQ',
  internalId: 'did:ion:EiDkWWhFezuDhJkGDJBmuIGDO2oOmzWVaL6SgWIyjqaJTw',
  didDocument: {
    '@context': 'https://www.w3.org/ns/did/v1',
    id: 'did:ion:EiDkWWhFezuDhJkGDJBmuIGDO2oOmzWVaL6SgWIyjqaJTw:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJkd24iLCJwdWJsaWNLZXlKd2siOnsiY3J2Ijoic2VjcDI1NmsxIiwia3R5IjoiRUMiLCJ4IjoiOEpVUE5kSmxhQW50d2RyeUlDZEJUdEljeGdYRHJiXzRmYjJ5bFd3UlZrcyIsInkiOiJRR3o2QjhGTVRuaUhlMFhxY19SdmduTnQ4djJ0NFFJMW5mRVRiOXpsYldZIn0sInB1cnBvc2VzIjpbImF1dGhlbnRpY2F0aW9uIl0sInR5cGUiOiJKc29uV2ViS2V5MjAyMCJ9XX19XSwidXBkYXRlQ29tbWl0bWVudCI6IkVpQkFtTE5RaDdkX1NBcDRDOUV6SmV0M240ajJWNmJ6VVJGSUk4NE9mOS1KbUEifSwic3VmZml4RGF0YSI6eyJkZWx0YUhhc2giOiJFaUR3U05saVE3RjBXLU9zX2hRUkp1WnlPbzBTUTUzMjBCR3pBRG5Od053ZmJ3IiwicmVjb3ZlcnlDb21taXRtZW50IjoiRWlCUmYxY05pbUJFRXJZU1gtelJNNHdFSGRJZXdzUGZYNGRBVklYd0xKaFg0USJ9fQ',
    verificationMethod: [ [Object] ],
    authentication: [ '#dwn' ]
  },
  methodData: [
    {
      operation: 'create',
      content: [Object],
      recovery: [Object],
      update: [Object]
    }
  ],
  keys: [
    {
      id: 'did:ion:EiDkWWhFezuDhJkGDJBmuIGDO2oOmzWVaL6SgWIyjqaJTw:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJkd24iLCJwdWJsaWNLZXlKd2siOnsiY3J2Ijoic2VjcDI1NmsxIiwia3R5IjoiRUMiLCJ4IjoiOEpVUE5kSmxhQW50d2RyeUlDZEJUdEljeGdYRHJiXzRmYjJ5bFd3UlZrcyIsInkiOiJRR3o2QjhGTVRuaUhlMFhxY19SdmduT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tZW50IjoiRWlCUmYxY05pbUJFRXJZU1gtelJNNHdFSGRJZXdzUGZYNGRBVklYd0xKaFg0USJ9fQ',
      publicKeyJwk: [Object],
      privateKeyJwk: [Object]
    }
  ]
}

Note: The field named "id" is the DID

For more info on DIDs

Source

The next article we will focus on where DIDs are stored