Skip to content

Commit

Permalink
fix(settings): crypto wallet signature shouldnt include wallet addres…
Browse files Browse the repository at this point in the history
…s, only plebbit author address
  • Loading branch information
estebanabaroa committed Mar 15, 2024
1 parent f55f8ca commit 0c779bf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/views/settings/crypto-wallets/crypto-wallets.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import {useState} from 'react'
import {useAccount, setAccount} from '@plebbit/plebbit-react-hooks'

const getWalletMessageToSign = (authorAddress, timestamp, address) => {
const getWalletMessageToSign = (authorAddress, timestamp) => {
let messageToSign = {}
// the property names must be in this order for the signature to match
// insert props one at a time otherwise babel/webpack will reorder
messageToSign.domainSeparator = 'plebbit-author-wallet'
messageToSign.authorAddress = authorAddress
messageToSign.timestamp = timestamp
messageToSign.address = address
// use plain JSON so the user can read what he's signing
messageToSign = JSON.stringify(messageToSign)
return messageToSign
Expand Down Expand Up @@ -49,7 +48,7 @@ const CryptoWalletsForm = ({account}) => {
return alert('missing address')
}
const timestamp = wallet.timestamp || Math.floor(Date.now() / 1000)
const messageToSign = getWalletMessageToSign(authorAddress, timestamp, wallet.address)
const messageToSign = getWalletMessageToSign(authorAddress, timestamp)

// if timestamp changed, update it so it gets saved properly
if (timestamp !== wallet.timestamp) {
Expand Down

0 comments on commit 0c779bf

Please sign in to comment.