Skip to content

Commit

Permalink
fix(core): Improve identity lookup speed (#230)
Browse files Browse the repository at this point in the history
Fixes #229
Authored-by: Andres Junge <andres.junge@consensys.net>
  • Loading branch information
ajunge authored Sep 3, 2020
1 parent 654f583 commit b2f6332
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/daf-core/src/identity/identity-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ export class IdentityManager {
}

async getIdentity(did: string): Promise<AbstractIdentity> {
const identities = await this.getIdentities()
const identity = identities.find(item => item.did === did)
let identity: AbstractIdentity
for (const identityProvider of this.identityProviders) {
const providerIdentity = await identityProvider.getIdentity(did)
if (providerIdentity) identity = providerIdentity
}
if (identity) {
return identity
} else {
Expand Down

0 comments on commit b2f6332

Please sign in to comment.