good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
7b230b7e
Commit
7b230b7e
authored
Feb 18, 2019
by
Guillaume Ballet
Browse files
Options
Downloads
Patches
Plain Diff
accounts/scwallet: rebase and update
parent
a900e80a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
accounts/scwallet/wallet.go
+36
-7
36 additions, 7 deletions
accounts/scwallet/wallet.go
console/bridge.go
+0
-1
0 additions, 1 deletion
console/bridge.go
with
36 additions
and
8 deletions
accounts/scwallet/wallet.go
+
36
−
7
View file @
7b230b7e
...
...
@@ -635,7 +635,7 @@ func (w *Wallet) SelfDerive(base accounts.DerivationPath, chain ethereum.ChainSt
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,
// 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
// 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 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).
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
()
defer
w
.
lock
.
Unlock
()
...
...
@@ -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
)
{
signer
:=
types
.
NewEIP155Signer
(
chainID
)
hash
:=
signer
.
Hash
(
tx
)
sig
,
err
:=
w
.
S
ignHash
(
account
,
hash
[
:
])
sig
,
err
:=
w
.
s
ignHash
(
account
,
hash
[
:
])
if
err
!=
nil
{
return
nil
,
err
}
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.
//
// 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.
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
err
:=
w
.
Open
(
passphrase
);
err
!=
nil
{
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
...
...
This diff is collapsed.
Click to expand it.
console/bridge.go
+
0
−
1
View file @
7b230b7e
...
...
@@ -175,7 +175,6 @@ func (b *bridge) OpenWallet(call otto.FunctionCall) (response otto.Value) {
throwJSException
(
err
.
Error
())
}
return
val
>>>>>>>
accounts
/
scwallet
,
console
:
user
friendly
card
opening
}
func
(
b
*
bridge
)
readPassphraseAndReopenWallet
(
call
otto
.
FunctionCall
)
(
otto
.
Value
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment