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

@ -132,7 +132,7 @@ func LoadKey(s *Server, name string) (*Key, error) {
}
// AddKey adds a new key to an already existing repository.
func AddKey(s *Server, password string, template *Key) (*Key, error) {
func AddKey(s *Server, password string, template *crypto.Key) (*Key, error) {
// fill meta data about key
newkey := &Key{
Created: time.Now(),
@ -170,7 +170,7 @@ func AddKey(s *Server, password string, template *Key) (*Key, error) {
newkey.master = crypto.NewRandomKey()
} else {
// copy master keys from old key
newkey.master = template.master
newkey.master = template
}
// encrypt master keys (as json) with user key