# DID-接入协议接口 ## 1. DID颁证机构接入协议接口 ### 1.1. [协议]查询VC列表 **供持有VC的DID用户查询自身VC。需DID持有者签名。** **接口URL:** > {service_url}/did/vc/list **请求方式:** > POST **请求Body参数:** ```json { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-05-27T18:48:23+08:00", "extend": { "page": { "page": 1, "size": 10 }, "holder": "did:cndid:8e5fcb1ccb5847339728234cf58a5250", "issuer": "did:cndid:cndid", "templateId": "100000", "vcId": "", "status": -1 }, "id": "5402bea8f857471d8e6eab4d851dd9ae", "presentationUsage": "VerifiablePresentation", "proof": [ { "created": "2024-05-27T16:48:23+08:00", "proofPurpose": "assertionMethod", "proofValue": "MEYCIQDHTO3nrQASiTopEdDv7bTagG7Immzilyx1lqtjhhL3xwIhALDHa6scOU5C5qRv1GzHMUWv80DY9JKKYa3Wi7CSdIgW", "type": "SM2Signature", "verificationMethod": "did:cndid:8e5fcb1ccb5847339728234cf58a5250#key-1" } ], "timestamp": "2024-05-27T16:48:23+08:00", "type": "VerifiablePresentation", "verifier": "did:cndid:cndid" } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |--------------------------|-------------------------------------------------|--------|------|-------------------| | @context | - | Array | 是 | - | | expirationDate | 2024-05-27T18:48:23+08:00 | String | 是 | 当前VP的有效期,日期格式固定 | | extend | - | Object | 是 | 业务字段 | | extend.page | - | Object | 否 | 分页页码,数字类型 | | extend.page.page | 1 | Number | 是 | 分页页码,数字类型 | | extend.page.size | 10 | Number | 是 | 每页条数 | | extend.holder | did:cndid:8e5fcb1ccb5847339728234cf58a5250 | String | 否 | 持证人 | | extend.issuer | did:cndid:cndid | String | 是 | 发证人 | | extend.templateId | 100000 | String | 否 | 模板,ID非必传 | | extend.vcId | - | String | 否 | 精准查询 | | extend.status | -1 | Number | 否 | VC状态 -1全部,0正常,1吊销 | | id | 5402bea8f857471d8e6eab4d851dd9ae | String | 是 | id | | presentationUsage | VerifiablePresentation | String | 是 | VP用途 | | proof | - | Array | 是 | 证明结构 | | proof.created | 2024-05-27T16:48:23+08:00 | String | 是 | - | | proof.proofPurpose | assertionMethod | String | 是 | - | | proof.proofValue | MEYCIQDHTO3nrQASiTopEdDv7bTagG7Immzilyx1lq | String | 是 | - | | proof.type | SM2Signature | String | 是 | - | | proof.verificationMethod | did:cndid:8e5fcb1ccb5847339728234cf58a5250#key-1 | String | 是 | - | | timestamp | 2024-05-27T16:48:23+08:00 | String | 是 | 当前时间戳 | | type | VerifiablePresentation | String | 是 | - | | verifier | did:cndid:cndid | String | 是 | 验证者 | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "page": { "page": 1, "size": 10, "total": 1 }, "list": [ { "status": 0, "vc": { "@context": [ "https://cnbn.org.cn/ns/credentials/v2" ], "credentialSubject": { "certificateName": "真传弟子证书", "id": "did:cndid:8e5fcb1ccb5847339728234cf58a5250", "identityCardNumber": "32131312312312312321", "issuerName": "昊天宗", "name": "石昊", "phone": "13888888888" }, "expirationDate": "2027-05-27T16:48:18+08:00", "holder": "did:cndid:8e5fcb1ccb5847339728234cf58a5250", "id": "https://192.168.1.181:30003/api/v1/did/vc/0dfcb1b4a35748569c3997913aaca90c", "issuanceDate": "2024-05-27T16:48:18+08:00", "issuer": "did:cndid:cndid", "proof": [ { "created": "2024-05-27T16:48:18+08:00", "proofPurpose": "assertionMethod", "proofValue": "MEUCIHg8hRwe1XuMJEA6nbjC4AtNSM7lhj78G2gHUka8eU+FAiEAkJXopkfha1mwF7GStgUpt8C65h+gtOSznlCRh67LMaM=", "type": "SM2Signature", "verificationMethod": "did:cndid:cndid#key-1" } ], "template": { "id": "100010", "name": "核心底子证书", "version": "1.0" }, "type": [ "VerifiableCredential", "IdentityCredential" ] } } ] } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |---------------------------------------------------|------------------------------------------------|--------|-------------------| | code | 200000 | Number | 错误码 | | msg | ok | String | 错误信息 | | data | - | Object | 数据 | | data.page | - | Object | 分页结构 | | data.page.page | 1 | Number | - | | data.page.size | 10 | Number | - | | data.page.total | 1 | Number | 总共有多少条数据 | | data.list | - | Array | VC列表 | | data.list.status | 0 | Number | VC状态 -1全部,0正常,1吊销 | | data.list.vc | - | Object | 凭证信息 | | data.list.vc.@context | - | Array | JsonLD | | data.list.vc.credentialSubject | - | Object | 凭证主体 | | data.list.vc.credentialSubject.certificateName | 真传弟子证书 | String | - | | data.list.vc.credentialSubject.id | did:cndid:8e5fcb1ccb5847339728234cf58a5250 | String | - | | data.list.vc.credentialSubject.identityCardNumber | 32131312312312312321 | String | - | | data.list.vc.credentialSubject.issuerName | 昊天宗 | String | - | | data.list.vc.credentialSubject.name | 石昊 | String | - | | data.list.vc.credentialSubject.phone | 13888888888 | String | - | | data.list.vc.expirationDate | 2027-05-27T16:48:18+08:00 | String | 过期时间 | | data.list.vc.holder | did:cndid:8e5fcb1ccb5847339728234cf58a5250 | String | 持有人 | | data.list.vc.id | https://xxxx/api/v1/did/vc/xxx | String | 凭证ID | | data.list.vc.issuanceDate | 2024-05-27T16:48:18+08:00 | String | 签发时间 | | data.list.vc.issuer | did:cndid:cndid | String | 颁证机构 | | data.list.vc.proof | - | Array | 证明结构 | | data.list.vc.proof.created | 2024-05-27T16:48:18+08:00 | String | 创建时间 | | data.list.vc.proof.proofPurpose | assertionMethod | String | - | | data.list.vc.proof.proofValue | MEUCIHg8hRwe1XuMJEA6nbjC4AtNSM7lhj78G2gHUka8eU | String | - | | data.list.vc.proof.type | SM2Signature | String | - | | data.list.vc.proof.verificationMethod | did:cndid:cndid#key-1 | String | - | | data.list.vc.template | - | Object | 凭证模板 | | data.list.vc.template.id | 100010 | String | 凭证模板ID | | data.list.vc.template.name | 核心底子证书 | String | 凭证模板名称 | | data.list.vc.template.version | 1.0 | String | 凭证模板版本 | | data.list.vc.type | - | Array | 类型 | ### 1.2. [协议]查询VC凭证类型 **接口URL:** > {service_url}/did/vc/type/list **请求方式:** > POST **请求Body参数:** ```json { "issuer": "did:cndid:42ec5fc9c884419d92bc02650294251c" } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |--------|--------------------------------------------|--------|------|------| | issuer | did:cndid:42ec5fc9c884419d92bc02650294251c | String | 是 | - | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "typeList": [ "健康类", "VerifiableCredential" ] } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |---------------|--------|--------|------| | code | 200000 | Number | 错误码 | | msg | ok | String | 错误信息 | | data | - | Object | 数据 | | data.typeList | - | Array | 类型列表 | ### 1.3. [协议]查询VCT列表 **接口URL:** > {service_url}/did/vct/list **请求方式:** > POST **请求Body参数:** ```json { "id": "456", "issuer": "did:cndid:42ec5fc9c884419d92bc02650294251c", "vcType": "健康类", "name": "xx平台用户凭证", "version": "v1.0", "page": { "page": 1, "size": 20 } } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |-----------|--------------------------------------------|--------|------|------------| | id | 456 | String | 否 | 凭证模板ID | | issuer | did:cndid:42ec5fc9c884419d92bc02650294251c | String | 是 | 颁证机构 | | vcType | 健康类 | String | 否 | 可选,vc的逻辑类型 | | name | xx平台用户凭证 | String | 否 | 模板名称 | | version | v1.0 | String | 否 | 模板版本 | | page | - | Object | 是 | 分页结构 | | page.page | 1 | Number | 是 | - | | page.size | 20 | Number | 是 | - | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": [ { "fName": "体检模板-1", "id": "20240802173522053", "sName": "体检-1", "vctId": "100064", "version": "v1" } ] } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |--------------|----------------------|--------|--------| | code | 200000 | Number | - | | msg | ok | String | 返回文字描述 | | data | - | Array | 返回数据 | | data.fName | 体检模板-1 | String | 全称 | | data.id | 20240802173522053 | String | id | | data.sName | 体检-1 | String | 简称 | | data.vcType | VerifiableCredential | String | 可选 | | data.vctId | 100064 | String | 模板ID | | data.version | v1 | String | 模板版本 | ### 1.4. [协议]查询VCT详情 **接口URL:** > {service_url}/did/vct/get **请求方式:** > POST **请求Body参数:** ```json { "issuer": "c3b3277619754bfdaf2ca8c599e6bf5b", "localId": "20240802172227031" } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |---------|----------------------------------|--------|------|---------| | issuer | c3b3277619754bfdaf2ca8c599e6bf5b | String | 是 | 颁证机构 | | localId | 20240802172227031 | String | 是 | 本地的模板ID | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "created": "2024-06-12T13:46:30Z", "creator": "did:cndid:b27356b68f224d6394dabb69144bdf7e", "fName": "体检模板", "id": "20240612134630634", "properties": [ { "desc": "测试字符串", "id": "20240612134630634-name", "kind": "string", "maxLen": 15, "minLen": 2, "name": "name", "pattern": "^[一-龥]+$", "required": true, "setBy": 0, "title": "姓名", "type": 1, "vctId": "20240612134630634" }, { "desc": "测试布尔数", "id": "20240612134630634-sex", "kind": "boolean", "name": "sex", "required": true, "setBy": 0, "title": "性别", "vctId": "20240612134630634" }, { "desc": "测试小数", "id": "20240612134630634-weight", "kind": "number", "name": "weight", "required": true, "setBy": 0, "title": "体重", "vctId": "20240612134630634" }, { "desc": "测试整数", "id": "20240612134630634-age", "kind": "integer", "name": "age", "required": true, "setBy": 0, "title": "年龄", "vctId": "20240612134630634" }, { "desc": "测试枚举", "enum": "[\"red\", \"yellow\", \"blue\"]", "id": "20240612134630634-color", "kind": "enum", "name": "color", "required": true, "setBy": 0, "title": "颜色", "vctId": "20240612134630634" } ], "sName": "体检", "type": "object", "vcType": "VerifiableCredential", "vctId": "200120", "version": "v1.0.0" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |--------------------------|-------------------------------------------|---------|----------| | code | 200000 | Number | - | | msg | ok | String | 返回文字描述 | | data | - | Object | 返回数据 | | data.created | 2024-06-12T13:46:30Z | String | 创建时间 | | data.creator | did:cndid:b27356b68f224d6394dabb69144bdf7e | String | 创建者 | | data.fName | 体检模板 | String | 模板全称 | | data.id | 20240612134630634 | String | 申请编号 | | data.properties | - | Array | - | | data.properties.desc | 测试字符串 | String | 字段描述 | | data.properties.id | 20240612134630634-name | String | 申请编号 | | data.properties.kind | string | String | 字段类型 | | data.properties.maxLen | 15 | Number | 字符串长度最大值 | | data.properties.minLen | 2 | Number | 字符串长度最小值 | | data.properties.name | name | String | 字段名 | | data.properties.pattern | ^[一-龥]+$ | String | - | | data.properties.required | true | Boolean | 是否必须提供 | | data.properties.setBy | 0 | Number | - | | data.properties.title | 姓名 | String | 字段显示名 | | data.properties.type | 1 | Number | 模板类型 | | data.properties.vctId | 20240612134630634 | String | 模板ID | | data.properties.enum | ["red", "yellow", "blue"] | String | - | | data.sName | 体检 | String | 模板简称 | | data.type | object | String | 模板类型 | | data.vcType | VerifiableCredential | String | 颁发出的凭证类型 | | data.vctId | 200120 | String | 模板ID | | data.version | v1.0.0 | String | 模板的版本号 | ### 1.5. [协议]用户申请注销VC **接口URL:** > {service_url}/did/vc/cancel **请求方式:** > POST **请求Body参数:** ```json { "@context": ["https://cnbn.org.cn/ns/vp/v2"], "expirationDate": "2024-08-06T16:50:22+08:00", "extend": { "ids": [ "http://127.0.0.1:17784/api/v1/did-mgr/20240805135418417", "http://127.0.0.1:17784/api/v1/did-mgr/20240805135418418" ] }, "presentationUsage": "注销VC", "proof": [{ "created": "2024-08-05T08:50:22Z", "proofValue": "MEUCIBqS49ZLyqF4U0gBcNVzY9oPW3IRI34TgKosQhyC2hWSAiEA044VyYoneLEyq1RSfD9b435JEaNEJYpfZtb1loWlAPc=", "type": "SM2Signature", "verificationMethod": "did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b#key-1" }], "timestamp": "2024-08-05T16:50:22+08:00", "type": "VerifiablePresentation" } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |--------------------------|------------------------------------------------------|--------|------|-------| | @context | - | Array | 否 | 上下文信息 | | expirationDate | 2024-08-06T16:50:22+08:00 | String | 否 | 到期日期 | | extend | - | Object | 否 | 扩展信息 | | extend.ids | - | Array | 否 | VC ID | | presentationUsage | 注销VC | String | 否 | VP用途 | | proof | - | Array | 否 | 证明结构 | | proof.created | 2024-08-05T08:50:22Z | String | 否 | - | | proof.proofValue | MEUCIBqS49ZLyqF4U0gBcNVzY9oPW3IRI34TgKosQhyC2hWSAiEA | String | 否 | - | | proof.type | SM2Signature | String | 否 | - | | proof.verificationMethod | did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b#key-1 | String | 否 | - | | timestamp | 2024-08-05T16:50:22+08:00 | String | 否 | 时间戳 | | type | VerifiablePresentation | String | 否 | - | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "result": [ { "reason": "VC(`http://127.0.0.1:17784/api/v1/did-mgr/20240805135418418`) doesn't exist", "vcId": "http://127.0.0.1:17784/api/v1/did-mgr/20240805135418418" } ] } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |--------------------|-----------------------------------------------------------------------------|--------|-----------| | code | 200000 | Number | 错误码 | | msg | ok | String | 错误信息 | | data | - | Object | 数据 | | data.result | - | Array | 结果集 | | data.result.reason | VC(`http://127.0.0.1:17784/api/v1/did-mgr/20240805135418418`) doesn't exist | String | 出错的原因 | | data.result.vcId | http://127.0.0.1:17784/api/v1/did-mgr/20240805135418418 | String | 请求吊销的vcId | ### 1.6. [协议]申请VC **接口URL:** > {service_url}/did/vc/apply **请求方式:** > POST **请求Body参数:** ```json { "@context": ["https://cnbn.org.cn/ns/vp/v2"], "expirationDate": "2024-08-07T17:16:59+08:00", "presentationUsage": "申请体检VC", "timestamp": "2024-08-06T17:16:59+08:00", "type": "VerifiablePresentation", "extend": { "issuer": "did:cndid:42ec5fc9c884419d92bc02650294251c", "vctId": "100073", "version": "v1", "holderDid": "did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b", "holderName": "李四", "credentialSubject": { "name": "李四", "age": 35, "sex": true, "weight": 72 } }, "proof": [{ "created": "2024-08-06T09:16:59Z", "proofValue": "MEYCIQDURFkqxVoLnO2Yd2tVHi7gEutk8B35UrxXoKj/+/3x9AIhAIkZGeA0ZcVj0g0KZzpfZBJqSMtK4iW5tr5Tu+x7jbnV", "type": "SM2Signature", "verificationMethod": "did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b#key-1" }] } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |---------------------------------|--------------------------------------------------|---------|------|--------| | @context | - | Array | 否 | 上下文信息 | | expirationDate | 2024-08-07T17:16:59+08:00 | String | 否 | 证明有效期 | | extend | - | Object | 否 | 扩展信息 | | extend.issuer | did:cndid:42ec5fc9c884419d92bc02650294251c | String | 否 | 颁证机构 | | extend.vctId | 100073 | String | 否 | 模板ID | | extend.version | v1 | String | 否 | 模板版本 | | extend.holderDid | did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b | String | 否 | 持有者DID | | extend.holderName | 李四 | String | 否 | 持有者名称 | | extend.credentialSubject | - | Object | 否 | 凭据主体 | | extend.credentialSubject.name | 李四 | String | 否 | - | | extend.credentialSubject.age | 35 | Number | 否 | - | | extend.credentialSubject.sex | true | Boolean | 否 | - | | extend.credentialSubject.weight | 72 | Number | 否 | - | | proof | - | Array | 否 | 证明结构 | | proof.created | 2024-08-06T09:16:59Z | String | 否 | - | | proof.proofValue | MEYCIQDURFkqxVoLnO2Yd2tVHi7gEutk8B35UrV | String | 否 | - | | proof.type | SM2Signature | String | 否 | - | | proof.verificationMethod | did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b#key-1 | String | 否 | - | | timestamp | 2024-08-06T17:16:59+08:00 | String | 否 | 时间戳 | | type | VerifiablePresentation | String | 否 | 类型 | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "id": "00000009" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |---------|----------|--------|----------------------------| | code | 200000 | Number | 错误码 | | msg | ok | String | 错误信息 | | data | - | Object | 数据 | | data.id | 00000009 | String | 本次申请凭证的申请编号,注意不是凭证编号(vcId) | ### 1.7. [协议]查询申请VC审核状态 **接口URL:** > {service_url}/did/vc/apply/list **请求方式:** > POST **请求Body参数:** ```json { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-08-20T11:16:44+08:00", "timestamp": "2024-08-19T11:16:44+08:00", "type": "VerifiablePresentation", "presentationUsage": "体检VC", "extend": { "issuer": "did:cndid:42ec5fc9c884419d92bc02650294251c", "beginTime": "2020-10-20T00:00:00Z" }, "proof": [{ "created": "2024-08-19T03:16:44Z", "proofValue": "MEUCICcWfE6vL2lqyeDN7wIUSnPBcHqsPhZ3z6PIneVLy4XfAiEAvnv+v62604jtcZKZ/cw1EBzqWySk45eott5PKx1/MYk=", "type": "SM2Signature", "verificationMethod": "did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b#key-1" }] } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |--------------------------|--------------------------------------------------|--------|------|---------| | @context | - | Array | 是 | - | | expirationDate | 2024-08-07T17:16:59+08:00 | String | 是 | - | | presentationUsage | 申请体检VC | String | 是 | - | | timestamp | 2024-08-06T17:16:59+08:00 | String | 是 | - | | type | VerifiablePresentation | String | 是 | - | | extend | - | Object | 是 | - | | extend.issuer | did:cndid:42ec5fc9c884419d92bc02650294251c | String | 是 | 颁证机构DID | | extend.beginTime | 2024-08-15T00:00:00+08:00 | String | 是 | 查询开始时间 | | proof | - | Array | 是 | 证明结构 | | proof.created | 2024-08-06T09:16:59Z | String | 是 | - | | proof.proofValue | MEYCIQDURFkqxVoLnO2Yd2tVHi7gEutk8B35UV | String | 是 | - | | proof.type | SM2Signature | String | 是 | - | | proof.verificationMethod | did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b#key-1 | String | 是 | - | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "list": [ { "credentialSubject": { "name": "李四", "age": 35, "sex": true, "weight": 72 }, "applyTime": "2024-08-06T09:15:58Z", "comment": "签发的意见内容", "holderDid": "did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b", "holderName": "张三", "id": "00000001", "issuanceDate": "2024-08-06T09:31:51Z", "issuer": "did:cndid:42ec5fc9c884419d92bc02650294251c", "status": 2, "type": "manual", "vctId": "100073", "vctName": "体检模板-1", "vctVersion": "v1" }, { "applyTime": "2024-08-06T10:14:17Z", "comment": "签发的意见内容", "fields": { "age": 35, "code": "110108201610233321", "color": "red", "name": "李四", "sex": true, "weight": 72 }, "holderDid": "did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b", "holderName": "李四", "id": "00000007", "issuanceDate": "2024-08-06T10:39:17Z", "issuer": "did:cndid:42ec5fc9c884419d92bc02650294251c", "status": 2, "type": "manual", "vctId": "100073", "vctName": "体检模板-1", "vctVersion": "v1" }, { "applyTime": "2024-08-06T10:14:18Z", "comment": "", "fields": { "age": 35, "name": "李四", "sex": true, "weight": 72 }, "holderDid": "did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b", "holderName": "李四", "id": "00000008", "issuanceDate": "", "issuer": "did:cndid:42ec5fc9c884419d92bc02650294251c", "status": 1, "type": "manual", "vctId": "100073", "vctName": "体检模板-1", "vctVersion": "v1" } ], "page": { "total": 10, "page": 1, "size": 20 } } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |------------------------------------|--------------------------------------------|---------|-------------------| | code | 200000 | Number | 错误码 | | msg | ok | String | 错误信息 | | data | - | Object | 数据 | | data.list | - | Array | 列表 | | data.list.credentialSubject | - | Object | 凭据主体 | | data.list.credentialSubject.name | 李四 | String | 模板名称 | | data.list.credentialSubject.age | 35 | Number | - | | data.list.credentialSubject.sex | true | Boolean | - | | data.list.credentialSubject.weight | 72 | Number | - | | data.list.applyTime | 2024-08-06T09:15:58Z | String | 申请时间 | | data.list.comment | 签发的意见内容 | String | 意见信息 | | data.list.holderDid | did:cndid:c3b3277619754bfdaf2ca8c599e6bf5b | String | 持有者did | | data.list.holderName | 张三 | String | 持有者名字 | | data.list.id | 00000001 | String | 凭证id | | data.list.issuanceDate | 2024-08-06T09:31:51Z | String | 签发时间 | | data.list.issuer | did:cndid:42ec5fc9c884419d92bc02650294251c | String | 办证机构 | | data.list.status | 2 | Number | VC状态 -1全部,0正常,1吊销 | | data.list.type | manual | String | 类型 | | data.list.vctId | 100073 | String | vct id | | data.list.vctName | 体检模板-1 | String | vct名称 | | data.list.vctVersion | v1 | String | vct版本 | | data.list.fields | - | Object | 字段 | | data.list.fields.age | 35 | Number | - | | data.list.fields.code | 110108201610233321 | String | - | | data.list.fields.color | red | String | - | | data.list.fields.name | 李四 | String | - | | data.list.fields.sex | true | Boolean | - | | data.list.fields.weight | 72 | Number | - | | data.page | - | Object | 分页结构 | | data.page.total | 10 | Number | - | | data.page.page | 1 | Number | - | | data.page.size | 20 | Number | - | ### 1.8. [协议]查询颁证机构列表 **接口URL:** > {service_url}did/trust-issuer/list/company **请求方式:** > POST **请求Body参数:** ```json { "page": { "page": 1, "size": 10 }, "name": "" } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | | ------ | ---------- | -------- | -------- | -------------------- | | page | 1 | int | 是 | 页数 1开始 | | size | 10 | int | 是 | 每页条数 | | name | 申请体检VC | String | 否 | 企业名称(模糊查询) | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "page": { "page": 1, "size": 10, "total": 755 }, "list": [ { "did": "did:cndid:e54a194e9b8e4b2e890fcda6735c66c7", "name": "北京安煌汇业医疗器械有限公司1737178312" }, { "did": "did:cndid:bf7a7a8171b74b5abccec1eaaf16fe89", "name": "国家区块链技术创新公司测试1737178312" } ] } } ``` ## 2. DID应用接入协议 ### 2.1. DID APP扫码登录 #### 2.1.1. 请求登录二维码 **接口URL:** > 平台自行设计 **请求方式:** > GET **APP 请求URL后的响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-08-20T23:04:00+08:00", "extend": { "authorizedName": "电子提单平台", "authorizedNameEn": "", "callbackUrl": "http://192.168.3.170:9030/api/v1/dev/platform/eBill/login/callback", "logo": "https://docs.chainmaker.org.cn/images/cmLogo.png", "method": "POST", "requestId": "202408201804000ba668dae", "siteName": "长安链ChainMaker" }, "id": "2024082010040006b8129ea", "presentationUsage": "DID_LOGIN_REQUEST", "proof": [ { "created": "2024-08-20T10:04:00Z", "proofPurpose": "assertionMethod", "proofValue": "MEUCIEebdwyxB9GhcXjah7hG2JACxsJrA1PzUxWVLSGcV+kYAiEA4pI4ggjyCi5fSg6zpvko9WbeMeLvF3KsqObUVDT3JBE=", "type": "SM2Signature", "verificationMethod": "did:cndid:40a370b06a0e42cebd6f1273dc2b662d#key-1" } ], "timestamp": "2024-08-20T10:04:00Z", "type": "VerifiablePresentation" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |-------------------------------|--------------------------------------------------|---------|--------------------------------| | code | 200000 | Integer | - | | msg | ok | String | 响应信息 | | data | - | Object | 返回具体数据,此处为一个VP | | data.@context | - | Array | - | | data.expirationDate | 2024-08-20T23:04:00+08:00 | String | 过期时间 | | data.extend | - | Object | 自定义参数 | | data.extend.authorizedName | 电子提单平台 | String | - | | data.extend.authorizedNameEn | - | String | - | | data.extend.callbackUrl | http://xxx/xxx/login/callback | String | 回调地址 | | data.extend.logo | https://docs.chainmaker.org.cn/images/cmLogo.png | String | logo | | data.extend.method | POST | String | http方法 | | data.extend.requestId | 202408201804000ba668dae | String | 请求ID | | data.extend.siteName | 长安链ChainMaker | String | 网站名称 | | data.id | 2024082010040006b8129ea | String | VP的ID | | data.presentationUsage | DID_LOGIN_REQUEST | String | VP用途 | | data.proof | - | Array | 证明结构 | | data.proof.created | 2024-08-20T10:04:00Z | String | 签名时间 | | data.proof.proofPurpose | assertionMethod | String | 签名目的,固定为authentication | | data.proof.proofValue | MEUCIEebdwyxB9GhcXjah7hG2JACxsJrA1PzUxWVLSGc | String | 签名值,base64编码字符串 | | data.proof.type | SM2Signature | String | 签名算法,固定填写SM2Signature | | data.proof.verificationMethod | did:cndid:40a370b06a0e42cebd6f1273dc2b662d#key-1 | String | 验签公钥 | | data.timestamp | 2024-08-20T10:04:00Z | String | - | | data.type | VerifiablePresentation | String | vp类型,固定为VerifiablePresentation | #### 2.1.2. 登录callback接口 **接口URL:** > 平台自行设计 **请求方式:** > POST **APP 请求callbackUrl的VP示例:** ```json { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-05-16T17:16:12+08:00", "extend": { "requestId": "202405161216120c11fb49d" }, "id": "2024051604161207342157e", "presentationUsage": "DID_LOGIN_RESPONSE", "proof": [ { "created": "2024-05-16T04:16:12Z", "proofPurpose": "assertionMethod", "proofValue": "MEQCIFy+KhYtCPngGoVJvKVQYad8ZGisi1MRo4X3147SNMpwAiAbVoFrHGXHs3S6IDDib5dobb/EnzD1R9gW5ddI1ynb5A==", "type": "SM2Signature", "verificationMethod": "did:cndid:52e00ac869774e6dbdf0ddc6a607c0d9#key-1" } ], "timestamp": "2024-05-16T04:16:12Z", "type": "VerifiablePresentation" } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |--------------------------|--------------------------------------------------|--------|--------------------------------| | @context | - | Array | - | | expirationDate | 2024-08-20T23:04:00+08:00 | String | 过期时间 | | extend | - | Object | 自定义参数 | | extend.requestId | 202405161216120c11fb49d | String | 交易ID | | id | 2024082010040006b8129ea | String | VP唯一编号 | | presentationUsage | DID_LOGIN_RESPONSE | String | VP用途 | | proof | - | Array | 证明结构 | | proof.created | 2024-08-20T10:04:00Z | String | 签名时间 | | proof.proofPurpose | assertionMethod | String | 签名目的,固定为authentication | | proof.proofValue | MEUCIEebdwyxB9GhcXjah7hG2JACxsJrA1PzUxWVLSGcV+ | String | 签名值,base64编码字符串 | | proof.type | SM2Signature | String | 签名算法,固定填写SM2Signature | | proof.verificationMethod | did:cndid:40a370b06a0e42cebd6f1273dc2b662d#key-1 | String | 验签公钥 | | timestamp | 2024-08-20T10:04:00Z | String | - | | type | VerifiablePresentation | String | vp类型,固定为VerifiablePresentation | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": true } ``` ### 2.2. DID APP扫码出示VP #### 2.2.1. 请求出示VP二维码 **接口URL:** > 平台自行设计 **请求方式:** > GET **APP 请求URL后的响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-06-03T16:49:28+08:00", "extend": { "authorizedName": "电子提单平台", "authorizedNameEn": "", "callbackUrl": "http://192.168.3.170:9030/api/v1/dev/platform/eBill/showVP/callback", "issuer": [ "did:cndid:cndid" ], "method": "", "requestId": "2024060311492806c11520e", "vctId": [ "100001" ] }, "id": "2024060303492807fab4680", "presentationUsage": "DID_GET_IDENTITY_VC_REQUEST", "proof": [ { "created": "2024-06-03T03:49:28Z", "proofPurpose": "assertionMethod", "proofValue": "MEYCIQDbZd9LZLVs1OGjuuVHS35KfmaCX4SkViX14yMHyJEgygIhAK1jpImZFA3bEjxxb2HH0tD/pVdzWV4pm55lZnoz/3OZ", "type": "SM2Signature", "verificationMethod": "did:cndid:52e00ac869774e6dbdf0ddc6a607c0d9#key-1" } ], "timestamp": "2024-06-03T03:49:28Z", "type": "VerifiablePresentation" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |-------------------------------|------------------------------------------------------------|---------|----------------| | code | 200000 | Integer | - | | msg | ok | String | 响应信息 | | data | - | Object | 返回具体数据,此处为一个VP | | data.@context | - | Array | - | | data.expirationDate | 2024-06-03T16:49:28+08:00 | String | 过期时间 | | data.extend | - | Object | 自定义参数 | | data.extend.authorizedName | 电子提单平台 | String | 被授权企业的昵称 | | data.extend.authorizedNameEn | - | String | 被授权企业的英文昵称 | | data.extend.callbackUrl | http://xxxx/api/v1/dev/platform/eBill/showVP/callback | String | 回调地址 | | data.extend.issuer | did:cndid:cndid | Array | 颁证机构DID | | data.extend.method | POST | String | 请求方式 | | data.extend.requestId | 2024060311492806c11520e | String | 请求ID | | data.extend.vctId | 100001 | Array | 凭证模板ID | | data.id | 2024060303492807fab4680 | String | VP唯一编号 | | data.presentationUsage | DID_GET_IDENTITY_VC_REQUEST | String | VP用途 | | data.proof | - | Array | 证明结构 | | data.proof.created | 2024-06-03T03:49:28Z | String | 签名时间 | | data.proof.proofPurpose | assertionMethod | String | 签名目的, | | data.proof.proofValue | MEYCIQDbZd9LZLVs1OGjuuVHS35KfmaCX4SkViX14yMHyJEgygIhAK1jpI | String | 签名值, | | data.proof.type | SM2Signature | String | 签名算法 | | data.proof.verificationMethod | did:cndid:52e00ac869774e6dbdf0ddc6a607c0d9#key-1 | String | 验签公钥ID | | data.timestamp | 2024-06-03T03:49:28Z | String | 时间戳 | | data.type | VerifiablePresentation | String | vp类型,固定 | #### 2.2.2. 出示VP callback接口 **接口URL:** > 平台自行设计 **请求方式:** > POST **APP 请求callbackUrl的VP示例:** ```json { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-08-05T11:43:36+08:00", "extend": { "requestId": "202408051052170b87b07ba" }, "id": "1ca84d88-c4b4-4f1e-8769-ea63944a0b0c", "presentationUsage": "DID_GET_IDENTITY_VC_RESPONSE", "proof": [ { "created": "2024-08-05T10:53:36+08:00", "proofPurpose": "authentication", "proofValue": "MEUCIQDfZIv+rxQWkzeodYZAYVjDLrjPHz+o8KctxOIGj4ok+gIgdeTZCSWJuyU4vIpdnsAaCplFhm5npX9Js+PZavVZU24=", "type": "SM2Signature", "verificationMethod": "did:cndid:8dbb2b0c1af449c3bb53d38f4b785b8e#key-1" } ], "timestamp": "2024-08-05T10:53:36+08:00", "type": "VerifiablePresentation", "verifiableCredential": [ { "@context": [ "https://cnbn.org.cn/ns/credentials/v2" ], "credentialSubject": { "certificateName": "企业实名认证证书", "dom": "HK", "entname": "进出口企业在平台的名称", "issuerName": "测试签发机构", "legalName": "李四", "licencesn": "626234002776564", "operator": "张三", "opfrom": "1998-10-19", "opscope": "食品", "opto": "2028-10-19", "uniscid": "573113876993135380" }, "expirationDate": "2057-04-26T18:49:37+08:00", "holder": "did:cndid:8dbb2b0c1af449c3bb53d38f4b785b8e", "id": "https://192.168.1.181:30003/api/v1/did/vc/20240802090353590", "issuanceDate": "2024-08-02T09:03:53Z", "issuer": "did:cndid:40a370b06a0e42cebd6f1273dc2b662d", "proof": [ { "created": "2024-08-02T09:03:53Z", "proofValue": "MEQCIBVvmKQCNcV8PzafF8g7uaz2dehPO5noz+ax/saRUWz0AiB196M2YtwFuz+aqJB6LIUIZeFO20g1n1LlqcP2xCOkOA==", "type": "SM2Signature", "verificationMethod": "did:cndid:40a370b06a0e42cebd6f1273dc2b662d#key-1" } ], "template": { "id": "100003", "name": "第三方企业实名登记证书", "vcType": "IdentityCredential", "version": "1.0" }, "type": [ "VerifiableCredential", "IdentityCredential" ] } ] } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |--------------------------------------------------------|----------------------------------|--------|------|-------------------| | @context | - | Array | 是 | 上下文 | | expirationDate | 2024-08-05T11:43:36+08:00 | String | 是 | 过期时间 | | extend | - | Object | 是 | 自定义字段 | | extend.requestId | 202408051052170b87b07ba | String | 是 | 当次请求的唯一ID | | id | 1ca84d88-c4b4-4f1e-8769-ea6394 | String | 是 | 文章ID | | presentationUsage | DID_GET_IDENTITY_VC_RESPONSE | String | 是 | VP用途 | | proof | - | Array | 是 | 证明结构 | | proof.created | 2024-08-05T10:53:36+08:00 | String | 是 | 签名时间 | | proof.proofPurpose | authentication | String | 是 | 固定为authentication | | proof.proofValue | MEUCIQDfZIv+rxQWkzeodYZAYVjDLrj | String | 是 | 签名值 | | proof.type | SM2Signature | String | 是 | vp类型,固定 | | proof.verificationMethod | did:cndid:xxxx#key-1 | String | 是 | 验签公钥 | | timestamp | 2024-08-05T10:53:36+08:00 | String | 是 | - | | type | VerifiablePresentation | String | 是 | vp类型,固定 | | verifiableCredential | - | Array | 是 | VC凭证 | | verifiableCredential.@context | - | Array | 是 | 上下文 | | verifiableCredential.credentialSubject | - | Object | 是 | 凭证详情 | | verifiableCredential.credentialSubject.certificateName | 企业实名认证证书 | String | 是 | - | | verifiableCredential.credentialSubject.dom | HK | String | 是 | 注册地 | | verifiableCredential.credentialSubject.entname | 进出口企业在平台的名称 | String | 是 | 企业名称 | | verifiableCredential.credentialSubject.issuerName | 测试签发机构 | String | 是 | 签发机构 | | verifiableCredential.credentialSubject.legalName | 李四 | String | 是 | 法人 | | verifiableCredential.credentialSubject.licencesn | 626234002776564 | String | 是 | 电子营业执照号 | | verifiableCredential.credentialSubject.operator | 张三 | String | 是 | - | | verifiableCredential.credentialSubject.opfrom | 1998-10-19 | String | 是 | 经营期限起 | | verifiableCredential.credentialSubject.opscope | 食品 | String | 是 | 经营范围 | | verifiableCredential.credentialSubject.opto | 2028-10-19 | String | 是 | 经营期限止 | | verifiableCredential.credentialSubject.uniscid | 573113876993135380 | String | 是 | 统一社会信用代码 | | verifiableCredential.expirationDate | 2057-04-26T18:49:37+08:00 | String | 是 | 过期时间 | | verifiableCredential.holder | did:cndid:xxxxx | String | 是 | 持有人 | | verifiableCredential.id | https://xxx/api/v1/did/vc/xx | String | 是 | 唯一编号 | | verifiableCredential.issuanceDate | 2024-08-02T09:03:53Z | String | 是 | 签发时间 | | verifiableCredential.issuer | did:cndid:xxxxxx | String | 是 | 签发机构 | | verifiableCredential.proof | - | Array | 是 | 证明结构 | | verifiableCredential.proof.created | 2024-08-02T09:03:53Z | String | 是 | 签名时间 | | verifiableCredential.proof.proofValue | MEQCIBVvmKQCNcV8PzafF8g7uaz2dehx | String | 是 | 签名值,base64编码字符串 | | verifiableCredential.proof.type | SM2Signature | String | 是 | 签名算法,固定 | | verifiableCredential.proof.verificationMethod | did:cndid:xxxx#key-1 | String | 是 | 验签公钥 | | verifiableCredential.template | - | Object | 是 | 模板 | | verifiableCredential.template.id | 100003 | String | 是 | 模板唯一编号 | | verifiableCredential.template.name | 第三方企业实名登记证书 | String | 是 | 模板类型 | | verifiableCredential.template.vcType | IdentityCredential | String | 是 | - | | verifiableCredential.template.version | 1.0 | String | 是 | 模板版本 | | verifiableCredential.type | - | Array | 是 | vp类型,固定 | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": true } ``` ### 2.3. DID APP扫码签名 #### 2.3.1. 请求签名二维码 **接口URL:** > 平台自行设计 **请求方式:** > GET **APP 请求URL后的响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-03-06T15:06:47+08:00", "extend": { "applyNumber": "xxxxxx", "authorisedCompanyName": "xxxx", "authorisedUSCC": "xxxx", "authorisationContent": "xxxxxxxx", "authorisationId": "xxxxx", "authorisationTitle": "xxxxx", "authoriserCompanyName": "xxxx", "authoriserIdCard": "xxxx", "authoriserPersonalName": "xxxx", "authoriserSubjectType": "xxxx", "authoriserUSCC": "xxxxxxx", "authorizedName": "xxx", "authorizedNameEn": "xxx", "callbackUrl": "xxxxxx", "extendField": "xxxx", "method": "GET", "requestId": "CJ0eXAiOiJKV1MifQQ9Q9JKV9JYDNOU0oyJ", "requiredVC": true, "validityPeriod": "2024-06-20" }, "id": "202403040120000-0000001", "presentationUsage": "IDA_AUTHORISATION_REQUEST", "proof": [ { "created": "2022-01-01T00:00:00+08:00", "proofPurpose": "authentication", "proofValue": "eyJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6ZXhhbXBsZToxMjM0NTY3ODlhYmNkZWZnaGlfa2V5LTEiLCJ0eXAiOiJKV1MifQ..Q9JYDNOU0oyJkXW5NcC1hR3U4SHN6U1RiY3pvYkUzam5vY3VtY2tjZERxY3dLd1Z0a1d0Z2pUa0dWY3A0bFZJZw", "type": "SM2Signature", "verificationMethod": "did:cndid:123456789abcdefghi#keys-1" } ], "type": "VerifiablePresentation", "verifier": "did:cndid:verifier1234" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | | ---------------------------------- | ------------------------------------ | -------- | --------------------------------------- | | code | 200000 | Integer | - | | msg | ok | String | 响应信息 | | data | - | Object | 返回具体数据,此处为一个VP | | data.@context | https://cnbn.org.cn | Array | - | | data.expirationDate | 2024-06-03T16:49:28+08:00 | String | 过期时间 | | data.extend | - | Object | 自定义参数 | | data.extend.applyNumber | "xxxx" | String | 申请单编号 | | data.extend.authorisedCompanyName | xxxx | String | 被授权方企业名称 | | data.extend.authorisedUSCC | xxxx | String | 被授权方统一社会信用代码 | | data.extend.authorisationContent | "xxxx" | String | 授权书正文 | | data.extend.authorisationId | "xxxx" | String | 授权书Id | | data.extend.authorisationTitle | "xxxx" | String | 授权书标题 | | data.extend.authoriserCompanyName | "xxxx" | String | 授权方企业名称 | | data.extend.authoriserIdCard | "xxxx" | String | 授权方身份证号 | | data.extend.authoriserPersonalName | "xxxx" | String | 授权方个人姓名 | | data.extend.authoriserSubjectType | "xxxx" | Int | 授权方主体类型(个人/企业) | | data.extend.authoriserUSCC | "xxxx" | String | 授权方统一社会信用代码 | | data.extend.authorizedName | 电子提单平台 | String | 被授权企业的昵称 | | data.extend.authorizedNameEn | - | String | 被授权企业的英文昵称 | | data.extend.callbackUrl | http://xxxxx | String | 回调地址 | | data.extend.extendField | xxxx | String | 扩展字段,例如报关单号等 | | data.extend.method | POST | String | 请求方式 | | data.extend.requestId | CJ0eXAiOiJKV1MifQQ9Q9JKV9JYDNOU0oyJ | String | 请求ID | | data.extend.requiredVC | true | Boolean | 是否需要实名VC,true-需要 false-不需要 | | data.extend.validityPeriod | 2024-06-20 | String | 有效期(含) | | data.id | 2024060303492807fab4680 | String | VP唯一编号 | | data.presentationUsage | IDA_AUTHORISATION_REQUEST | String | 自定义用途,见存证中心接口接口说明。 | | data.proof | - | Array | 证明结构 | | data.proof.created | 2024-06-03T03:49:28Z | String | 签名时间 | | data.proof.proofPurpose | assertionMethod | String | 签名目的, | | data.proof.proofValue | MEYCIQDbZd9LZLVs1OGjuuVHS35KfmaCX4Sk | String | 签名值, | | data.proof.type | SM2Signature | String | 签名算法,固定填写SM2Signature | | data.proof.verificationMethod | did:cndid:xxxxxx#key-1 | String | 验签公钥ID取自VerificationMethod.id字段 | | data.timestamp | 2024-06-03T03:49:28Z | String | 时间戳 | | data.type | VerifiablePresentation | String | vp类型,固定为VerifiablePresentation | #### 2.3.2. 签名callback接口 **接口URL:** > 平台自行设计 **请求方式:** > POST **APP 请求callbackUrl的VP示例:** ```json { "context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-03-06T15:06:47+08:00", "extend": { "applyNumber": "xxxxxx", "authoriedCompanyName": "xxxx", "authoriedUSCC": "xxxx", "authorisationContent": "xxxxxxxx", "authorisationId": "xxxxx", "authorisationTitle": "xxxxx", "authoriserCompanyName": "xxxx", "authoriserCompanyNameDid": "xxxx", "authoriserIdCard": "xxxx", "authoriserIdCardDid": "xxxx", "authoriserPersonNameDid": "xxxx", "authoriserPersonalName": "xxxx", "authoriserSubjectType": "xxxx", "authoriserUSCC": "xxxxxxx", "authoriserUSCCDid": "xxxxxxx", "extendField": "xxxx", "requestId": "CJ0eXAiOiJKV1MifQQ9Q9JKV9JYDNOU0oyJ", "validityPeriod": "2024-06-20" }, "id": "202403040120000-0000001", "presentationUsage": "IDA_AUTHORISATION_RESPONSE", "proof": [ { "created": "2024-03-06T15:06:47Z", "proofPurpose": "authentication", "proofValue": "eyJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6ZXhhbXBsZToxMjM0NTY3ODlhYmNkZWZnaGlfa2V5LTEiLCJ0eXAiOiJKV1MifQ9JYDNOU0oyJkXW5NcC1hR3U4SHN6U1RiY3pvYkUzam5vY3VtY2tjZERxY3dLd1Z0a1d0Z2pUa0dWY3A0bFZJZw", "type": "SM2Signature", "verificationMethod": "did:cndid:bx#keys-1" } ], "type": "VerifiablePresentation", "verifiableCredential": [ { "xxx": "企业实名VC或者个人实名VC" } ], "verifier": "did:cndid:qiye01" } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |---------------------------------|-------------------------------------|--------|---------------------------------| | @context | https://cnbn.org.cn | Array | - | | expirationDate | 2024-06-03T16:49:28+08:00 | String | 过期时间 | | extend | - | Object | 自定义参数 | | extend.applyNumber | xxxx | String | 申请单编号 | | extend.authoriedCompanyName | xxxx | String | 被授权方企业名称 | | extend.authoriedUSCC | xxxx | String | 被授权方统一社会信用代码 | | extend.authorisationContent | xxxx | String | 授权书正文 | | extend.authorisationId | xxxx | String | 授权书Id | | extend.authorisationTitle | xxxx | String | 授权书标题 | | extend.authoriserCompanyName | xxxx | String | 授权方企业名称 | | extend.authoriserCompanyNameDid | xxxx | String | 授权方企业名称(DID APP实际的) | | extend.authoriserIdCard | xxxx | String | 授权方身份证号 | | extend.authoriserIdCardDid | xxxx | String | 授权方身份证号(DID APP实际的,若无则为空) | | extend.authoriserPersonNameDid | xxxx | String | 授权方个人姓名(DID APP实际的,若无则为空) | | extend.authoriserPersonalName | xxxx | String | 授权方个人姓名 | | extend.authoriserSubjectType | xxxx | String | 授权方主体类型(个人/企业) | | extend.authoriserUSCC | xxxx | String | 授权方统一社会信用代码 | | extend.authoriserUSCCDid | xxxx | String | 授权方统一社会信用代码(DID APP实际的) | | extend.extendField | xxxx | String | 扩展字段,例如报关单号等 | | extend.requestId | CJ0eXAiOiJKV1MifQQ9Q9JKV9JYDNOU0oyJ | String | 请求ID | | extend.validityPeriod | 2024-06-20 | String | 有效期(含) | | id | 2024060303492807fab4680 | String | VP唯一编号 | | presentationUsage | IDA_AUTHORISATION_RESPONSE | String | 自定义用途,见存证中心接口接口说明。 | | proof | - | Array | 证明结构 | | proof.created | 2024-06-03T03:49:28Z | String | 签名时间 | | proof.proofPurpose | assertionMethod | String | 签名目的, | | proof.proofValue | MEYCIQDbZd9LZLVs1OGjuuVHS35KfmaCX4 | String | 签名值, | | proof.type | SM2Signature | String | 签名算法,固定填写SM2Signature | | proof.verificationMethod | did:cndid:xxxxx#key-1 | String | 验签公钥ID取自VerificationMethod.id字段 | | timestamp | 2024-06-03T03:49:28Z | String | 时间戳 | | type | VerifiablePresentation | String | vp类型,固定为VerifiablePresentation | | verifiableCredential | - | Array | VC凭证 | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": true } ``` ### 2.4. DID APP扫码授权文件 **接口URL:** > 平台自行设计 **请求方式:** > GET **APP 请求URL后的响应示例:** #### 2.4.1 单证授权 ```json { "code": 200000, "msg": "ok", "data": { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-06-06T00:01:49+08:00", "extend": { "authorizedDID": "did:cndid:dbd5f1725ab64b539b603af1b00d833a", "authorizedName": "电子保单平台公司", "authorizedVerificationMethod": "did:cndid:dbd5f1725ab64b539b603af1b00d833a#key-1", "businessID": "2343543643", "businessType": "eBL", "createdTime": "2024-08-21T16:38:00+08:00", "fileID": "80b737c798f5bb0d826a987b0289e110d2283bb13d124aba4ec183644a05bb65_0d932e", "fileName": "XXX01.pdf", "operatorDID": "did:cndid:40a370b06a0e42cebd6f1273dc2b662d", "operatorName": "电子提单平台", "requestId": "123456789o023456789o" }, "id": "202406051101490ee6130e8", "presentationUsage": "TDH_GET_AUTH_TO_REQUEST", "proof": [ { "created": "2024-06-05T11:01:49Z", "proofPurpose": "assertionMethod", "proofValue": "MEYCIQDdvpX1cnThnS1ho/uYabTXF2Qxb1XgOsgdUJgGVTw5TAIhAJGdUmmmHJrI1mEV4FZbnrdKf0L+MhvLdcnos+f9uLTP", "type": "SM2Signature", "verificationMethod": "did:cndid:52e00ac869774e6dbdf0ddc6a607c0d9#key-1" } ], "timestamp": "2024-06-05T11:01:49Z", "type": "VerifiablePresentation" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |------------------------------------------|------------------------------------|---------|---------------------------------| | code | 200000 | Integer | - | | msg | ok | String | 响应信息 | | data | - | Object | 返回具体数据,此处为一个VP | | data.@context | - | Array | - | | data.expirationDate | 2024-05-16T17:16:12+08:00 | String | - | | data.extend | - | Object | - | | data.extend.authorizedDID | did:cndid:company | String | 被授权企业的did | | data.extend.authorizedName | XX平台 | String | 被授权企业的昵称 | | data.extend.authorizedVerificationMethod | did:cndid:company#key-1 | String | 被授权企业的did的公钥 | | data.extend.businessID | 2343543643 | String | 文件业务ID | | data.extend.businessType | eBL | String | 文件业务类型 | | data.extend.createdTime | 2024-01-01T00:00:00+08:00 | String | 创建时间 | | data.extend.fileID | 80b737c798f5xxx85bb65_0d932e | String | 请求授权的文件ID | | data.extend.fileName | XXX01.pdf | String | 请求授权的文件名称 | | data.extend.operatorDID | did:cndid:xxxxx | String | 授权企业的DID | | data.extend.operatorName | XX公司 | String | 授权企业的昵称 | | data.extend.updateType | add | String | updateType为add表示新增授权,为del表示取消授权 | | data.extend.requestId | 202405161216120c11fb49d | String | - | | data.id | 2024051604161207342157e | String | 文章ID | | data.presentationUsage | TDH_GET_AUTH_TO_REQUEST | String | - | | data.proof | - | Array | 证明结构 | | data.proof.created | 2024-06-03T03:49:28Z | String | 签名时间 | | data.proof.proofPurpose | assertionMethod | String | 签名目的, | | data.proof.proofValue | MEYCIQDbZd9LZLVs1OGjuuVHS35KfmaCX4 | String | 签名值, | | data.proof.type | SM2Signature | String | 签名算法,固定填写SM2Signature | | data.proof.verificationMethod | did:cndid:xxxxx#key-1 | String | 验签公钥ID取自VerificationMethod.id字段 | | data.timestamp | 2024-06-03T03:49:28Z | String | 时间戳 | | data.type | VerifiablePresentation | String | vp类型,固定为VerifiablePresentation | #### 2.4.2 多证授权 ```json { "code": 200000, "msg": "ok", "data": { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-06-06T00:01:49+08:00", "extend": { "authorizedDID": "did:cndid:dbd5f1725ab64b539b603af1b00d833a", "authorizedName": "电子保单平台公司", "authorizedVerificationMethod": "did:cndid:dbd5f1725ab64b539b603af1b00d833a#key-1", "operatorDID": "did:cndid:40a370b06a0e42cebd6f1273dc2b662d", "operatorName": "电子提单平台", "requestId": "123456789o023456789o" }, "id": "202406051101490ee6130e8", "presentationUsage": "TDH_GET_AUTH_TO_REQUEST", "proof": [ { "created": "2024-06-05T11:01:49Z", "proofPurpose": "assertionMethod", "proofValue": "MEUCIQDX+xQZmd60nULg2Ge0n/i67PfC4YsNdry8g0GjqAoxuQIgAyTmRW7xw8+79V0DDV3248UsrooKzqYLkrueZ3ApjS0=", "type": "SM2Signature", "verificationMethod": "did:cndid:52e00ac869774e6dbdf0ddc6a607c0d9#key-1" } ], "timestamp": "2024-06-05T11:01:49Z", "type": "VerifiablePresentation" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |------------------------------------------|------------------------------------|---------|---------------------------------| | code | 200000 | Integer | - | | msg | ok | String | 响应信息 | | data | - | Object | 返回具体数据,此处为一个VP | | data.@context | - | Array | - | | data.expirationDate | 2024-05-16T17:16:12+08:00 | String | - | | data.extend | - | Object | - | | data.extend.authorizedDID | did:cndid:company | String | 被授权企业的did | | data.extend.authorizedName | XX平台 | String | 被授权企业的昵称 | | data.extend.authorizedVerificationMethod | did:cndid:company#key-1 | String | 被授权企业的did的公钥 | | data.extend.operatorDID | did:cndid:xxxxx | String | 授权企业的DID | | data.extend.operatorName | XX公司 | String | 授权企业的昵称 | | data.extend.updateType | add | String | updateType为add表示新增授权,为del表示取消授权 | | data.extend.requestId | 202405161216120c11fb49d | String | - | | data.id | 2024051604161207342157e | String | 文章ID | | data.presentationUsage | TDH_GET_AUTH_TO_REQUEST | String | - | | data.proof | - | Array | 证明结构 | | data.proof.created | 2024-06-03T03:49:28Z | String | 签名时间 | | data.proof.proofPurpose | assertionMethod | String | 签名目的, | | data.proof.proofValue | MEYCIQDbZd9LZLVs1OGjuuVHS35KfmaCX4 | String | 签名值, | | data.proof.type | SM2Signature | String | 签名算法,固定填写SM2Signature | | data.proof.verificationMethod | did:cndid:xxxxx#key-1 | String | 验签公钥ID取自VerificationMethod.id字段 | | data.timestamp | 2024-06-03T03:49:28Z | String | 时间戳 | | data.type | VerifiablePresentation | String | vp类型,固定为VerifiablePresentation | ## 3. DID 注册接入协议 ### 3.1. 申请邀请码 **此接口为DID服务提供的,供平台方申请邀请码** **接口URL:** > {service_url}/did-app/auth/createInvitationCode **请求方式:** > POST **请求Body参数:** ```json { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-04-01T13:42:49+08:00", "extend": { "action": "authorisation", "auth": 1, "callbackUrl": "xxxx", "created": "2024-03-06T15:06:47Z", "description": "授权xx平台查看xx文件", "enterpriseName": "进出口企业在平台的名称", "type": 1 }, "id": "f158b5e05607473cbdd2b3dcc945af10", "presentationUsage": "VerifiablePresentation", "proof": [ { "created": "2024-04-01T13:32:49+08:00", "proofPurpose": "assertionMethod", "proofValue": "MEYCIQDHSqjP2/fSc1aqKa9OvWKzdLGb0cXKpdZoY7Hi62a1CwIhAPw2A5hgopC3PYQrH8+4SwW+vPdJN4av/ljnzvJ+TBE1", "type": "SM2Signature", "verificationMethod": "did:cndid:a24023197c594edd9d8605fcebc4c221#key-1" } ], "timestamp": "2024-04-01T13:32:49+08:00", "type": "VerifiablePresentation", "verifier": "did:cndid:xxx" } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |--------------------------|----------------------------------------|---------|------|----------------------------------------| | @context | https://www.w3.org/2018/credentials/v1 | Array | 是 | 固定 | | extend | - | Object | 是 | 业务参数 | | expirationDate | 2024-04-01T13:42:49+08:00 | String | 否 | 过期时间 | | extend.description | 授权xx平台查看xx文件 | String | 否 | 描述,提示用户查看信息。当extend.auth为1时必填 | | extend.callbackUrl | xxxx | String | 是 | 回调地址:境外企业获取,获取VC使用 | | extend.action | authorisation | String | 是 | 当前类型为注册认证 | | extend.created | 2024-03-06T15:06:47Z | String | 是 | 创建时间 | | extend.enterpriseName | 进出口企业在平台的名称 | String | 是 | 被邀请的公司名称 | | extend.type | 1 | Integer | 是 | 1 境外 0境内 | | extend.auth | 0 | Integer | 是 | 1 需要单证授权,0 不需要授权,只注册用户,授权流程再次扫描二维码;默认0 | | id | f158b5e05607473cbdd2b3dcc945af10 | String | 是 | VP的ID,唯一即可 | | presentationUsage | VerifiablePresentation | String | 是 | 用途 | | proof | - | Array | 是 | 证明 | | proof.created | 2024-04-01T13:32:49+08:00 | String | 是 | 创建时间 | | proof.proofPurpose | assertionMethod | String | 是 | 签名结构 | | proof.proofValue | MEYCIQDHSqjP2/fSc1aqKa9OvWKzd | String | 是 | 签名 | | proof.type | SM2Signature | String | 是 | 固定 | | proof.verificationMethod | did:cndid:xxxxx#key-1 | String | 是 | 签名人的公钥标识 | | timestamp | 2024-04-01T13:32:49+08:00 | String | 是 | 当前时间戳 | | type | VerifiablePresentation | String | 是 | 固定 | | verifier | did:cndid:xxx | String | 否 | 校验人,可选(did:cndid:cndid) | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "invitationCode": "123445" } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |---------------------|--------|---------|------| | code | 200 | Integer | - | | msg | ok | String | - | | data | - | Object | - | | data.invitationCode | 123445 | String | 邀请码 | ### 3.2. APP回调接口-申请VC **此接口为平台方实现,为邀请码信息中的callback回调接口。 境内返回单证授权信息。 境外返回单证授权信息,和VCs。** **接口URL:** > 平台自行设计 **请求方式:** > POST **请求Body参数:** ```json { "@context": [ "https://cnbn.org.cn/ns/vp/v2" ], "expirationDate": "2024-04-01T13:42:49+08:00", "extend": { "auth": 1, "enterpriseName": "企业实名名称", "holder": "did:cndid:9608c425765b460d885b4142a354d213", "invitationCode": "123456789", "type": 1 }, "id": "f158b5e05607473cbdd2b3dcc945af10", "presentationUsage": "DID_APPLY_INVITATION_CODE_CALLBACK", "proof": [ { "created": "2024-04-01T13:32:49+08:00", "proofPurpose": "assertionMethod", "proofValue": "MEYCIQDHSqjP2/fSc1aqKa9OvWKzdLGb0cXKpdZoY7Hi62a1CwIhAPw2A5hgopC3PYQrH8+4SwW+vPdJN4av/ljnzvJ+TBE1", "type": "SM2Signature", "verificationMethod": "did:cndid:a24023197c594edd9d8605fcebc4c221#key-1" } ], "timestamp": "2024-04-01T13:32:49+08:00", "type": "VerifiablePresentation", "verifier": "did:cndid:xxx" } ``` | 参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 | |--------------------------|---------------------------------------------------|---------|------|-------------------| | @context | https://www.w3.org/2018/credentials/v1 | Array | 是 | 固定 | | expirationDate | 2024-04-01T13:42:49+08:00 | String | 是 | 过期时间,一般当前时间+5分钟 | | extend | - | Object | 是 | 业务参数 | | extend.holder | did:cndid:9608c425765b460d885b4142a354d213 | String | 是 | 持证人,填企业DID | | extend.invitationCode | 123456789 | String | 是 | 邀请码 | | extend.auth | 1 | Integer | 是 | 1 需要授权,0 不需要授权 | | extend.type | 1 | Integer | 是 | 1 境外 0境内() | | extend.enterpriseName | 企业实名名称 | String | 是 | 境内实名名称,境外是邀请码的企业名 | | id | f158b5e05607473cbdd2b3dcc945af10 | String | 是 | VP的ID,随机 | | presentationUsage | DID_APPLY_INVITATION_CODE_CALLBACK | String | 是 | 用途,此处固定 | | proof | - | Array | 是 | 当前注册的企业DID签名 | | proof.created | 2024-04-01T13:32:49+08:00 | String | 是 | 创建时间,签名的时间 | | proof.proofPurpose | assertionMethod | String | 是 | 固定 | | proof.proofValue | MEYCIQDHSqjP2/fSc1aqKa9OvWKzdLGb0cXKpdZoY7Hi62a1C | String | 是 | 签名 | | proof.type | SM2Signature | String | 是 | 固定 | | proof.verificationMethod | did:cndid:a24023197c594edd9d8605fcebc4c221#key-1 | String | 是 | 验签的公钥地址 | | timestamp | 2024-04-01T13:32:49+08:00 | String | 是 | 当前时间戳 | | type | VerifiablePresentation | String | 是 | 固定 | | verifier | did:cndid:xxx | String | 否 | 校验人,可选 | **响应示例:** ```json { "code": 200000, "msg": "ok", "data": { "authInfo": { "fileID": "a3e3f4a5f88x9f00e0a0f86", "fileName": "xx文件.pdf", "businessID": "23543643", "businessType": "eBL", "authorizedName": "xx平台", "authorizedDID": "did:cndid:bx", "operatorDID": "did:cndid:bx", "operatorName": "xx平台", "authorizedVerificationMethod": "取出被授权平台did", "description": "授权xx平台查看xx文件", "presentationUsage": "TDH_GET_AUTH_TO_REQUEST" }, "vcs": [ { "@context": [ "https://cnbn.org.cn/ns/credentials/v2" ], "credentialSubject": { "certificateName": "企业实名认证证书", "dom": "HK", "entname": "enterprise", "id": "did:cndid:9b9ea03577c1426eaca3c68be96d706f", "issuerName": "国家区块链网络", "legalName": "legal", "licencesn": "电子营业执照号", "operator": "1234567890", "opfrom": "1998-10-19", "opscope": "测试。", "opto": "无固定期限", "uniscid": "9131000013220454X6" }, "expirationDate": "2027-04-26T18:49:37+08:00", "holder": "did:cndid:9b9ea03577c1426eaca3c68be96d706f", "id": "https://192.168.1.181:30032/api/v1/did/vc/9bdb633bf101432ca6def2312b729b42", "issuanceDate": "2024-04-26T18:49:37+08:00", "issuer": "did:cndid:cndid", "proof": [ { "created": "2024-04-26T18:49:37+08:00", "proofPurpose": "assertionMethod", "proofValue": "MEUCIAHNGx2s0TNARYrgxrYczqp6imhv2zg/Opb8m1urwIRyAiEA2e5VWrW0YYEnpTTUxnaz+U6awC96pDmb162TuS3dCKI=", "type": "SM2Signature", "verificationMethod": "did:cndid:cndid#key-1" } ], "template": { "id": "100003", "name": "第三方企业实名登记证书", "version": "1.0" }, "type": [ "VerifiableCredential" ] } ] } } ``` | 参数名 | 示例值 | 参数类型 | 参数描述 | |--------------------------------------------|-----------------------------------------------------------|---------|-------------| | code | 200000 | Integer | - | | msg | ok | String | 响应信息 | | data | - | Object | - | | data.authInfo | - | Object | 单证授权信息 | | data.authInfo.fileID | a3e3f4a5f88x9f00e0a0f86 | String | 文件ID | | data.authInfo.fileName | xx文件.pdf | String | 文件名称 | | data.authInfo.businessID | 23543643 | String | 业务ID | | data.authInfo.businessType | eBL | String | 业务类型 | | data.authInfo.authorizedName | xx平台 | String | 被授权企业名称 | | data.authInfo.authorizedDID | did:cndid:bx | String | 被授权DID | | data.authInfo.operatorDID | did:cndid:bx | String | 操作企业DID | | data.authInfo.operatorName | xx平台 | String | 操作企业名称 | | data.authInfo.authorizedVerificationMethod | 中取出被授权平台did | String | 被授权企业公钥标识 | | data.authInfo.description | 授权xx平台查看xx文件 | String | 描述 | | data.authInfo.presentationUsage | TDH_GET_AUTH_TO_REQUEST | String | 请求文件授权给其他平台 | | data.vcs | - | Array | 证书列表 | | data.vcs.@context | https://www.w3.org/2018/credentials/v1 | Array | | | data.vcs.credentialSubject | - | Object | 证书主体 | | data.vcs.credentialSubject.certificateName | 企业实名认证证书 | String | - | | data.vcs.credentialSubject.dom | 北京 | String | - | | data.vcs.credentialSubject.entname | 中国银行股份有限公司上海市分行 | String | - | | data.vcs.credentialSubject.id | did:cndid:9b9ea03577c1426eaca3c68be96d706f | String | - | | data.vcs.credentialSubject.issuerName | 国家区块链网络 | String | - | | data.vcs.credentialSubject.legalName | 法人 | String | - | | data.vcs.credentialSubject.licencesn | 电子营业执照号 | String | - | | data.vcs.credentialSubject.operator | 1234567890 | String | - | | data.vcs.credentialSubject.opfrom | 1998-10-19 | String | - | | data.vcs.credentialSubject.opscope | test | String | - | | data.vcs.credentialSubject.opto | 无固定期限 | String | - | | data.vcs.credentialSubject.uniscid | 9131000013220454X6 | String | - | | data.vcs.expirationDate | 2027-04-26T18:49:37+08:00 | String | 过期时间 | | data.vcs.holder | did:cndid:9b9ea03577c1426eaca3c68be96d706f | String | 持有人 | | data.vcs.id | https://192.168.1.181:30032/api/v1/did/vc/9bdb633bf101432 | String | 凭证ID | | data.vcs.issuanceDate | 2024-04-26T18:49:37+08:00 | String | 凭证签发时间 | | data.vcs.issuer | did:cndid:cndid | String | 办证机构 | | data.vcs.proof | - | Array | 证明结构 | | data.vcs.proof.created | 2024-04-26T18:49:37+08:00 | String | - | | data.vcs.proof.proofPurpose | assertionMethod | String | - | | data.vcs.proof.proofValue | MEUCIAHNGx2s0TNARYrgxrYczqp6imhv2zg/Opb8m1urwIRy | String | - | | data.vcs.proof.type | SM2Signature | String | 固定 | | data.vcs.proof.verificationMethod | did:cndid:cndid#key-1 | String | - | | data.vcs.template | - | Object | 颁证模板 | | data.vcs.template.id | 100003 | String | 颁证模板ID | | data.vcs.template.name | 第三方企业实名登记证书 | String | - | | data.vcs.template.version | 1.0 | String | - | | data.vcs.type | VerifiableCredential | Array | — |