Skip to content

Commit

Permalink
backward compatiblity for registered identities
Browse files Browse the repository at this point in the history
  • Loading branch information
LiranCohen committed Sep 4, 2024
1 parent e1a6918 commit 6a144ef
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/agent/src/sync-engine-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,16 @@ export class SyncEngineLevel implements SyncEngine {

// iterate over all registered identities
for await (const [ did, options ] of this._db.sublevel('registeredIdentities').iterator()) {
const { protocols, delegateDid } = JSON.parse(options) as SyncIdentityOptions;

const { protocols, delegateDid } = await new Promise<SyncIdentityOptions>((resolve) => {
try {
const { protocols, delegateDid } = JSON.parse(options) as SyncIdentityOptions;
resolve({ protocols, delegateDid });
} catch(error: any) {
resolve({ protocols: [] });
}

Check warning on line 546 in packages/agent/src/sync-engine-level.ts

View check run for this annotation

Codecov / codecov/patch

packages/agent/src/sync-engine-level.ts#L545-L546

Added lines #L545 - L546 were not covered by tests
});

// First, confirm the DID can be resolved and extract the DWN service endpoint URLs.
const dwnEndpointUrls = await getDwnServiceEndpointUrls(did, this.agent.did);
if (dwnEndpointUrls.length === 0) {
Expand Down

0 comments on commit 6a144ef

Please sign in to comment.