11.2 HTTP API

1. Access parameters

No. Parameter Description Value
1 url Gateway URL https://did.bsngate.com:18602
2 projectId Project ID 8320935187
3 token Project Key 3wxYHXwAm57grc9JUr2zrPHt9HC

2. Public parameters

Public request header parameters
No. Parameter Value
1 token 3wxYHXwAm57grc9JUr2zrPHt9HC
2 projectId 8320935187
3 Content-Type application/json
Public request parameters
No. Parameter Type Required Description
1 RequestParam<T> Y Public parameter
RequestParam
1 projectId String Y Project ID
2 did String Y DID
3 data T Y Any type of data
4 sign String Y Secp256k1 signature
Public Response Parameter
No. Parameter Type Description
1 ResultData<T> Public response data
ResultData
1 code Integer Returned code
2 msg String Message
3 data T Any type of data

3. DID Creation

The process of creating DID generates public and private key pair. In order to avoid the transmission of private keys, BSN DID Services do not provide the process of creating DIDs. Developers can generate them locally as described below, or they can use or refer to the SDK to complete the generation.

1) Generate two public and private key pairs through the elliptic curve algorithm Secp256k1.

2) Save the private key and specify the primary and recovery public keys to assemble the Base DID Document, the contents of which are shown below:

{
   "@context":"https://w3id.org/did/v1",
   "authentication":
   {
      "type":"Secp256k1",
      "publicKey": "28986472722394106073871327423452879123214061743224210681401278929598807211140001274507530324221923795865447680836742348963337343510229880669968499735858"
   }
   "recovery":
   {
      "type":"Secp256k1",
      "publicKey": "9251971168042915941551574641987721503984542761641852064853964541181378832746959340151297908312616596971625573967556676367696067937171601766581709843378481"
   }
}

3) The DID identifier is generated by the base58(ripemd160(sha256(< Base DID Document >)) algorithm in the following example format:

did:bsn:3wxYHXwAm57grc9JUr2zrPHt9HC

4) Assemble the contents of the DID Document, as the following example:

{
   "did":"did:bsn:3wxYHXwAm57grc9JUr2zrPHt9HC",
   "version":1,
   "created":"2021-05-20T16:02:20Z",
   "updated":"2021-05-20T16:02:20Z",
   "authentication":
   {
      "type":"Secp256k1",
      "publicKey": "28986472722394106073871327423452879123214061743224210681401278929598807211140001274507530324221923795865447680836742348963337343510229880669968499735858"
   }
   "recovery":
   {
      "type":"Secp256k1",
      "publicKey": "9251971168042915941551574641987721503984542761641852064853964541181378832746959340151297908312616596971625573967556676367696067937171601766581709843378481"
   }
}

5) Use the primary private key to sign the DID Document content with Secp256k1, and finally form the DID Document with the signature attribute, as following:

{
   "did":"did:bsn:3wxYHXwAm57grc9JUr2zrPHt9HC",
   "version": 1,
   "created":"2021-05-20T16:02:20Z",
   "updated":"2021-05-20T16:02:20Z",
   "authentication":
   {
      "type":"Secp256k1",
      "publicKey": "28986472722394106073871327423452879123214061743224210681401278929598807211140001274507530324221923795865447680836742348963337343510229880669968499735858"
   }
   "recovery":
   {
      "type":"Secp256k1",
      "publicKey": "9251971168042915941551574641987721503984542761641852064853964541181378832746959340151297908312616596971625573967556676367696067937171601766581709843378481"
   }
   "proof":
   {
      "type":"Secp256k1",
      "creator":"did:bsn:3wxYHXwAm57grc9JUr2zrPHt9HC",
      "signatureValue": "zD5nt+P/Ga/CRG2hJU/SMRXy210CLdvATsxQdPxTEy9Mc9Y0OSFpE3Yu5k2+OjQKVOtu5of9VFbgO3Zljw/vQxs="
   }
}
© 2019-2023 Red Date (Hong Kong) Technology Limited. all right reserved,powered by GitbookFile Modify: 2023-02-16 12:22:03

results matching ""

    No results matching ""

    results matching ""

      No results matching ""