diff --git a/src/stores/useClientStore.js b/src/stores/useClientStore.js index ef49e30..369c998 100644 --- a/src/stores/useClientStore.js +++ b/src/stores/useClientStore.js @@ -23,6 +23,7 @@ const makeUseClientStore = ({ useInterfaceStore, onInit, fetchKycLevel }) => def // onInit is a hack, see stores/index.js for details onInit?.() + // TODO: this subscribe is getting hacky. investigate a neater way of doing this useInterfaceStore().$subscribe((_, state) => { // This could be more efficient by inspecting the contents of mutation this.isReady = state.isReady @@ -32,6 +33,11 @@ const makeUseClientStore = ({ useInterfaceStore, onInit, fetchKycLevel }) => def if (state.appInfo?.agent_pub_key) { this.agentKey = state.appInfo.agent_pub_key } + + // we override here the above here because in the holo case, agentState is in general much more up to date than appInfo + if (state.agentState?.pubkey) { + this.agentKey = state.agentState.pubkey + } }) await useInterfaceStore().initialize() diff --git a/src/utils/registration.js b/src/utils/registration.js index b26fecd..6480fbb 100644 --- a/src/utils/registration.js +++ b/src/utils/registration.js @@ -37,12 +37,16 @@ export async function getBase64EncodedMembraneProof ({ // Get the membrane_proof from the server let params + const payload = typeof membrane_proof_server_payload === 'string' + ? JSON.parse(membrane_proof_server_payload) + : membrane_proof_server_payload + try { params = { - registration_code, - agent_pub_key: agent_id, - email: email, - payload: JSON.parse(membrane_proof_server_payload) + registration_code, + agent_pub_key: agent_id, + email: email, + payload, } } catch { throw new Error('Membrane Proof payload parsing error')