Hyperledger fabric 如何将钱包凭证放入内存中的composer wallet?

Hyperledger fabric 如何将钱包凭证放入内存中的composer wallet?,hyperledger-fabric,hyperledger,hyperledger-composer,Hyperledger Fabric,Hyperledger,Hyperledger Composer,如何在内存中将钱包凭证放入composer walletv.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 resolve

如何在内存中将钱包凭证放入
composer wallet
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钱包实现交互。您应该使用AdminConnection实例来管理卡存储中的卡

并按此处所述配置您的环境以使用inmemory钱包


我不想使用
composer admin
,是否可以使用
composer客户端导入卡?我知道客户机现在没有这种方法,但这是可能的?我不明白为什么您不想使用composer admin npm模块。此功能不会复制到composer客户端。卡管理是一种操作能力。我正在构建一个无服务器库,不需要使用大多数composer管理功能,也没有足够的内存来添加所有功能。因此,我只需要在composer客户端中处理导入卡功能。您需要自己复制composer admin中执行的逻辑,以便正确导入卡,但这意味着使用内部API,这可能会发生变化。目前还没有任何将admin中的API合并到客户端的计划,但将来可能会发生变化。包括管理会增加很多开销吗?npm应该确保公共模块不被复制,所以即使不是一开始,您也可以尝试在应用程序上运行npm重复数据消除。