虚拟通道

Fabric通道的基础上用户可以创建数据隔离范围更小的虚拟通道,将通道成员按需要加入虚拟通道,在做隐私交易时选择虚拟通道,隐私交易就按虚拟通道成员自动生成了解密白名单,即只有同一个虚拟通道中的用户才能解密隐私交易的数据。

创建虚拟通道

URL

POST https://baas.qualink.com/bas/channel/create

请求头部

Content-type: application/json
Authorization: 平台用户身份令牌

请求参数

名称 类型 必须 描述
channel_name String 通道名称
description String 通道描述信息
member_list String[] 通道成员的用户ID数组

示例:

{
    "channel_name": "XXX虚拟通道",
    "description": "XXX虚拟通道描述",
    "member_list": [
        "20180504143743308070",
        "20180504143743308071",
        "20180504143743308072"
    ]
}

返回数据

名称 类型 示例 描述
success Boolean true 响应标记
msg String 成功 提示信息

示例:

{
    "success": true,
    "msg": "通道创建成功"
}

获取虚拟通道信息

URL

POST https://baas.qualink.com/bas/channel/get

请求头部

Content-type: application/json
Authorization: 平台用户身份令牌

请求参数

名称 类型 必须 描述
channel_id String 通道ID

示例:

{
    "channel_id": "CHANNEL_2019110114050281671712"
}

返回数据

名称 类型 示例 描述
success Boolean true 响应标记
msg String 成功 提示信息
data Json - 返回数据
channel_id String - 通道ID
channel_name String - 通道名称
description String - 通道描述
user_id String - 通道创建者用户ID
nick_name String - 通道创建者用户昵称
create_time String - 通道创建时间
member_list List - 通道成员信息列表
channel_secret String - 通道秘钥(加密后的)
user_id(member_list中) String - 通道成员用户ID
nick_name(member_list中) String - 通道成员用户昵称
type String - 成员类型(0:通道创建者,1:通道管理员,2:普通成员)

示例:

{
    "success": true,
    "msg": "通道创建成功",
    "data": {
        "channel_id":"CHANNEL_2019110114050281671712",
        "channel_name": "XXX虚拟通道",
        "description":"XXX虚拟通道",
        "user_id": "20180504143743308070",
        "nick_name": "XXX用户",
        "create_time": "2019-11-01 14:05:02",
        "member_list": [
            {
                "channel_secret":"04B09CACBD9A20B89684F1F54DE7D2BCD8EDC19DAEFC539C44C366CDA6A4284101F8CC093D179A69AE71087601E09611D8F202C55A87D9634F938769A22205958C82E46ACF169B7CC79522FA02BB3FBD31FA418680BD8521F6597C04E2C956AFED389754491CDBDBBE15ADD825FCF80E63999998C71655EA461BE0C8D1A02C7338",
                "user_id":"20180504143743308070",
                "nick_name":"xxxx1",
                "type":"0"
            },
            {
                "channel_secret":"046750E02D09C41EB073D88C6EA6291D94729A12580B3339CF14416E8C849587FA749496DCB42C97B22C6313CC4B7D29E1CA22FA19AFC2EA0DECAC589AD2630DB89CD829AFE5783FC979BE6E8C0C5351E0EA2A50E6DE22B827CCB07EEC248EB27C57A96895C0EC811429E71CA342E264431555461D658871F9948B6899F85F28B1",
                "user_id":"20180504143743308071",
                "nick_name":"xxxx2",
                "type":"2"
            },
            {
                "channel_secret":"04900DD19BC8BD0B07CFD8AA24400ED6973F8006905D29C7EA291B7A7E65BE470BFFAC101FF389D5D3FB7885BF6C3E450AA2150B5CDBEBCDBD0DE40ECD9E4209A2A02268D3258ED54AA67E1D1E33EADCAD6A9481B86B000C21DC57516BAF8D5251E981085A120FC832CBA28A0B082AEC13EAB7C35FC44D3F6D323523B442BE601C",
                "user_id":"20180504143743308072",
                "nick_name":"xxxx3",
                "type":"2"
            }
        ]
    }
}

获取用户所在通道列表

URL

GET https://baas.qualink.com/bas/channel/list/user

请求头部

Authorization: 平台用户身份令牌

请求参数

返回数据

名称 类型 示例 描述
success Boolean true 响应标记
msg String 成功 提示信息
data Json - 返回数据
list List - 通道列表
channel_id String - 通道ID
channel_name String - 通道名称
description String - 通道描述
channel_secret String - 通道秘钥(加密后的)
user_id String - 用户ID
type String - 成员类型(0:通道创建者,1:通道管理员,2:普通成员)
{
    "success": true,
    "msg": "获取成功",
    "data": {
        "list": [
            {
                "channel_id":"CHANNEL_2019103111020955117381",
                "channel_name": "测试通道1",
                "description":"测试通道1",
                "channel_secret": "040CBC50837870226BF5F24A6FCF7E4F91DB7DBC28B7D4D4262F8F47CED0EA033B12270D6243F571F9927B3DCBAF74993B2A8CAFC9AFAFB81E19E4550F402677F450060A808805A048E3C0F5E99412A73102F5AC1A88EB3A83C0EE8F2C3C5126C57518644FD85F296D8E533886EB8ECBA3580F466442B955ABC0859259CFB5214D",
                "user_id": "20180821145735929189",
                "type":"0"
            },
            {
                "channel_id":"CHANNEL_2019110616202279786199",
                "channel_name":"测试通道2",
                "description":"测试通道2",
                "channel_secret":"046D6E7539A967932E05484DFA3A7F6BA2BD5DFC053BF47B81E23AEED82C7D19C88EB57A8FEB3D1B436462A482ADD4F062AEA67B3CAB6EA061C227F96E3F3DFDC7C5F6A97FDBF985C6E2328CC820A83D9BEE5F1CE3435C3C42962416CBCF72C2DCEF098F4183FAADD6851C7050447D59E49EE4694396D500D549094812F52B04EE",
                "user_id":"20180821145735929189",
                "type":"0"
            },
            {
                "channel_id":"CHANNEL_2019110709181488348056",
                "channel_name": "测试通道3",
                "description":"测试通道3",
                "channel_secret": "045E17EF4769B6DCA06808EF6CBBED4860F61212F3DA8CF424340A02FB750B4DCF818493C5EA6344258A250B0813F6E76EA50B19665526383B75D77908D48F070E4BFECE7C0416E18AB4130D10BB29F4C0C660F7AF3A944AFCD46AD4318A3249E5B9355D01505B42BFD9CD73254FEDA7672F86BE73F3C7CF18944150BBEBA4F5CC",
                "user_id":"20180821145735929189",
                "type":"0"

            }
        ]
    }
}