1

With the following command:

const wallet = await this.bizNetworkConnection.cardStore.getWallet('admin@proak-hyperledger-network');

I can get the wallet from the default path: '˜/.composer/client-data/admin@proak-hyperledger-network'

However I cant use the default path, so I'd like create the wallet. There is a method to something like?

let wallet = new Wallet(args)
Cœur
  • 37,241
  • 25
  • 195
  • 267
Marckaraujo
  • 7,422
  • 11
  • 59
  • 97
  • Can you explain why you want to explicitly work with the wallet implementation ? The wallet instance is used by connectors to store their identity information in an appropriate location. The file system cloud wallet by default tells the connector to store it in /.composer/client-data/{cardname} but you can configure the file system cloud wallet to use a different filesystem location. – david_k May 14 '18 at 07:21
  • @david_k, I am building a serverless API for hyperledger https://github.com/mataide/serverless-hyperledger, so on Lambda you dont have write permission on folder, so even if you use getWallet, the constructor method ask for write permission on that folder. – Marckaraujo May 14 '18 at 13:57
  • @david_k, I found a way to work with `composer-wallet-filesystem` but would be better for me to work with `composer-wallet-inmemory`. Do you have any implementation for that? – Marckaraujo May 14 '18 at 14:04
  • https://hyperledger.github.io/composer/latest/business-network/cloud-wallets provides some details near the bottom of the page on how to use the inmemory cloud wallet. – david_k May 14 '18 at 16:17
  • @david_k, Yes, I saw it. But doesnt work because i dont from where it tries to load the wallet info. This only describe how to set `composer-wallet-inmemory` – Marckaraujo May 14 '18 at 17:37
  • The inmemory cloud wallet uses process memory to store the cards and connector specific information. ie at process start it is empty, it gets populated by the running process and read by the running process. It doesn't do any preloading from any source. But I see you mention Lambda so I doubt if inmemory would be suitable in that environment. – david_k May 15 '18 at 22:08

1 Answers1

0

I found a way to specify the wallet path. You need to pass some options to BusinessNetworkConnection.

constructor() {
    let connectionOptions = {}
    connectionOptions = {
        wallet : {
          type: 'composer-wallet-filesystem',
          options : {
            storePath : '/tmp/.composer'
          }
        }
      };
    this.bizNetworkConnection = new BusinessNetworkConnection(connectionOptions);
  }
Marckaraujo
  • 7,422
  • 11
  • 59
  • 97