Skip to content

Commit

Permalink
Merge pull request #176 from alephium/check-message-type
Browse files Browse the repository at this point in the history
Check the type of message
  • Loading branch information
polarker authored Jan 11, 2024
2 parents 1d9a409 + fed09d3 commit e5df21e
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 e5df21e

Please sign in to comment.