hyperledger-fabric - 如何将钱包凭证放入composer-wallet-inmemory?
问题描述
如何将钱包凭证composer-wallet-inmemory
放入 v.0.19.5?
这是方法:
/**
* Add a new credential to the wallet.
*
* @param {string} name The name of the credentials.
* @param {string} value The credentials.
* @return {Promise} A promise that is resolved when
* complete, or rejected with an error.
*/
put(name, value) {
if (!name) {
return Promise.reject(new Error('Name must be specified'));
}
if (value instanceof IdCard || value instanceof Buffer || value instanceof String || typeof value === 'string'){
this.store.set( this._path(name),value);
return Promise.resolve();
}else {
return Promise.reject(new Error('Unkown type being stored'));
}
}
解决方案
您不应该尝试直接与 composer-wallet 实现进行交互。您应该使用 AdminConnection 的实例来管理卡片商店中的卡片
https://hyperledger.github.io/composer/latest/api/admin-adminconnection
并配置您的环境以使用内存钱包,如此处所述
https://hyperledger.github.io/composer/latest/business-network/cloud-wallets
推荐阅读
- python - jsonschema 库将数字验证为没有上限的字符串
- flutter - 扫描条码时在 Flutter 应用中显示 progressIndicator
- spring - Spring Data JPA:使用可选参数调用存储库方法的有效方法
- android - 重新连接到网络后如何获取有效的 Firebase appcheck 令牌?
- google-gsuite - 发生错误:对 directory.users.signOut 的 API 调用失败并出现错误:请求的身份验证范围不足
- python - 硒超时异常
- node.js - 是否可以在 express 应用程序中运行节点工作程序
- python - 如何忽略特定索引?Python
- python - 如何解决此正则表达式问题以匹配可选列和空格?
- python - 带有 TypeError 的自动测试暂停:“str”对象不可调用