Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract identities from a version specific wallet and store in the in memory wallet #1055

Closed

Conversation

RosieMurphy0
Copy link
Contributor

Implemented the _extractIdentitiesFromWallet method in the identity manager and the associated tests for the method. Takes identities from a wallet and stores them in the in memory wallet using an existing method.

contributes to #940

@@ -191,7 +191,14 @@ class IdentityManager {
* @private
*/
async _extractIdentitiesFromWallet(mspId, wallet) {
// TODO: To be implemented
const walletFacade = await this.walletFacadeFactory.create(wallet.path);
const allIDNames = await walletFacade.getAllIdentityNames();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you change allIDNames to allIdentityNames as we don't want to use abbreviations

const walletFacade = await this.walletFacadeFactory.create(wallet.path);
const allIDNames = await walletFacade.getAllIdentityNames();
// eslint-disable-next-line no-console
console.log({allIDNames});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you left some debug code in, could you delete the console.log and the comment above it as well.

const allIDNames = await walletFacade.getAllIdentityNames();
// eslint-disable-next-line no-console
console.log({allIDNames});
for (const identityName in allIDNames){
Copy link
Contributor

@davidkel davidkel Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allIDNames to allIdentityNames here too, plus change the in to of which means you will get the individual identityName as it loops round

console.log({allIDNames});
for (const identityName in allIDNames){
const identity = await walletFacade.export(identityName);
await this._addToWallet(identity.mspid, allIDNames[identityName], identity.certificate, identity.privateKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the change to of in the for loop, you can replace the allIDNames[identityName] with just identityName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants