Skip to content

Commit

Permalink
fix get profile (#1391)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragos-rebegea authored Nov 22, 2024
1 parent 9037a37 commit 3733c7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/common/assets/assets.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ export class AssetsService {

const allAssets: { [key: string]: KeybaseIdentity } = {};
for (const asset of assets) {
const { identity, ...details } = asset;
allAssets[identity] = new KeybaseIdentity(details);
allAssets[asset.identity] = new KeybaseIdentity(asset);
}

return allAssets;
Expand Down
10 changes: 5 additions & 5 deletions src/common/keybase/keybase.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ export class KeybaseService {

async confirmIdentityProfiles(): Promise<void> {
const identities = await this.getDistinctIdentities();
const keybaseIdentities = identities.map(identity => this.getProfile(identity));
const keybaseIdentities = await Promise.all(identities.map(identity => this.getProfile(identity)));
await this.cachingService.set(CacheInfo.IdentityProfilesKeybases.key, keybaseIdentities, CacheInfo.IdentityProfilesKeybases.ttl);
}

getProfile(identity: string): KeybaseIdentity | null {
const keybaseLocal = this.getProfileFromAssets(identity);
async getProfile(identity: string): Promise<KeybaseIdentity | null> {
const keybaseLocal = await this.getProfileFromAssets(identity);
if (keybaseLocal) {
this.logger.log(`Got profile details from assets for identity '${identity}'`);
return keybaseLocal;
Expand All @@ -116,8 +116,8 @@ export class KeybaseService {
return identityInfo;
}

getProfileFromAssets(identity: string): KeybaseIdentity | null {
const info = this.readIdentityInfo(identity);
async getProfileFromAssets(identity: string): Promise<KeybaseIdentity | null> {
const info = await this.readIdentityInfo(identity);
if (!info) {
return null;
}
Expand Down

0 comments on commit 3733c7d

Please sign in to comment.