From 0906372bfea438c06810dd27f7f98cb36f8e56d1 Mon Sep 17 00:00:00 2001 From: Raptor Date: Thu, 11 Feb 2021 05:54:07 -0800 Subject: [PATCH] Add personal_sign --- package.json | 1 + src/content/WalletProvider.ts | 5 ++- src/popup/pages/API/PersonalSign.vue | 55 ++++++++++++++++++++++------ src/services/APIService.js | 6 +-- 4 files changed, 51 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index f66d98e..86e8b71 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "bignumber.js": "^9.0.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^6.0.0", + "elliptic": "^6.5.4", "ethjs-util": "^0.1.6", "file-loader": "^6.0.0", "file-saver": "^2.0.2", diff --git a/src/content/WalletProvider.ts b/src/content/WalletProvider.ts index 8c29f3a..119dcac 100644 --- a/src/content/WalletProvider.ts +++ b/src/content/WalletProvider.ts @@ -66,13 +66,14 @@ class WalletProvider { } }); } - sign(data: string) { + sign(msgData: string | Uint8Array, prefixMsg = "Ethereum Signed Message") { return new Promise(async (resolve, reject) => { try { const res = await sendAsyncMessageToContentScript({ type: THIRDPARTY_PERSONAL_SIGN_REQUEST, payload: { - data, + msgData, + prefixMsg, }, }); if (res.rejected) { diff --git a/src/popup/pages/API/PersonalSign.vue b/src/popup/pages/API/PersonalSign.vue index 93e60d7..4a404b2 100644 --- a/src/popup/pages/API/PersonalSign.vue +++ b/src/popup/pages/API/PersonalSign.vue @@ -12,7 +12,7 @@
{{ wallet.address }}
Data
- {{ msgData }} + {{ getString(signData) }}
@@ -76,8 +76,10 @@