Create DID Document

Decentralized identifiers (DIDs) are a new type of identifier that enable verifiable, decentralized digital identities. A DID identifies any subject (e.g., a person, organization, thing, data model, abstract entity, router, switch, contract, etc.) that the controller of the DID decides that it identifies.

You might need a DID Document also to send it to your communication partner to enable him to send you encrypted messages!

With CodeB it is very easy to create the DID Document for your own address.

First you need to logon to the node. To do so a JSON in the following format has to be sent to the node. For example via WebSocket: http://coin.codeb.io/websocket.aspx

{ “@type”: “specs/jwt”, “@id”: “936f886d-65b4-491d-a205-4b7eaae360fc”, “ktype”: “2”, “exp”: 1598445762, “authentication”: { “type”: “passwordauth”, “encrypted”: “eyJhbGciOiJFQ0RILUVTIiwiZW5jIjoiQTI1NkdDTSIsImVjY3B1YiI6IlJVTkxNU0FBQUFDV0g1dGJfQ0Q4RTJnNDRqaU5SVDZMNG9Zd2tNeVlNM0loNE1HYW9Hb0dNRHZVYW1RbWRnSVl2dEtVSWJ5WXN0ZWlwRWlnbUpkZFJDU1VQN2kwZjlZNCIsImVwayI6eyJrdHkiOiJFQyIsIngiOiJIV1VUSC1hU0lOekRUeXg0Y2ZoSE4ya1JkTXo2ejh5ZHc5VkRiUTQyRjlNIiwieSI6IlhZdktqT0pzTENIUm5QRXA3NndqSTMwTm14b2FjRjZaMDR6djFuZHR2NU0iLCJjcnYiOiJQLTI1NiJ9fQ..5hw5VIISIQjZMwzU.6T_B3tntNlbd1GmKM-9Y6q_tPA6e322LZbQE_oLarDhuHHF5J6nV9Ng-zvkjSLi8FZDvNjRFBWTh3jFo7cvIdABVYLibq6e1-sTgJAe6j0A.TF5zua1nioFZ1sZv-oe37Q” } }

Note: With our helper API https://coin.codeb.io/json.asmx?op=EncryptedPasswordJSONToken you can create such JSON Message easily.

You can use our test account: 0x26b945e3F2aAd85C26356AF8F4779018da98f7fF with password: aloaha123

The Websocket will send you a JSON-WT answer like:

eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImVjY3B1YiI6IlJVTkxNU0FBQUFBZlo2YkdkVEZCUU9TaHA1YzZXTzZsc1EzZUdRV1FKMktHSmlMc2RZQmZ1VzdValhuRHNCTkJ0SC1aclBpXzUtc3p5Nlg0ZzYzM1BvaU5kUHE4M3dzNCJ9.eyJsb2dnZWRJbkFzIjoiMHg5MTY2YjlmRUMwNERCMjM4QzZmMTE3NTJhM2NDMkRBNzM0ODMwNUM2IiwiaWF0IjoiMTU5ODUyNTE3MCIsImV4cCI6IjE1OTg0NDU3NjIiLCJ-dGhyZWFkIjp7InRoaWQiOiI5MzZmODg2ZC02NWI0LTQ5MWQtYTIwNS00YjdlYWFlMzYwZmMifSwiQGlkIjoiZGUzYjQzZjktNDA1YS00ODAxLTkyNzMtMDZiMzJhMGVhNTBkIiwic2Vzc2lvbmlkIjoiOWQ0NTQ4MmEtZmU4Mi00Y2UzLWFjMzQtM2VmOTNiODE0YWQ4In0.AXTjD3mFcMuZ0Xa_eiHrbfBP26wGcWgygZWAo7AAN62oS4koxL_8fumvGI5CWmehUEaLQnbc1LWoqcAkD24zmQ

The decoded of the JSON-WT content is:

{“alg”:”ES256″,”typ”:”JWT”,”eccpub”:”RUNLMSAAAAAfZ6bGdTFBQOShp5c6WO6lsQ3eGQWQJ2KGJiLsdYBfuW7UjXnDsBNBtH-ZrPi_5-szy6X4g633PoiNdPq83ws4″} {“loggedInAs”:”0x9166b9fEC04DB238C6f11752a3cC2DA7348305C6″,”iat”:”1598525170″,”exp”:”1598445762″,”~thread”:{“thid”:”936f886d-65b4-491d-a205-4b7eaae360fc”},”@id”:”de3b43f9-405a-4801-9273-06b32a0ea50d”,”sessionid”:”9d45482a-fe82-4ce3-ac34-3ef93b814ad8″} {“signature”:”AXTjD3mFcMuZ0Xa_eiHrbfBP26wGcWgygZWAo7AAN62oS4koxL_8fumvGI5CWmehUEaLQnbc1LWoqcAkD24zmQ”}

Now you can request your DID with the following JSON Message:

