更新时间:2023-03-27 GMT+08:00

企业身份注册(带有service)

功能介绍

分布式身份注册方法。在使用该方法前需要先使用openssl工具生成每个用户的私钥和被fabric组织根证书签名的证书(或通过BCS区块链管理界面下载用户证书)。注册时需声明可提供的服务列表。

URI

POST /v1/identity/firm-did

请求参数

表1 请求Body参数

参数

是否必选

参数类型

描述

orgID

String

组织id

channelID

String

通道id

cryptoMethod

String

加密方法,目前固定为SW

cert

String

用户证书,每行末尾均需要增加显式换行符\n

sk

String

用户私钥,每行末尾均需要增加显式换行符\n

timestamp

String

时间戳

service

Array of DIDService objects

提供的服务

表2 DIDService

参数

是否必选

参数类型

描述

type

String

类型

serviceEndpoint

String

接入点

credentialApplySchema

CredentialApplySchema object

申请凭证所需数据的Schema

表3 CredentialApplySchema

参数

是否必选

参数类型

描述

type

String

类型

name

String

名称

description

String

描述信息

attributes

Array of Attribute objects

属性列表

表4 Attribute

参数

是否必选

参数类型

描述

name

String

名称

type

String

类型

description

String

描述信息

响应参数

状态码: 200

表5 响应Body参数

参数

参数类型

描述

did

String

分布式身份标识

状态码: 500

表6 响应Body参数

参数

参数类型

描述

errorCode

String

错误码

最小长度:8

最大长度:36

errorMsg

String

错误描述

最小长度:2

最大长度:512

请求示例

{
  "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"
      } ]
    }
  } ]
}

响应示例

状态码: 200

分布式身份标识

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

状态码: 500

失败响应

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

状态码

状态码

描述

200

分布式身份标识

500

失败响应