【发布时间】:2020-02-06 22:33:14
【问题描述】:
我正在使用 Hyperledger Fabric SDK for node.js 来注册用户。我正在使用此代码在结构中进行部署。它使用 FileKeyValueStore(使用文件来存储键值)来存储客户端的用户凭证。
我想使用 CouchDBKeyValueStore 将用户密钥存储在 CouchDB 数据库实例中。所以我在stackoverflow上找到了示例源代码。但我不知道<USERNAME>、<PASSWORD>、<URL> 中应该包含什么值。比如不知道是操作系统的用户名还是我要注册的用户名。
Hyperledger fabric client credential store using CouchDB
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 couchdb-nano hyperledger-fabric-sdk-js