Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

Commit

Permalink
fix signhash
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstep committed Nov 13, 2017
1 parent 5ca03a8 commit 3c75eb4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DApps/dicedapp_v2/dapp.manifest
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name" : "Dice DApp Example",
"name" : "DiceDAppExample2",
"code" : "dicedapp_v2",

"index" : "./index.html",
Expand Down
5 changes: 2 additions & 3 deletions public/server.electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ const DApps = {
config : dapp_config,
path : full_path,
}

this.list[dir] = dapp_data
})
},
Expand Down Expand Up @@ -154,10 +153,10 @@ const DApps = {

fse.copySync(
cp_from,
dapps_path + dapp_config.name
dapps_path + dapp_config.code
)

this.init([dapp_config.name], callback )
this.init([dapp_config.code], callback )
},

remove: function(key, callback){
Expand Down
10 changes: 6 additions & 4 deletions src/model/Eth/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import RPC from './RPC'
const rpc = new RPC( _config.rpc_url )

let _web3acc
let _wallet = false
let _wallet = false
let _privkey = false

export default class Wallet {
constructor() {
Expand Down Expand Up @@ -78,7 +79,7 @@ export default class Wallet {
return new Promise((resolve, reject) => {
this.getPwDerivedKey( PwDerivedKey => {
let private_key = this.getKs().exportPrivateKey(_wallet.addr, PwDerivedKey)

_privkey = private_key
if(callback) callback(private_key)
resolve(private_key)
})
Expand Down Expand Up @@ -255,8 +256,9 @@ export default class Wallet {
return _web3acc.sign(raw)
}

async signHash(hash){
return signHash(hash, (await this.exportPrivateKey()) )
signHash(hash){
if (!_privkey) return false
return signHash(hash, _privkey )
}

}
Expand Down
5 changes: 2 additions & 3 deletions src/server.electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ const DApps = {
config : dapp_config,
path : full_path,
}

this.list[dir] = dapp_data
})
},
Expand Down Expand Up @@ -154,10 +153,10 @@ const DApps = {

fse.copySync(
cp_from,
dapps_path + dapp_config.name
dapps_path + dapp_config.code
)

this.init([dapp_config.name], callback )
this.init([dapp_config.code], callback )
},

remove: function(key, callback){
Expand Down

0 comments on commit 3c75eb4

Please sign in to comment.