Updated on 2022-12-06 GMT+08:00

Enterprise Identity Registration (with service)

Function

This API is used to register a DID. Before calling this API, use the OpenSSL tool to generate a private key and the Fabric CA certificate for each user. You can also download the user certificate on the Service Management page of the BCS console. During registration, claim the list of available services.

URI

POST /v1/identity/firm-did

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

orgID

Yes

String

Organization ID.

channelID

Yes

String

Channel ID.

cryptoMethod

Yes

String

Encryption method, which is fixed at SW.

cert

Yes

String

User certificate. Add an explicit line break (\n) at the end of each line.

sk

Yes

String

User private key. Add an explicit line break (\n) at the end of each line.

timestamp

Yes

String

Timestamp.

service

Yes

Array of DIDService objects

Service.

Table 2 DIDService

Parameter

Mandatory

Type

Description

type

Yes

String

Type.

serviceEndpoint

Yes

String

Endpoint.

credentialApplySchema

No

CredentialApplySchema object

Schema used for applying for a VC.

Table 3 CredentialApplySchema

Parameter

Mandatory

Type

Description

type

No

String

Type.

name

No

String

Name.

description

No

String

Description.

attributes

No

Array of Attribute objects

Attributes.

Table 4 Attribute

Parameter

Mandatory

Type

Description

name

No

String

Name.

type

No

String

Type.

description

No

String

Description.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

did

String

Decentralized identifier.

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

Minimum: 8

Maximum: 36

errorMsg

String

Error description.

Minimum: 2

Maximum: 512

Example Requests

{
  "orgID" : "4f1439758ebb41f7411b5f684b67713c08b89198",
  "channelID" : "mychannel",
  "cryptoMethod" : "SW",
  "cert" : "-----BEGIN CERTIFICATE-----\n...\n...\n-----END CERTIFICATE-----",
  "sk" : "------BEGIN PRIVATE KEY-----\n...\n...\n-----END PRIVATE KEY-----",
  "timestamp" : "2020-10-27T17:28:16+08:00",
  "service" : [ {
    "type" : "VerifiableCredentialService",
    "serviceEndpoint" : "https://example.com/vc/",
    "credentialApplySchema" : {
      "type" : "file",
      "name" : "Test Enterprise Certification",
      "description" : "this is test apply info",
      "attributes" : [ {
        "name" : "bob",
        "type" : "string",
        "description" : "Attribute's description"
      } ]
    }
  } ]
}

Example Responses

Status code: 200

Decentralized identifier.

{
  "did" : "did:example:2THjdfbKMLDVcoYvkiepr9"
}

Status code: 500

Error response.

{
  "errorCode" : "BCS.5002033",
  "errorMsg" : "Service Type and ServiceEndpoint Can not Null"
}

Status Codes

Status Code

Description

200

Decentralized identifier.

500

Error response.

Error Codes

See Error Codes.