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
Expand all
Hide 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
This diff is collapsed.
Click to expand it.
ui/qt/qwhisper/message.go
View file @
62e0e180
...
...
@@ -17,7 +17,7 @@ func ToQMessage(msg *whisper.Message) *Message {
return
&
Message
{
ref
:
msg
,
Flags
:
int32
(
msg
.
Flags
),
Payload
:
ethutil
.
Bytes2Hex
(
msg
.
Payload
),
From
:
ethutil
.
Bytes2Hex
(
crypto
.
FromECDSAPub
(
msg
.
Recover
())),
Payload
:
"0x"
+
ethutil
.
Bytes2Hex
(
msg
.
Payload
),
From
:
"0x"
+
ethutil
.
Bytes2Hex
(
crypto
.
FromECDSAPub
(
msg
.
Recover
())),
}
}
ui/qt/qwhisper/whisper.go
View file @
62e0e180
...
...
@@ -41,32 +41,41 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
data
=
append
(
data
,
fromHex
(
d
)
...
)
}
msg
:=
whisper
.
NewMessage
(
data
)
envelope
,
err
:=
msg
.
Seal
(
time
.
Duration
(
priority
*
100000
),
whisper
.
Opts
{
Ttl
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
To
:
crypto
.
ToECDSAPub
(
fromHex
(
to
)),
From
:
crypto
.
ToECDSA
(
fromHex
(
from
)),
Topics
:
whisper
.
TopicsFromString
(
topics
...
),
})
if
err
!=
nil
{
qlogger
.
Infoln
(
err
)
// handle error
return
}
pk
:=
crypto
.
ToECDSAPub
(
fromHex
(
from
))
if
key
:=
self
.
Whisper
.
GetIdentity
(
pk
);
key
!=
nil
{
msg
:=
whisper
.
NewMessage
(
data
)
envelope
,
err
:=
msg
.
Seal
(
time
.
Duration
(
priority
*
100000
),
whisper
.
Opts
{
Ttl
:
time
.
Duration
(
ttl
)
*
time
.
Second
,
To
:
crypto
.
ToECDSAPub
(
fromHex
(
to
)),
From
:
key
,
Topics
:
whisper
.
TopicsFromString
(
topics
...
),
})
if
err
!=
nil
{
qlogger
.
Infoln
(
err
)
// handle error
return
}
if
err
:=
self
.
Whisper
.
Send
(
envelope
);
err
!=
nil
{
qlogger
.
Infoln
(
err
)
// handle error
return
if
err
:=
self
.
Whisper
.
Send
(
envelope
);
err
!=
nil
{
qlogger
.
Infoln
(
err
)
// handle error
return
}
}
else
{
qlogger
.
Infoln
(
"unmatched pub / priv for seal"
)
}
}
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
{
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
{
...
...
whisper/whisper.go
View file @
62e0e180
...
...
@@ -60,7 +60,7 @@ type Whisper struct {
quit
chan
struct
{}
keys
[
]
*
ecdsa
.
PrivateKey
keys
map
[
string
]
*
ecdsa
.
PrivateKey
}
func
New
()
*
Whisper
{
...
...
@@ -69,6 +69,7 @@ func New() *Whisper {
filters
:
filter
.
New
(),
expiry
:
make
(
map
[
uint32
]
*
set
.
SetNonTS
),
quit
:
make
(
chan
struct
{}),
keys
:
make
(
map
[
string
]
*
ecdsa
.
PrivateKey
),
}
whisper
.
filters
.
Start
()
...
...
@@ -101,18 +102,18 @@ func (self *Whisper) NewIdentity() *ecdsa.PrivateKey {
if
err
!=
nil
{
panic
(
err
)
}
self
.
keys
=
append
(
self
.
keys
,
key
)
self
.
keys
[
string
(
crypto
.
FromECDSAPub
(
&
key
.
PublicKey
))]
=
key
return
key
}
func
(
self
*
Whisper
)
HasIdentity
(
key
*
ecdsa
.
PrivateKey
)
bool
{
for
_
,
key
:=
range
self
.
keys
{
if
key
.
D
.
Cmp
(
key
.
D
)
==
0
{
return
true
}
}
return
false
func
(
self
*
Whisper
)
HasIdentity
(
key
*
ecdsa
.
PublicKey
)
bool
{
return
self
.
keys
[
string
(
crypto
.
FromECDSAPub
(
key
))]
!=
nil
}
func
(
self
*
Whisper
)
GetIdentity
(
key
*
ecdsa
.
PublicKey
)
*
ecdsa
.
PrivateKey
{
return
self
.
keys
[
string
(
crypto
.
FromECDSAPub
(
key
))]
}
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