diff --git a/apis/candidates.js b/apis/candidates.js index 1acab800..8e73f175 100644 --- a/apis/candidates.js +++ b/apis/candidates.js @@ -381,7 +381,7 @@ router.post('/:candidate/generateMessage', async function (req, res, next) { } const message = '[Tomomaster ' + (new Date().toLocaleString().replace(/['"]+/g, '')) + ']' + - ' I am the candidate ' + '[' + candidate + ']' + ' I am the owner of candidate ' + '[' + candidate + ']' const id = uuidv4() // update id, status diff --git a/app/app.js b/app/app.js index 40ecded3..71c43e9d 100644 --- a/app/app.js +++ b/app/app.js @@ -411,6 +411,24 @@ Vue.prototype.sendSignedTransaction = async function (txParams, signature) { return rs } +Vue.prototype.signMessage = async function (message) { + try { + const path = localStorage.get('hdDerivationPath') + const result = await Vue.prototype.appEth.signPersonalMessage( + path, + Buffer.from(message).toString('hex') + ) + let v = result['v'] - 27 + v = v.toString(16) + if (v.length < 2) { + v = '0' + v + } + return '0x' + result['r'] + result['s'] + v + } catch (error) { + console.log(error) + } +} + new Vue({ // eslint-disable-line no-new el: '#app', store, diff --git a/app/components/candidates/Update.vue b/app/components/candidates/Update.vue index 18b0a22f..73118182 100644 --- a/app/components/candidates/Update.vue +++ b/app/components/candidates/Update.vue @@ -109,43 +109,6 @@ class="text-danger">{{ signHashError }} -