diff --git a/src/api/app/websocket.ts b/src/api/app/websocket.ts index 8a356603..497de8f7 100644 --- a/src/api/app/websocket.ts +++ b/src/api/app/websocket.ts @@ -231,6 +231,7 @@ export class AppWebsocket implements AppClient { `The app your connection token was issued for was not found. The app needs to be installed and enabled.` ); } + appInfo.agent_pub_key = new AgentPubKey(appInfo.agent_pub_key); return new AppWebsocket( client, @@ -254,6 +255,7 @@ export class AppWebsocket implements AppClient { `App info not found. App needs to be installed and enabled.` ); } + appInfo.agent_pub_key = new AgentPubKey(appInfo.agent_pub_key); this.cachedAppInfo = appInfo; return appInfo; diff --git a/test/e2e/app-websocket.ts b/test/e2e/app-websocket.ts index 2998fd3b..bfeea103 100644 --- a/test/e2e/app-websocket.ts +++ b/test/e2e/app-websocket.ts @@ -12,6 +12,7 @@ import { fakeAgentPubKey, NonProvenanceCallZomeRequest, RoleName, + AgentPubKey, } from "../../src"; import { createAppWsAndInstallApp, @@ -311,3 +312,22 @@ test( ]); }) ); + +test( + "can read myPubKey", + withConductor(ADMIN_PORT, async (t) => { + const { + installed_app_id, + cell_id, + client: appWs, + admin, + } = await createAppWsAndInstallApp(ADMIN_PORT); + + const myPubKey = appWs.myPubKey; + const appInfo = await appWs.appInfo(); + + t.deepEqual(myPubKey, appInfo.agent_pub_key); + t.deepEqual(myPubKey.toString(), appInfo.agent_pub_key.toString()); + t.deepEqual(myPubKey.toBytes(), appInfo.agent_pub_key.toBytes()); + }) +);