about summary refs log tree commit diff
path: root/src/state/models/root-store.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/models/root-store.ts')
-rw-r--r--src/state/models/root-store.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/state/models/root-store.ts b/src/state/models/root-store.ts
index a5d356066..7391a82bd 100644
--- a/src/state/models/root-store.ts
+++ b/src/state/models/root-store.ts
@@ -18,11 +18,18 @@ export class RootStoreModel {
   constructor(public api: AdxClient) {
     makeAutoObservable(this, {
       api: false,
+      resolveName: false,
       serialize: false,
       hydrate: false,
     })
   }
 
+  async resolveName(didOrName: string) {
+    const userDb = this.api.mockDb.getUser(didOrName)
+    if (!userDb) throw new Error(`User not found: ${didOrName}`)
+    return userDb.did
+  }
+
   serialize(): unknown {
     return {
       session: this.session.serialize(),