更新时间:2022-12-06 GMT+08:00
分享

发布可验证凭证的模板

功能介绍

发布凭证模板数据结构。签发professional类型的凭证时会使用,因为字段较多容易不统一,需要提前有模板来约束和标明。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v1/identity/credential-schema

请求参数

表1 请求Body参数

参数

是否必选

参数类型

描述

orgID

String

组织id

channelID

String

通道id

cryptoMethod

String

加密方法,目前固定为SW

cert

String

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

sk

String

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

timestamp

String

时间戳

title

String

名称

identifier

String

标识

attributes

Array of Attribute objects

属性信息

issuer

String

签发者身份标识

表2 Attribute

参数

是否必选

参数类型

描述

name

String

名称

type

String

类型

description

String

描述信息

响应参数

状态码: 200

表3 响应Body参数

参数

参数类型

描述

schemaIndex

String

模板存储在链上的索引

credentialSchema

CredentialSchema object

CredentialSchema

表4 CredentialSchema

参数

参数类型

描述

creator

String

创建者身份标识

title

String

名称

identifier

String

凭证模板标识

attributes

Array of Attribute objects

属性信息

version

Integer

版本

表5 Attribute

参数

参数类型

描述

name

String

名称

type

String

类型

description

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",
  "title" : "string",
  "identifier" : "string",
  "attributes" : [ {
    "name" : "name",
    "type" : "someType",
    "description" : "Identity number"
  } ],
  "issuer" : "did:example:ebfeb1f712ebc6f1c276e12ec21"
}

响应示例

状态码: 200

VCSchemaResponeParams

{
  "schemaIndex" : "string",
  "credentialSchema" : {
    "creator" : "string",
    "title" : "string",
    "identifier" : "string",
    "attributes" : [ {
      "name" : "name",
      "type" : "someType",
      "description" : "Identity number"
    } ],
    "version" : 0
  }
}

状态码: 500

失败响应

{
  "errorCode" : "BCS.5002035",
  "errorMsg" : "Schema Already Exist"
}

状态码

状态码

描述

200

VCSchemaResponeParams

500

失败响应

错误码

请参见错误码

分享:

    相关文档

    相关产品