Skip to content

Commit

Permalink
Check the type of message
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Jan 11, 2024
1 parent 1d9a409 commit fed09d3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/extension/src/inpage/alephiumWindowObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ export const alephiumWindowObject: AlephiumWindowObject = new (class extends Ale
#signMessage = async (params: SignMessageParams): Promise<SignMessageResult> => {
this.#checkParams(params)

if (typeof params.message !== 'string') {
throw new Error('Invalid type of message, expected a string')
}

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
sendMessage({ type: "ALPH_SIGN_MESSAGE", data: { ...params, networkId: this.connectedNetworkId, host: window.location.host } })
const { actionHash } = await waitForMessage("ALPH_SIGN_MESSAGE_RES", USER_ACTION_TIMEOUT)
Expand Down

0 comments on commit fed09d3

Please sign in to comment.