Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
7b230b7e
Commit
7b230b7e
authored
Feb 18, 2019
by
Guillaume Ballet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accounts/scwallet: rebase and update
parent
a900e80a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
wallet.go
accounts/scwallet/wallet.go
+36
-7
bridge.go
console/bridge.go
+0
-1
No files found.
accounts/scwallet/wallet.go
View file @
7b230b7e
...
@@ -635,7 +635,7 @@ func (w *Wallet) SelfDerive(base accounts.DerivationPath, chain ethereum.ChainSt
...
@@ -635,7 +635,7 @@ func (w *Wallet) SelfDerive(base accounts.DerivationPath, chain ethereum.ChainSt
w
.
deriveChain
=
chain
w
.
deriveChain
=
chain
}
}
// Sign
Hash requests the wallet to sign the given hash
.
// Sign
Data requests the wallet to sign the hash of the given data
.
//
//
// It looks up the account specified either solely via its address contained within,
// It looks up the account specified either solely via its address contained within,
// or optionally with the aid of any location metadata from the embedded URL field.
// or optionally with the aid of any location metadata from the embedded URL field.
...
@@ -644,9 +644,13 @@ func (w *Wallet) SelfDerive(base accounts.DerivationPath, chain ethereum.ChainSt
...
@@ -644,9 +644,13 @@ func (w *Wallet) SelfDerive(base accounts.DerivationPath, chain ethereum.ChainSt
// a password to decrypt the account, or a PIN code o verify the transaction),
// a password to decrypt the account, or a PIN code o verify the transaction),
// an AuthNeededError instance will be returned, containing infos for the user
// an AuthNeededError instance will be returned, containing infos for the user
// about which fields or actions are needed. The user may retry by providing
// about which fields or actions are needed. The user may retry by providing
// the needed details via Sign
Hash
WithPassphrase, or by other means (e.g. unlock
// the needed details via Sign
Data
WithPassphrase, or by other means (e.g. unlock
// the account in a keystore).
// the account in a keystore).
func
(
w
*
Wallet
)
SignHash
(
account
accounts
.
Account
,
hash
[]
byte
)
([]
byte
,
error
)
{
func
(
w
*
Wallet
)
SignData
(
account
accounts
.
Account
,
mimeType
string
,
data
[]
byte
)
([]
byte
,
error
)
{
return
w
.
signHash
(
account
,
crypto
.
Keccak256
(
data
))
}
func
(
w
*
Wallet
)
signHash
(
account
accounts
.
Account
,
hash
[]
byte
)
([]
byte
,
error
)
{
w
.
lock
.
Lock
()
w
.
lock
.
Lock
()
defer
w
.
lock
.
Unlock
()
defer
w
.
lock
.
Unlock
()
...
@@ -672,26 +676,51 @@ func (w *Wallet) SignHash(account accounts.Account, hash []byte) ([]byte, error)
...
@@ -672,26 +676,51 @@ func (w *Wallet) SignHash(account accounts.Account, hash []byte) ([]byte, error)
func
(
w
*
Wallet
)
SignTx
(
account
accounts
.
Account
,
tx
*
types
.
Transaction
,
chainID
*
big
.
Int
)
(
*
types
.
Transaction
,
error
)
{
func
(
w
*
Wallet
)
SignTx
(
account
accounts
.
Account
,
tx
*
types
.
Transaction
,
chainID
*
big
.
Int
)
(
*
types
.
Transaction
,
error
)
{
signer
:=
types
.
NewEIP155Signer
(
chainID
)
signer
:=
types
.
NewEIP155Signer
(
chainID
)
hash
:=
signer
.
Hash
(
tx
)
hash
:=
signer
.
Hash
(
tx
)
sig
,
err
:=
w
.
S
ignHash
(
account
,
hash
[
:
])
sig
,
err
:=
w
.
s
ignHash
(
account
,
hash
[
:
])
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
tx
.
WithSignature
(
signer
,
sig
)
return
tx
.
WithSignature
(
signer
,
sig
)
}
}
// Sign
Hash
WithPassphrase requests the wallet to sign the given hash with the
// Sign
Data
WithPassphrase requests the wallet to sign the given hash with the
// given passphrase as extra authentication information.
// given passphrase as extra authentication information.
//
//
// It looks up the account specified either solely via its address contained within,
// It looks up the account specified either solely via its address contained within,
// or optionally with the aid of any location metadata from the embedded URL field.
// or optionally with the aid of any location metadata from the embedded URL field.
func
(
w
*
Wallet
)
SignHashWithPassphrase
(
account
accounts
.
Account
,
passphrase
string
,
hash
[]
byte
)
([]
byte
,
error
)
{
func
(
w
*
Wallet
)
SignDataWithPassphrase
(
account
accounts
.
Account
,
passphrase
,
mimeType
string
,
data
[]
byte
)
([]
byte
,
error
)
{
return
w
.
signHashWithPassphrase
(
account
,
passphrase
,
crypto
.
Keccak256
(
data
))
}
func
(
w
*
Wallet
)
signHashWithPassphrase
(
account
accounts
.
Account
,
passphrase
string
,
hash
[]
byte
)
([]
byte
,
error
)
{
if
!
w
.
session
.
verified
{
if
!
w
.
session
.
verified
{
if
err
:=
w
.
Open
(
passphrase
);
err
!=
nil
{
if
err
:=
w
.
Open
(
passphrase
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
}
}
return
w
.
SignHash
(
account
,
hash
)
return
w
.
signHash
(
account
,
hash
)
}
// SignText requests the wallet to sign the hash of a given piece of data, prefixed
// by the Ethereum prefix scheme
// It looks up the account specified either solely via its address contained within,
// or optionally with the aid of any location metadata from the embedded URL field.
//
// If the wallet requires additional authentication to sign the request (e.g.
// a password to decrypt the account, or a PIN code o verify the transaction),
// an AuthNeededError instance will be returned, containing infos for the user
// about which fields or actions are needed. The user may retry by providing
// the needed details via SignHashWithPassphrase, or by other means (e.g. unlock
// the account in a keystore).
func
(
w
*
Wallet
)
SignText
(
account
accounts
.
Account
,
text
[]
byte
)
([]
byte
,
error
)
{
return
w
.
signHash
(
account
,
accounts
.
TextHash
(
text
))
}
// SignTextWithPassphrase implements accounts.Wallet, attempting to sign the
// given hash with the given account using passphrase as extra authentication
func
(
w
*
Wallet
)
SignTextWithPassphrase
(
account
accounts
.
Account
,
passphrase
string
,
text
[]
byte
)
([]
byte
,
error
)
{
return
w
.
signHashWithPassphrase
(
account
,
passphrase
,
crypto
.
Keccak256
(
accounts
.
TextHash
(
text
)))
}
}
// SignTxWithPassphrase requests the wallet to sign the given transaction, with the
// SignTxWithPassphrase requests the wallet to sign the given transaction, with the
...
...
console/bridge.go
View file @
7b230b7e
...
@@ -175,7 +175,6 @@ func (b *bridge) OpenWallet(call otto.FunctionCall) (response otto.Value) {
...
@@ -175,7 +175,6 @@ func (b *bridge) OpenWallet(call otto.FunctionCall) (response otto.Value) {
throwJSException
(
err
.
Error
())
throwJSException
(
err
.
Error
())
}
}
return
val
return
val
>>>>>>>
accounts
/
scwallet
,
console
:
user
friendly
card
opening
}
}
func
(
b
*
bridge
)
readPassphraseAndReopenWallet
(
call
otto
.
FunctionCall
)
(
otto
.
Value
,
error
)
{
func
(
b
*
bridge
)
readPassphraseAndReopenWallet
(
call
otto
.
FunctionCall
)
(
otto
.
Value
,
error
)
{
...
...
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