aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key_store_test.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-01-25 09:07:20 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-01-26 11:30:17 +0800
commit512ffa2bf4308b44aa6f43f25238b375b58d7dbc (patch)
tree40cc0f2aa3eda21eb7039b128d27bdab94d883be /crypto/key_store_test.go
parentd792e95c214c8352e6b23b798101e90844eaa7a3 (diff)
downloaddexon-512ffa2bf4308b44aa6f43f25238b375b58d7dbc.tar
dexon-512ffa2bf4308b44aa6f43f25238b375b58d7dbc.tar.gz
dexon-512ffa2bf4308b44aa6f43f25238b375b58d7dbc.tar.bz2
dexon-512ffa2bf4308b44aa6f43f25238b375b58d7dbc.tar.lz
dexon-512ffa2bf4308b44aa6f43f25238b375b58d7dbc.tar.xz
dexon-512ffa2bf4308b44aa6f43f25238b375b58d7dbc.tar.zst
dexon-512ffa2bf4308b44aa6f43f25238b375b58d7dbc.zip
Add accounts package and refactor key stores
* Add initial UserAccount and AccountManager structs * Add NewAccount, Sign and Accounts functions * Refactor key stores to use key address as main identifier while keeping the UUID. * Use key address as file/dir names instead of UUID
Diffstat (limited to 'crypto/key_store_test.go')
-rw-r--r--crypto/key_store_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/crypto/key_store_test.go b/crypto/key_store_test.go
index 54efc739a..0d229ab65 100644
--- a/crypto/key_store_test.go
+++ b/crypto/key_store_test.go
@@ -15,12 +15,12 @@ func TestKeyStorePlain(t *testing.T) {
}
k2 := new(Key)
- k2, err = ks.GetKey(k1.Id, pass)
+ k2, err = ks.GetKey(k1.Address, pass)
if err != nil {
t.Fatal(err)
}
- if !reflect.DeepEqual(k1.Id, k2.Id) {
+ if !reflect.DeepEqual(k1.Address, k2.Address) {
t.Fatal(err)
}
@@ -28,7 +28,7 @@ func TestKeyStorePlain(t *testing.T) {
t.Fatal(err)
}
- err = ks.DeleteKey(k2.Id, pass)
+ err = ks.DeleteKey(k2.Address, pass)
if err != nil {
t.Fatal(err)
}
@@ -42,11 +42,11 @@ func TestKeyStorePassphrase(t *testing.T) {
t.Fatal(err)
}
k2 := new(Key)
- k2, err = ks.GetKey(k1.Id, pass)
+ k2, err = ks.GetKey(k1.Address, pass)
if err != nil {
t.Fatal(err)
}
- if !reflect.DeepEqual(k1.Id, k2.Id) {
+ if !reflect.DeepEqual(k1.Address, k2.Address) {
t.Fatal(err)
}
@@ -54,7 +54,7 @@ func TestKeyStorePassphrase(t *testing.T) {
t.Fatal(err)
}
- err = ks.DeleteKey(k2.Id, pass) // also to clean up created files
+ err = ks.DeleteKey(k2.Address, pass) // also to clean up created files
if err != nil {
t.Fatal(err)
}
@@ -68,17 +68,17 @@ func TestKeyStorePassphraseDecryptionFail(t *testing.T) {
t.Fatal(err)
}
- _, err = ks.GetKey(k1.Id, "bar") // wrong passphrase
+ _, err = ks.GetKey(k1.Address, "bar") // wrong passphrase
if err == nil {
t.Fatal(err)
}
- err = ks.DeleteKey(k1.Id, "bar") // wrong passphrase
+ err = ks.DeleteKey(k1.Address, "bar") // wrong passphrase
if err == nil {
t.Fatal(err)
}
- err = ks.DeleteKey(k1.Id, pass) // to clean up
+ err = ks.DeleteKey(k1.Address, pass) // to clean up
if err != nil {
t.Fatal(err)
}