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
136f78ff
Unverified
Commit
136f78ff
authored
May 23, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mobile: support importing flat ecdsa keyst too
parent
aa734202
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
accounts.go
mobile/accounts.go
+17
-3
No files found.
mobile/accounts.go
View file @
136f78ff
...
...
@@ -25,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/crypto"
)
const
(
...
...
@@ -176,6 +177,11 @@ func (ks *KeyStore) NewAccount(passphrase string) (*Account, error) {
return
&
Account
{
account
},
nil
}
// UpdateAccount changes the passphrase of an existing account.
func
(
ks
*
KeyStore
)
UpdateAccount
(
account
*
Account
,
passphrase
,
newPassphrase
string
)
error
{
return
ks
.
keystore
.
Update
(
account
.
account
,
passphrase
,
newPassphrase
)
}
// ExportKey exports as a JSON key, encrypted with newPassphrase.
func
(
ks
*
KeyStore
)
ExportKey
(
account
*
Account
,
passphrase
,
newPassphrase
string
)
(
key
[]
byte
,
_
error
)
{
return
ks
.
keystore
.
Export
(
account
.
account
,
passphrase
,
newPassphrase
)
...
...
@@ -190,9 +196,17 @@ func (ks *KeyStore) ImportKey(keyJSON []byte, passphrase, newPassphrase string)
return
&
Account
{
acc
},
nil
}
// UpdateAccount changes the passphrase of an existing account.
func
(
ks
*
KeyStore
)
UpdateAccount
(
account
*
Account
,
passphrase
,
newPassphrase
string
)
error
{
return
ks
.
keystore
.
Update
(
account
.
account
,
passphrase
,
newPassphrase
)
// ImportECDSAKey stores the given encrypted JSON key into the key directory.
func
(
ks
*
KeyStore
)
ImportECDSAKey
(
key
[]
byte
,
passphrase
string
)
(
account
*
Account
,
_
error
)
{
privkey
,
err
:=
crypto
.
ToECDSA
(
key
)
if
err
!=
nil
{
return
nil
,
err
}
acc
,
err
:=
ks
.
keystore
.
ImportECDSA
(
privkey
,
passphrase
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
Account
{
acc
},
nil
}
// ImportPreSaleKey decrypts the given Ethereum presale wallet and stores
...
...
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