Skip to content

Commit

Permalink
Add DID lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
sondreb committed Nov 12, 2024
1 parent 82a0123 commit abac155
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/app/settings/debug/debug.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ <h1>Debug Tool</h1>
<button mat-button (click)="dwnQuery()">Query</button>
<button mat-button (click)="dwnRead()">Read</button>
<button mat-button (click)="lookupRecord()" [disabled]="!targetDid || !recordId">Lookup Record</button>
<button mat-button (click)="resolveDid()" [disabled]="!targetDid">Resolve DID</button>
</mat-card-actions>
</mat-card>

Expand Down
21 changes: 21 additions & 0 deletions app/src/app/settings/debug/debug.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,25 @@ export class DebugComponent {
this.result = '';
}
}

async resolveDid() {
if (!this.targetDid) {
this.status = 'Error: DID are required';
return;
}

try {
const result = await this.identity.web5.did.resolve(this.targetDid);

if (result) {
// this.status = `${result.code}: ${status.detail}`;
this.result = JSON.stringify(result.didDocument, null, 2);
} else {
this.result = 'Not found';
}
} catch (error) {
this.status = `Error: ${error}`;
this.result = '';
}
}
}

0 comments on commit abac155

Please sign in to comment.