2. removeAuthorityIssuer

基本信息

  1. 接口名称:com.webank.weid.rpc.AuthorityIssuerService.removeAuthorityIssuer
  2. 接口定义:ResponseData<Boolean> removeAuthorityIssuer(RemoveAuthorityIssuerArgs args)
  3. 接口描述: 注销权威机构。
  4. 注意:这是一个需要权限的操作,目前只有合约的部署者(一般为SDK)才能正确执行。

接口入参: com.webank.weid.protocol.request.RemoveAuthorityIssuerArgs

名称类型非空说明备注
weIdStringYWeIdentity DID授权机构WeIdentity DID
weIdPrivateKeyWeIdPrivateKeyY 交易私钥,见下

com.webank.weid.protocol.base.WeIdPrivateKey

名称类型非空说明备注
privateKeyStringY私钥值使用十进制数字表示

接口返回: 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_INVALID100101无效的WeIdentity DID
AUTHORITY_ISSUER_ERROR100200授权标准异常
AUTHORITY_ISSUER_PRIVATE_KEY_ILLEGAL100202私钥格式非法
AUTHORITY_ISSUER_OPCODE_MISMATCH100205操作码不匹配
TRANSACTION_TIMEOUT160001超时
TRANSACTION_EXECUTE_ERROR160002交易错误
ILLEGAL_INPUT160004参数为空

调用示例

  1. AuthorityIssuerService authorityIssuerService = new AuthorityIssuerServiceImpl();
  2.  
  3. WeIdPrivateKey weIdPrivateKey = new WeIdPrivateKey();
  4. weIdPrivateKey.setPrivateKey("36162289879206412028682370838615850457668262092955617990245744195910144330785");
  5.  
  6. RemoveAuthorityIssuerArgs removeAuthorityIssuerArgs = new RemoveAuthorityIssuerArgs();
  7. removeAuthorityIssuerArgs.setWeId("did:weid:101:0x39e5e6f663ef77409144014ceb063713b65600e7");
  8. removeAuthorityIssuerArgs.setWeIdPrivateKey(weIdPrivateKey);
  9.  
  10. ResponseData<Boolean> response = authorityIssuerService.removeAuthorityIssuer(removeAuthorityIssuerArgs);
  1. 返回结果如:
  2. result: true
  3. errorCode: 0
  4. errorMessage: success
  5. transactionInfo:(com.webank.weid.protocol.response.TransactionInfo)
  6. blockNumber: 29951
  7. transactionHash: 0xb9a2ef2a6045e0804b711e0ce39f7187de08e329160d5a5a00a1815e067f15e5
  8. transactionIndex: 0

时序图

sequenceDiagramparticipant 调用者participant AuthorityIssuerServiceparticipant 区块链节点调用者->>AuthorityIssuerService: 调用RemoverAuthorityIssuer()AuthorityIssuerService->>AuthorityIssuerService: 入参非空、格式及合法性检查opt 入参校验失败AuthorityIssuerService—>>调用者: 报错,提示参数不合法并退出endAuthorityIssuerService->>区块链节点: 加载交易私钥,调用移除合约区块链节点->>区块链节点: 权限检查,执行合约删除WeIdentity DID信息区块链节点—>>AuthorityIssuerService: 返回合约执行结果AuthorityIssuerService->>AuthorityIssuerService: 解析合约事件opt 失败,地址无效或无权限AuthorityIssuerService—>>调用者: 报错并退出endAuthorityIssuerService—>>调用者: 返回成功