forked from cerc-io/plugeth
Unexport randEntropy type and use exported Reader instead
This commit is contained in:
parent
8c056aebe1
commit
39434e383b
@ -9,7 +9,7 @@ import (
|
|||||||
func TestKeyStorePlain(t *testing.T) {
|
func TestKeyStorePlain(t *testing.T) {
|
||||||
ks := NewKeyStorePlain(DefaultDataDir())
|
ks := NewKeyStorePlain(DefaultDataDir())
|
||||||
pass := "" // not used but required by API
|
pass := "" // not used but required by API
|
||||||
k1, err := ks.GenerateNewKey(new(randentropy.RandEntropy), pass)
|
k1, err := ks.GenerateNewKey(randentropy.Reader, pass)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ func TestKeyStorePlain(t *testing.T) {
|
|||||||
func TestKeyStorePassphrase(t *testing.T) {
|
func TestKeyStorePassphrase(t *testing.T) {
|
||||||
ks := NewKeyStorePassphrase(DefaultDataDir())
|
ks := NewKeyStorePassphrase(DefaultDataDir())
|
||||||
pass := "foo"
|
pass := "foo"
|
||||||
k1, err := ks.GenerateNewKey(new(randentropy.RandEntropy), pass)
|
k1, err := ks.GenerateNewKey(randentropy.Reader, pass)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ func TestKeyStorePassphrase(t *testing.T) {
|
|||||||
func TestKeyStorePassphraseDecryptionFail(t *testing.T) {
|
func TestKeyStorePassphraseDecryptionFail(t *testing.T) {
|
||||||
ks := NewKeyStorePassphrase(DefaultDataDir())
|
ks := NewKeyStorePassphrase(DefaultDataDir())
|
||||||
pass := "foo"
|
pass := "foo"
|
||||||
k1, err := ks.GenerateNewKey(new(randentropy.RandEntropy), pass)
|
k1, err := ks.GenerateNewKey(randentropy.Reader, pass)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,12 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RandEntropy struct {
|
var Reader io.Reader = &randEntropy{}
|
||||||
|
|
||||||
|
type randEntropy struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*RandEntropy) Read(bytes []byte) (n int, err error) {
|
func (*randEntropy) Read(bytes []byte) (n int, err error) {
|
||||||
readBytes := GetEntropyMixed(len(bytes))
|
readBytes := GetEntropyMixed(len(bytes))
|
||||||
copy(bytes, readBytes)
|
copy(bytes, readBytes)
|
||||||
return len(bytes), nil
|
return len(bytes), nil
|
||||||
|
Loading…
Reference in New Issue
Block a user