7. addIssuerIntoIssuerType

基本信息

  1. 接口名称: com.webank.weid.rpc.AuthorityIssuerService.addIssuerIntoIssuerType
  2. 接口定义: ResponseData<Boolean> addIssuerIntoIssuerType(WeIdAuthentication callerAuth, String issuerType, String targetIssuerWeId)
  3. 接口描述: 向指定的issuerType中添加成员。
  4. 权限说明:方法的调用者至少需要是Authority Issuer才能成功。

接口入参:

名称类型非空说明备注
callerAuthWeIdAuthenticationYweId身份信息
issuerTypeStringY机构类型
targetIssuerWeIdStringYissuer的WeIdentity DID

com.webank.weid.protocol.base.WeIdAuthentication

名称类型非空说明备注
weIdStringYWeIdentity DIDWeIdentity DID的格式传入
weIdPublicKeyIdStringN公钥Id
weIdPrivateKeyWeIdPrivateKeyY 交易私钥,见下

接口返回: com.webank.weid.protocol.response.ResponseData<Boolean>;

名称类型说明备注
errorCodeInteger返回结果码
errorMessageString返回结果描述
resultBoolean是否添加成员成功
transactionInfoTransactionInfo交易信息

com.webank.weid.protocol.response.TransactionInfo

名称类型说明备注
blockNumberBigInteger交易块高
transactionHashString交易hash
transactionIndexBigInteger交易索引

此方法返回code

enumcodedesc
SUCCESS0成功
WEID_DOES_NOT_EXIST100104WeIdentity DID不存在
AUTHORITY_ISSUER_ERROR100200授权标准异常
WEID_INVALID100201无效的WeIdentity DID
AUTHORITY_ISSUER_PRIVATE_KEY_ILLEGAL100202私钥格式非法
SPECIFIC_ISSUER_TYPE_ILLEGAL100208机构类型非法
TRANSACTION_TIMEOUT160001超时
TRANSACTION_EXECUTE_ERROR160002交易错误
UNKNOW_ERROR160003未知异常
ILLEGAL_INPUT160004参数为空

调用示例

  1. WeIdAuthentication weIdAuthentication = new WeIdAuthentication();
  2. weIdAuthentication.setWeId("did:weid:101:0x39e5e6f663ef77409144014ceb063713b65600e7");
  3.  
  4. WeIdPrivateKey weIdPrivateKey = new WeIdPrivateKey();
  5. weIdPrivateKey.setPrivateKey("60866441986950167911324536025850958917764441489874006048340539971987791929772");
  6. weIdAuthentication.setWeIdPrivateKey(weIdPrivateKey);
  7.  
  8. weIdAuthentication.setWeIdPublicKeyId("did:weid:101:0x39e5e6f663ef77409144014ceb063713b65600e7#key0");
  9. AuthorityIssuerService authorityIssuerService = new AuthorityIssuerServiceImpl();
  10. ResponseData<List<AuthorityIssuer>> response = authorityIssuerService.addIssuerIntoIssuerType(weIdAuthentication, "College", "did:weid:101:0x39e5e6f663ef77409144014ceb063713b65600e7");
  1. 返回数据如:
  2. result: true
  3. errorCode: 0
  4. errorMessage: success
  5. transactionInfo: (com.webank.weid.protocol.response.TransactionInfo)
  6. blockNumber: 29950
  7. transactionHash: 0xe3f48648beee61d17de609d32af36ac0bf4d68a9352890b04d53841c4949bd13
  8. transactionIndex: 0

时序图

sequenceDiagramparticipant 调用者participant AuthorityIssuerServiceparticipant 区块链节点调用者->>AuthorityIssuerService: addIssuerIntoIssuerType()AuthorityIssuerService->>AuthorityIssuerService: 入参非空、格式及合法性检查opt 入参校验失败AuthorityIssuerService—>>调用者: 报错,提示参数不合法并退出endAuthorityIssuerService->>区块链节点: 调用添加授权机构合约区块链节点->>区块链节点: 执行合约添加授权机构区块链节点—>>AuthorityIssuerService: 返回执行结果AuthorityIssuerService—>>调用者: 返回执行结果