mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
mobile: fixed generation of sym key from password
This commit is contained in:
parent
090599568f
commit
d38b08bfcc
3 changed files with 9 additions and 9 deletions
|
|
@ -119,9 +119,9 @@ func (wc *WhisperClient) AddSymmetricKey(ctx *Context, key []byte) (string, erro
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateSymmetricKeyFromPassword generates the key from password, stores it, and returns its identifier.
|
// GenerateSymmetricKeyFromPassword generates the key from password, stores it, and returns its identifier.
|
||||||
func (wc *WhisperClient) GenerateSymmetricKeyFromPassword(ctx *Context, passwd []byte) (string, error) {
|
func (wc *WhisperClient) GenerateSymmetricKeyFromPassword(ctx *Context, passwd string) (string, error) {
|
||||||
rawVersion, err := wc.client.Version(ctx.context)
|
rawSymKeyID, err := wc.client.GenerateSymmetricKeyFromPassword(ctx.context, passwd)
|
||||||
return string(rawVersion), err
|
return string(rawSymKeyID), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasSymmetricKey returns an indication if the key associated with the given id is stored in the node.
|
// HasSymmetricKey returns an indication if the key associated with the given id is stored in the node.
|
||||||
|
|
@ -198,9 +198,9 @@ func (wc *WhisperClient) GetFilterMessages(ctx *Context, id string) (*Messages,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
res := make([]*Message, len(rawFilterMessages))
|
res := make([]*whisper.Message, len(rawFilterMessages))
|
||||||
for i := range rawFilterMessages {
|
for i := range rawFilterMessages {
|
||||||
res[i] = &Message{rawFilterMessages[i]}
|
res[i] = rawFilterMessages[i]
|
||||||
}
|
}
|
||||||
return &Messages{res}, nil
|
return &Messages{res}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -377,9 +377,9 @@ type Message struct {
|
||||||
message *whisper.Message
|
message *whisper.Message
|
||||||
}
|
}
|
||||||
|
|
||||||
// Messagea represents an array of messages.
|
// Messages represents an array of messages.
|
||||||
type Messages struct {
|
type Messages struct {
|
||||||
messages []*Message
|
messages []*whisper.Message
|
||||||
}
|
}
|
||||||
|
|
||||||
// Criteria holds various filter options for inbound messages.
|
// Criteria holds various filter options for inbound messages.
|
||||||
|
|
|
||||||
|
|
@ -136,9 +136,9 @@ func (sc *Client) AddSymmetricKey(ctx context.Context, key []byte) (string, erro
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateSymmetricKeyFromPassword generates the key from password, stores it, and returns its identifier.
|
// GenerateSymmetricKeyFromPassword generates the key from password, stores it, and returns its identifier.
|
||||||
func (sc *Client) GenerateSymmetricKeyFromPassword(ctx context.Context, passwd []byte) (string, error) {
|
func (sc *Client) GenerateSymmetricKeyFromPassword(ctx context.Context, passwd string) (string, error) {
|
||||||
var id string
|
var id string
|
||||||
return id, sc.c.CallContext(ctx, &id, "shh_generateSymKeyFromPassword", hexutil.Bytes(passwd))
|
return id, sc.c.CallContext(ctx, &id, "shh_generateSymKeyFromPassword", passwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasSymmetricKey returns an indication if the key associated with the given id is stored in the node.
|
// HasSymmetricKey returns an indication if the key associated with the given id is stored in the node.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue