【问题标题】:Hyperledger fabric client credential store using couchdb(CouchDBKeyValueStore)使用 couchdb(CouchDBKeyValueStore) 的 Hyperledger Fabric 客户端凭证存储
【发布时间】: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


    【解决方案1】:

    它是数据库用户名。

    如果您使用的是 couchdb docker 映像。

    docker run --name my-couch-db -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password123 -p 3000:5984 -d couchdb
    

    那么该连接字符串将是:

    url: 'https://<USERNAME>:<PASSWORD>@<URL>'
    url: 'https://admin:password123@localhost:3000'
    

    参考: https://hub.docker.com/_/couchdb

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-02
      • 2018-05-24
      相关资源
      最近更新 更多