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
62e0e180
Commit
62e0e180
authored
Jan 14, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed public whisper api not to reveal temporary private keys
parent
bb55307a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
474 additions
and
431 deletions
+474
-431
browser.qml
cmd/mist/assets/qml/browser.qml
+435
-402
message.go
ui/qt/qwhisper/message.go
+2
-2
whisper.go
ui/qt/qwhisper/whisper.go
+27
-18
whisper.go
whisper/whisper.go
+10
-9
No files found.
cmd/mist/assets/qml/browser.qml
View file @
62e0e180
import
QtQuick
2.
0
import
QtQuick
2.
1
import
QtWebKit
3.0
import
QtWebKit
3.0
import
QtWebKit
.
experimental
1.0
import
QtWebKit
.
experimental
1.0
import
QtQuick
.
Controls
1.0
;
import
QtQuick
.
Controls
1.0
;
...
@@ -164,6 +164,35 @@ Rectangle {
...
@@ -164,6 +164,35 @@ Rectangle {
experimental
.
preferences
.
javascriptEnabled
:
true
experimental
.
preferences
.
javascriptEnabled
:
true
experimental
.
preferences
.
webGLEnabled
:
true
experimental
.
itemSelector
:
MouseArea
{
// To avoid conflicting with ListView.model when inside Initiator context.
property
QtObject
selectorModel
:
model
anchors.fill
:
parent
onClicked
:
selectorModel
.
reject
()
Menu
{
visible
:
true
id
:
itemSelector
Instantiator
{
model
:
selectorModel
.
items
delegate
:
MenuItem
{
text
:
model
.
text
onTriggered
:
{
selectorModel
.
accept
(
index
)
}
}
onObjectAdded
:
itemSelector
.
insertItem
(
index
,
object
)
onObjectRemoved
:
itemSelector
.
removeItem
(
object
)
}
}
Component.onCompleted
:
{
itemSelector
.
popup
()
}
}
experimental.preferences.webAudioEnabled
:
true
experimental.preferences.navigatorQtObjectEnabled
:
true
experimental.preferences.navigatorQtObjectEnabled
:
true
experimental.preferences.developerExtrasEnabled
:
true
experimental.preferences.developerExtrasEnabled
:
true
experimental.userScripts
:
[
"../ext/q.js"
,
"../ext/ethereum.js/lib/web3.js"
,
"../ext/ethereum.js/lib/qt.js"
,
"../ext/setup.js"
]
experimental.userScripts
:
[
"../ext/q.js"
,
"../ext/ethereum.js/lib/web3.js"
,
"../ext/ethereum.js/lib/qt.js"
,
"../ext/setup.js"
]
...
@@ -362,6 +391,10 @@ Rectangle {
...
@@ -362,6 +391,10 @@ Rectangle {
postData
(
data
.
_id
,
messages
);
postData
(
data
.
_id
,
messages
);
break
;
break
;
case
"ssh_newGroup"
:
postData
(
data
.
_id
,
""
);
break
;
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
data
.
call
+
": "
+
e
)
console
.
log
(
data
.
call
+
": "
+
e
)
...
...
ui/qt/qwhisper/message.go
View file @
62e0e180
...
@@ -17,7 +17,7 @@ func ToQMessage(msg *whisper.Message) *Message {
...
@@ -17,7 +17,7 @@ func ToQMessage(msg *whisper.Message) *Message {
return
&
Message
{
return
&
Message
{
ref
:
msg
,
ref
:
msg
,
Flags
:
int32
(
msg
.
Flags
),
Flags
:
int32
(
msg
.
Flags
),
Payload
:
ethutil
.
Bytes2Hex
(
msg
.
Payload
),
Payload
:
"0x"
+
ethutil
.
Bytes2Hex
(
msg
.
Payload
),
From
:
ethutil
.
Bytes2Hex
(
crypto
.
FromECDSAPub
(
msg
.
Recover
())),
From
:
"0x"
+
ethutil
.
Bytes2Hex
(
crypto
.
FromECDSAPub
(
msg
.
Recover
())),
}
}
}
}
ui/qt/qwhisper/whisper.go
View file @
62e0e180
...
@@ -41,13 +41,16 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
...
@@ -41,13 +41,16 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
data
=
append
(
data
,
fromHex
(
d
)
...
)
data
=
append
(
data
,
fromHex
(
d
)
...
)
}
}
pk
:=
crypto
.
ToECDSAPub
(
fromHex
(
from
))
if
key
:=
self
.
Whisper
.
GetIdentity
(
pk
);
key
!=
nil
{
msg
:=
whisper
.
NewMessage
(
data
)
msg
:=
whisper
.
NewMessage
(
data
)
envelope
,
err
:=
msg
.
Seal
(
time
.
Duration
(
priority
*
100000
),
whisper
.
Opts
{
envelope
,
err
:=
msg
.
Seal
(
time
.
Duration
(
priority
*
100000
),
whisper
.
Opts
{
Ttl
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
Ttl
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
To
:
crypto
.
ToECDSAPub
(
fromHex
(
to
)),
To
:
crypto
.
ToECDSAPub
(
fromHex
(
to
)),
From
:
crypto
.
ToECDSA
(
fromHex
(
from
))
,
From
:
key
,
Topics
:
whisper
.
TopicsFromString
(
topics
...
),
Topics
:
whisper
.
TopicsFromString
(
topics
...
),
})
})
if
err
!=
nil
{
if
err
!=
nil
{
qlogger
.
Infoln
(
err
)
qlogger
.
Infoln
(
err
)
// handle error
// handle error
...
@@ -59,14 +62,20 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
...
@@ -59,14 +62,20 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
// handle error
// handle error
return
return
}
}
}
else
{
qlogger
.
Infoln
(
"unmatched pub / priv for seal"
)
}
}
}
func
(
self
*
Whisper
)
NewIdentity
()
string
{
func
(
self
*
Whisper
)
NewIdentity
()
string
{
return
toHex
(
self
.
Whisper
.
NewIdentity
()
.
D
.
Bytes
())
key
:=
self
.
Whisper
.
NewIdentity
()
return
toHex
(
crypto
.
FromECDSAPub
(
&
key
.
PublicKey
))
}
}
func
(
self
*
Whisper
)
HasIdentity
(
key
string
)
bool
{
func
(
self
*
Whisper
)
HasIdentity
(
key
string
)
bool
{
return
self
.
Whisper
.
HasIdentity
(
crypto
.
ToECDSA
(
fromHex
(
key
)))
return
self
.
Whisper
.
HasIdentity
(
crypto
.
ToECDSA
Pub
(
fromHex
(
key
)))
}
}
func
(
self
*
Whisper
)
Watch
(
opts
map
[
string
]
interface
{},
view
*
qml
.
Common
)
int
{
func
(
self
*
Whisper
)
Watch
(
opts
map
[
string
]
interface
{},
view
*
qml
.
Common
)
int
{
...
...
whisper/whisper.go
View file @
62e0e180
...
@@ -60,7 +60,7 @@ type Whisper struct {
...
@@ -60,7 +60,7 @@ type Whisper struct {
quit
chan
struct
{}
quit
chan
struct
{}
keys
[
]
*
ecdsa
.
PrivateKey
keys
map
[
string
]
*
ecdsa
.
PrivateKey
}
}
func
New
()
*
Whisper
{
func
New
()
*
Whisper
{
...
@@ -69,6 +69,7 @@ func New() *Whisper {
...
@@ -69,6 +69,7 @@ func New() *Whisper {
filters
:
filter
.
New
(),
filters
:
filter
.
New
(),
expiry
:
make
(
map
[
uint32
]
*
set
.
SetNonTS
),
expiry
:
make
(
map
[
uint32
]
*
set
.
SetNonTS
),
quit
:
make
(
chan
struct
{}),
quit
:
make
(
chan
struct
{}),
keys
:
make
(
map
[
string
]
*
ecdsa
.
PrivateKey
),
}
}
whisper
.
filters
.
Start
()
whisper
.
filters
.
Start
()
...
@@ -101,18 +102,18 @@ func (self *Whisper) NewIdentity() *ecdsa.PrivateKey {
...
@@ -101,18 +102,18 @@ func (self *Whisper) NewIdentity() *ecdsa.PrivateKey {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
self
.
keys
=
append
(
self
.
keys
,
key
)
self
.
keys
[
string
(
crypto
.
FromECDSAPub
(
&
key
.
PublicKey
))]
=
key
return
key
return
key
}
}
func
(
self
*
Whisper
)
HasIdentity
(
key
*
ecdsa
.
PrivateKey
)
bool
{
func
(
self
*
Whisper
)
HasIdentity
(
key
*
ecdsa
.
PublicKey
)
bool
{
for
_
,
key
:=
range
self
.
keys
{
return
self
.
keys
[
string
(
crypto
.
FromECDSAPub
(
key
))]
!=
nil
if
key
.
D
.
Cmp
(
key
.
D
)
==
0
{
}
return
true
}
func
(
self
*
Whisper
)
GetIdentity
(
key
*
ecdsa
.
PublicKey
)
*
ecdsa
.
PrivateKey
{
}
return
self
.
keys
[
string
(
crypto
.
FromECDSAPub
(
key
))]
return
false
}
}
func
(
self
*
Whisper
)
Watch
(
opts
Filter
)
int
{
func
(
self
*
Whisper
)
Watch
(
opts
Filter
)
int
{
...
...
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