{“@type”:”specs/commands”,”@command”:”DID”,”thid”:”a2103c2c-f6b6-4858-830b-467f2792e4f9″,”myaddress”:”0x9166b9fEC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G5Ec0JOQnRILVpyUGlfNS1zenk2WDRnNjMzUG9pTmRQcTgzd3M0In1dLCJzZXJ2aWNlIjpbeyJpZCI6ImRpZDpjb2RlYjo5MTY2YjlmZWMwNGRiMjM4YzZmMTE3NTJhM2NjMmRhNzM0ODMwNWM2IiwidHlwZSI6IlB1YmxpY0tleVNlcnZpY2VQbGFpbiIsInNlcnZpY2VFbmRwb2ludCI6Imh0dHBzOi8vY29pbi5jb2RlYi5pby9wb3N0LmFzcHg_cGxhaW49MVx1MDAyNmRpZD05MTY2YjlmZWMwNGRiMjM4YzZmMTE3NTJhM2NjMmRhNzM0ODMwNWM2In0seyJpZCI6ImRpZDpjb2RlYjo5MTY2YjlmZWMwNGRiMjM4YzZmMTE3NTJhM2NjMmRhNzM0ODMwNWM2I2I2NCIsInR5cGUiOiJQdWJsaWNLZXlTZXJ2aWNlQjY0Iiwic2VydmljZUVuZHBvaW50IjoiaHR0cHM6Ly9jb2luLmNvZGViLmlvL3Bvc3QuYXNweD9kaWQ9OTE2NmI5ZmVjMDRkYjIzOGM2ZjExNzUyYTNjYzJkYTczNDgzMDVjNiJ9XSwiY3JlYXRlZCI6IjIwMjAtMDgtMjdUMTA6NDc6MDdaIiwidXBkYXRlZCI6IjIwMjAtMDgtMjdUMTA6NDc6MDdaIn0.r4UjoHk_lZnwQvEWKjCGtphmL3WBjKQXSoprxK49Mipldsfq1eQqXtQhxIqSI4ZUnITuaKUZ0OBv19jG6od9EA

The decoded content is:

{“alg”:”ES256″,”typ”:”DID”,”eccpub”:”RUNLMSAAAAAfZ6bGdTFBQOShp5c6WO6lsQ3eGQWQJ2KGJiLsdYBfuW7UjXnDsBNBtH-ZrPi_5-szy6X4g633PoiNdPq83ws4″} {“@context”:”https://codeb.io/did/v1″,”id”:”did:codeb:9166b9fec04db238c6f11752a3cc2da7348305c6″,”publicKey”:[{“id”:”did:codeb:9166b9fec04db238c6f11752a3cc2da7348305c6″,”type”:”EccPublicBlob”,”controller”:”did:codeb:9166b9fec04db238c6f11752a3cc2da7348305c6″,”publicKeyBase64″:”RUNLMSAAAAAfZ6bGdTFBQOShp5c6WO6lsQ3eGQWQJ2KGJiLsdYBfuW7UjXnDsBNBtH-ZrPi_5-szy6X4g633PoiNdPq83ws4″}],”authentication”:[{“id”:”did:codeb:9166b9fec04db238c6f11752a3cc2da7348305c6″,”type”:”EccPublicBlob”,”controller”:”did:codeb:9166b9fec04db238c6f11752a3cc2da7348305c6″,”publicKeyBase64″:”RUNLMSAAAAAfZ6bGdTFBQOShp5c6WO6lsQ3eGQWQJ2KGJiLsdYBfuW7UjXnDsBNBtH-ZrPi_5-szy6X4g633PoiNdPq83ws4″}],”service”:[{“id”:”did:codeb:9166b9fec04db238c6f11752a3cc2da7348305c6″,”type”:”PublicKeyServicePlain”,”serviceEndpoint”:”https://coin.codeb.io/post.aspx?plain=1&did=9166b9fec04db238c6f11752a3cc2da7348305c6″},{“id”:”did:codeb:9166b9fec04db238c6f11752a3cc2da7348305c6#b64″,”type”:”PublicKeyServiceB64″,”serviceEndpoint”:”https://coin.codeb.io/post.aspx?did=9166b9fec04db238c6f11752a3cc2da7348305c6″}],”created”:”2020-08-27T10:47:07Z”,”updated”:”2020-08-27T10:47:07Z”} {“signature”:”r4UjoHk_lZnwQvEWKjCGtphmL3WBjKQXSoprxK49Mipldsfq1eQqXtQhxIqSI4ZUnITuaKUZ0OBv19jG6od9EA”}

In the above JSON you can see two Service Endpoints:

  1. https://coin.codeb.io/post.aspx?plain=1&did=9166b9fec04db238c6f11752a3cc2da7348305c6
  2. https://coin.codeb.io/post.aspx?did=9166b9fec04db238c6f11752a3cc2da7348305c6

The first one will return the DID in clear text and the second one in B64

Of course you can address also a claim directly:

https://coin.codeb.io/post.aspx?web=1&did=9166b9fec04db238c6f11752a3cc2da7348305c6&claim=100