How to use the fabric-network.InMemoryWallet function in fabric-network

To help you get started, we’ve selected a few fabric-network examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-test / feature / sdk / node / query.js View on Github external
async function _evaluateTransaction(org, chaincode, network_config){
    const ccp = network_config['common-connection-profile'];
    const orgConfig = ccp.organizations[org];
    const cert = common.readAllFiles(orgConfig.signedCertPEM)[0];
    const key = common.readAllFiles(orgConfig.adminPrivateKeyPEM)[0];
    const inMemoryWallet = new InMemoryWallet();

    const gateway = new Gateway();

    try {
        await inMemoryWallet.import('admin', X509WalletMixin.createIdentity(orgConfig.mspid, cert, key));

        const opts = {
            wallet: inMemoryWallet,
            identity: 'admin',
            discovery: { enabled: false }
        };

        await gateway.connect(ccp, opts);

        const network = await gateway.getNetwork(chaincode.channelId)
        const contract = await network.getContract(chaincode.chaincodeId);
github hyperledger / fabric-test / feature / sdk / node / invoke.js View on Github external
async function _submitTransaction(org, chaincode, network_config){
    const ccp = network_config['common-connection-profile'];
    const orgConfig = ccp.organizations[org];
    const cert = common.readAllFiles(orgConfig.signedCertPEM)[0];
    const key = common.readAllFiles(orgConfig.adminPrivateKeyPEM)[0];
    const inMemoryWallet = new InMemoryWallet();

    const gateway = new Gateway();

    try {
        await inMemoryWallet.import('admin', X509WalletMixin.createIdentity(orgConfig.mspid, cert, key));

        const opts = {
            wallet: inMemoryWallet,
            identity: 'admin',
            discovery: { enabled: false }
        };

        await gateway.connect(ccp, opts);

        const network = await gateway.getNetwork(chaincode.channelId)
        const contract = await network.getContract(chaincode.chaincodeId);
github hyperledger / caliper / packages / caliper-fabric / lib / fabric.js View on Github external
_prepareWallet() {
        if (this.configUseGateway || this.fileWalletPath) {
            if (this.fileWalletPath) {
                logger.info(`Using defined file wallet path ${this.fileWalletPath}`);
                this.wallet = new FabricNetworkAPI.FileSystemWallet(this.fileWalletPath);
            } else {
                logger.info('Creating new InMemoryWallet to persist user identities');
                this.wallet = new FabricNetworkAPI.InMemoryWallet();
            }
        }
    }