Skip to content

Commit

Permalink
Merge pull request #717 from nklincoln/create-wallet
Browse files Browse the repository at this point in the history
update wallet interaction with breaking sdk changes
  • Loading branch information
nklincoln authored Jan 28, 2020
2 parents 1e4f1e3 + 74de029 commit 082f108
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class Fabric extends BlockchainInterface {
username: userName,
mspid: this.networkUtil.getMspIdOfOrganization(org),
cryptoContent: cryptoContent,
skipPersistence: this.fileWalletPath
skipPersistence: this.fileWalletPath ? true : false
});
} catch (err) {
throw new Error(`Couldn't create ${profileName || ''} user object: ${err.message}`);
Expand Down Expand Up @@ -611,18 +611,18 @@ class Fabric extends BlockchainInterface {
if (this.fileWalletPath) {
// If a file wallet is provided, it is expected that *all* required identities are provided
// Admin is a super-user identity, and is consequently optional
const hasAdmin = await this.wallet.exists(adminName);
const hasAdmin = await this.wallet.get(adminName);
if (!hasAdmin) {
logger.info(`No ${adminName} found in wallet - unable to perform admin options`);
continue;
}

logger.info(`Retrieving credentials for ${adminName} from wallet`);
const identity = await this.wallet.export(adminName);
// Identity {type: string, mspId: string, privateKeyPEM: string, signedCertPEM: string}
const identity = await this.wallet.get(adminName);
// Identity {type: string, mspId: string, version: string, credentials: {privateKeyPEM: string, signedCertPEM: string} }
cryptoContent = {
privateKeyPEM: identity.privateKey,
signedCertPEM: identity.certificate
privateKeyPEM: identity.credentials.privateKey,
signedCertPEM: identity.credentials.certificate
};
} else {
cryptoContent = this.networkUtil.getAdminCryptoContentOfOrganization(org);
Expand Down Expand Up @@ -733,11 +733,11 @@ class Fabric extends BlockchainInterface {
let cryptoContent;
if (this.fileWalletPath) {
logger.info(`Retrieving credentials for ${client} from wallet`);
const identity = await this.wallet.export(client);
// Identity {type: string, mspId: string, privateKeyPEM: string, signedCertPEM: string}
const identity = await this.wallet.get(client);
// Identity {type: string, mspId: string, version: string, credentials: {privateKeyPEM: string, signedCertPEM: string} }
cryptoContent = {
privateKeyPEM: identity.privateKey,
signedCertPEM: identity.certificate
privateKeyPEM: identity.credentials.privateKey,
signedCertPEM: identity.credentials.certificate
};
} else {
cryptoContent = this.networkUtil.getClientCryptoContent(client);
Expand Down

0 comments on commit 082f108

Please sign in to comment.