server: Only save crypto.Key

At the moment, the server doesn't need the full server.Key (master and
user key), just the master key.
This commit is contained in:
Alexander Neumann
2015-05-03 18:04:13 +02:00
parent 08fac28e73
commit 1213d87b1a
5 changed files with 34 additions and 26 deletions

View File

@@ -121,7 +121,7 @@ func (cmd CmdCat) Execute(args []string) error {
fmt.Println(string(buf))
return nil
case "masterkey":
buf, err := json.MarshalIndent(s.Key().Master(), "", " ")
buf, err := json.MarshalIndent(s.Key(), "", " ")
if err != nil {
return err
}

View File

@@ -42,7 +42,7 @@ func listKeys(s *server.Server) error {
}
var current string
if name == s.Key().Name() {
if name == s.KeyName() {
current = "*"
} else {
current = " "
@@ -75,7 +75,7 @@ func addKey(s *server.Server) error {
}
func deleteKey(s *server.Server, name string) error {
if name == s.Key().Name() {
if name == s.KeyName() {
return errors.New("refusing to remove key currently used to access repository")
}
@@ -103,7 +103,7 @@ func changePassword(s *server.Server) error {
}
// remove old key
err = s.Remove(backend.Key, s.Key().Name())
err = s.Remove(backend.Key, s.KeyName())
if err != nil {
return err
}