使用 CouchDB 的 Hyperledger Fabric 客户端凭证存储 [英] Hyperledger fabric client credential store using CouchDB

查看:20
本文介绍了使用 CouchDB 的 Hyperledger Fabric 客户端凭证存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Hyperledger Fabric SDK for node.js 来注册用户.我正在使用 这个 在结构中部署的代码.它使用 FileKeyValueStore(使用文件来存储键值)来存储客户端的用户凭据.
我想使用 CouchDBKeyValueStore 将用户密钥存储在 CouchDB 数据库实例中.我需要在用于凭据存储的客户端连接配置文件配置文件和代码中进行哪些更改.任何指向示例代码的链接也会有所帮助.

I am using Hyperledger Fabric SDK for node.js to enroll a user. I am using this code to deploy in fabric. It uses FileKeyValueStore (uses files to store the key values) to store client's user credential.
I want to use CouchDBKeyValueStore to store user key in CouchDB database instance. What changes do i need to make in client connection profile configuration file for credential store and in code to do so. Any link to sample code will also help.

推荐答案

连接配置文件中没有内置支持使用 CouchDBKeyValueStore,但您仍然可以使用连接配置文件Fabric 网络配置的其余部分.然后,您需要使用客户端 API 来配置商店.类似的东西

There is no built-in support in the connection profile for using the CouchDBKeyValueStore, but you can still use the connection profile for the rest of the Fabric network configuration. You'll then need to use the Client APIs to configure the stores. Something like

const Client = require('fabric-client');
const CDBKVS = require('fabric-client/lib/impl/CouchDBKeyValueStore.js');

var client = Client.loadFromConfig('test/fixtures/network.yaml');

// Set the state store
let stateStore = await new CDBKVS({url: 'https://<USERNAME>:<PASSWORD>@<URL>', name: '<DB_NAME>'})
client.setStateStore(stateStore);

// Set the crypto store
const crypto = Client.newCryptoSuite();
let cryptoKS = Client.newCryptoKeyStore(
    CDBKVS,
    {
      url: 'https://<USERNAME>:<PASSWORD>@<URL>.cloudant.com',
      name: '<DB_NAME>'
    }
);
crypto.setCryptoKeyStore(cryptoKS);
client.setCryptoSuite(crypto);

<小时>

官方文档参考
将 Hyperledger Fabric 证书和密钥存储在带有 Fabric 节点 SDK 的 IBM Cloudant

这篇关于使用 CouchDB 的 Hyperledger Fabric 客户端凭证存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