Commit d48140ca authored by Gustav Simonsson's avatar Gustav Simonsson

Address pull request comments

* Further simplify "constructor" function's allocation of structs
* Fix formatting
parent 3cf038f3
...@@ -89,10 +89,7 @@ type keyStorePassphrase struct { ...@@ -89,10 +89,7 @@ type keyStorePassphrase struct {
} }
func NewKeyStorePassphrase(path string) KeyStore2 { func NewKeyStorePassphrase(path string) KeyStore2 {
ks := &keyStorePassphrase{ return &keyStorePassphrase{path}
keysDirPath : path,
}
return ks
} }
func (ks keyStorePassphrase) GenerateNewKey(rand io.Reader, auth string) (key *Key, err error) { func (ks keyStorePassphrase) GenerateNewKey(rand io.Reader, auth string) (key *Key, err error) {
...@@ -105,8 +102,8 @@ func (ks keyStorePassphrase) GetKey(keyId *uuid.UUID, auth string) (key *Key, er ...@@ -105,8 +102,8 @@ func (ks keyStorePassphrase) GetKey(keyId *uuid.UUID, auth string) (key *Key, er
return nil, err return nil, err
} }
key = &Key{ key = &Key{
Id : keyId, Id: keyId,
PrivateKey : ToECDSA(keyBytes), PrivateKey: ToECDSA(keyBytes),
} }
return key, err return key, err
} }
......
...@@ -54,9 +54,7 @@ func DefaultDataDir() string { ...@@ -54,9 +54,7 @@ func DefaultDataDir() string {
} }
func NewKeyStorePlain(path string) KeyStore2 { func NewKeyStorePlain(path string) KeyStore2 {
ks := new(keyStorePlain) return &keyStorePlain{path}
ks.keysDirPath = path
return ks
} }
func (ks keyStorePlain) GenerateNewKey(rand io.Reader, auth string) (key *Key, err error) { func (ks keyStorePlain) GenerateNewKey(rand io.Reader, auth string) (key *Key, err error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment