Skip to content

Commit

Permalink
Merge branch 'develop' into fix-qa-bug-07-17
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiecarlton committed Jul 18, 2024
2 parents 0de1ee2 + 96bdbd8 commit 0047926
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/stores/useHoloStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const makeUseHoloStore = ({ connectionArgs, MockWebSdk, addClientToWindow }) =>
appInfo: null,
}),
getters: {
// isAnonymous: state => state?.agentState?.isAnonymous === undefined ? true : state.agentState.isAnonymous,
isAnonymous: state => state?.agentState?.isAnonymous,
isAvailable: state => state.agentState && state.agentState.isAvailable,
isLoggedIn: state => state.agentState && state.agentState.isAnonymous === false && state.agentState.isAvailable === true,
Expand Down
2 changes: 1 addition & 1 deletion src/stores/useHolochainStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const makeUseHolochainStore = ({ installed_app_id, app_ws_url, hc_admin_port })
},

// END useInterfaceStore methods
// BEGIN holo specific methods
// BEGIN holochain specific methods

async holochainCallZome(args) {
const { zome_name, fn_name, payload, role_name } = args
Expand Down
27 changes: 15 additions & 12 deletions src/utils/registration.ts → src/utils/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ import * as msgpack from '@msgpack/msgpack'
// In either case, the membrane_proof is assumed to be the original element, msgpack encoded and then encoded as a base64 string
// Envoy expects the msgpack encoded data, so we decode the base64 string before passing it to Envoy

export type GetMembraneProofInput = {
registration_code: string,
membrane_proof_server_url?: string, // the presence or absence of the url changes the behavior of the function
membrane_proof_server_payload: string,
agent_id: string,
email: string
}
// export type GetMembraneProofInput = {
// registration_code: string,
// membrane_proof_server_url?: string, // the presence or absence of the url changes the behavior of the function
// membrane_proof_server_payload: string,
// agent_id: string,
// email: string
// }

export type MembraneProof = Buffer
// export type MembraneProof = Buffer

// Mostly for internal use and testing. You probably want getMembraneProof below
// GetMembraneProofInput -> Promise<string>
export async function getBase64EncodedMembraneProof ({
registration_code,
membrane_proof_server_url,
membrane_proof_server_payload,
agent_id,
email
}: GetMembraneProofInput): Promise<string> {
}) {
if (!registration_code) {
throw new Error('No registration code provided')
}
Expand Down Expand Up @@ -62,7 +63,7 @@ export async function getBase64EncodedMembraneProof ({
})

data = await resp.json()
} catch (e: any) {
} catch (e) {
throw new Error(`Membrane Proof Server network error: ${e?.message}`)
}

Expand All @@ -73,11 +74,13 @@ export async function getBase64EncodedMembraneProof ({
return data.mem_proof
}

export async function getMembraneProof (input: GetMembraneProofInput): Promise<Buffer> {
// GetMembraneProofInput -> Promise<Buffer>
export async function getMembraneProof (input) {
return Buffer.from(await getBase64EncodedMembraneProof(input), 'base64')
}

export function generateUnusedMemproof (): Buffer {
// () -> Buffer
export function generateUnusedMemproof () {
return Buffer.from(msgpack.encode(process.env.UNUSED_MEMPROOF))
}

0 comments on commit 0047926

Please sign in to comment.