Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
d4112432
Commit
d4112432
authored
Feb 06, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix signing messages
parent
06e5bd7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
injected.js
src/blockchain/providers/injected.js
+2
-2
node.js
src/blockchain/providers/node.js
+1
-1
vm.js
src/blockchain/providers/vm.js
+2
-2
No files found.
src/blockchain/providers/injected.js
View file @
d4112432
...
...
@@ -37,8 +37,8 @@ class InjectedProvider {
signMessage
(
message
,
account
,
_passphrase
,
cb
)
{
const
hashedMsg
=
Web3
.
utils
.
sha3
(
message
)
try
{
this
.
executionContext
.
web3
().
eth
.
sign
(
account
,
hashedMsg
,
(
error
,
signedData
)
=>
{
cb
(
error
.
message
,
hashedMsg
,
signedData
)
this
.
executionContext
.
web3
().
eth
.
sign
(
hashedMsg
,
account
,
(
error
,
signedData
)
=>
{
cb
(
error
,
hashedMsg
,
signedData
)
})
}
catch
(
e
)
{
cb
(
e
.
message
)
...
...
src/blockchain/providers/node.js
View file @
d4112432
...
...
@@ -47,7 +47,7 @@ class NodeProvider {
try
{
const
personal
=
new
Personal
(
this
.
executionContext
.
web3
().
currentProvider
)
personal
.
sign
(
hashedMsg
,
account
,
passphrase
,
(
error
,
signedData
)
=>
{
cb
(
error
.
message
,
hashedMsg
,
signedData
)
cb
(
error
,
hashedMsg
,
signedData
)
})
}
catch
(
e
)
{
cb
(
e
.
message
)
...
...
src/blockchain/providers/vm.js
View file @
d4112432
...
...
@@ -57,7 +57,7 @@ class VMProvider {
do
{
privateKey
=
crypto
.
randomBytes
(
32
)
}
while
(
!
isValidPrivate
(
privateKey
))
this
.
providers
.
vm
.
_addAccount
(
privateKey
,
'0x56BC75E2D63100000'
)
this
.
_addAccount
(
privateKey
,
'0x56BC75E2D63100000'
)
return
cb
(
null
,
'0x'
+
privateToAddress
(
privateKey
).
toString
(
'hex'
))
}
...
...
@@ -78,7 +78,7 @@ class VMProvider {
signMessage
(
message
,
account
,
_passphrase
,
cb
)
{
const
personalMsg
=
ethJSUtil
.
hashPersonalMessage
(
Buffer
.
from
(
message
))
const
privKey
=
this
.
providers
.
vm
.
accounts
[
account
].
privateKey
const
privKey
=
this
.
accounts
[
account
].
privateKey
try
{
const
rsv
=
ethJSUtil
.
ecsign
(
personalMsg
,
privKey
)
const
signedData
=
ethJSUtil
.
toRpcSig
(
rsv
.
v
,
rsv
.
r
,
rsv
.
s
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment