diff --git a/cmd/restic/main.go b/cmd/restic/main.go index 806fcd0c1..5bbb8b586 100644 --- a/cmd/restic/main.go +++ b/cmd/restic/main.go @@ -75,7 +75,7 @@ func (cmd CmdInit) Execute(args []string) error { s := server.NewServer(be) - _, err = server.CreateKey(s, pw) + _, err = server.CreateMasterKey(s, pw) if err != nil { fmt.Fprintf(os.Stderr, "creating key in backend at %s failed: %v\n", opts.Repo, err) os.Exit(1) diff --git a/server/key.go b/server/key.go index 68f00c481..677870c87 100644 --- a/server/key.go +++ b/server/key.go @@ -50,9 +50,9 @@ type Key struct { name string } -// CreateKey initializes a master key in the given backend and encrypts it with -// the password. -func CreateKey(s *Server, password string) (*Key, error) { +// CreateMasterKey creates a new master key in the given backend and encrypts +// it with the password. +func CreateMasterKey(s *Server, password string) (*Key, error) { return AddKey(s, password, nil) } diff --git a/server/server.go b/server/server.go index c6e7fef63..198792adf 100644 --- a/server/server.go +++ b/server/server.go @@ -531,8 +531,10 @@ func (s *Server) SearchKey(password string) error { return nil } -func (s *Server) CreateKey(password string) error { - key, err := CreateKey(s, password) +// CreateMasterKey creates a new key with the supplied password, afterwards the +// repository config is created. +func (s *Server) CreateMasterKey(password string) error { + key, err := CreateMasterKey(s, password) if err != nil { return err } diff --git a/test/backend.go b/test/backend.go index 89bcb7b10..c7db75135 100644 --- a/test/backend.go +++ b/test/backend.go @@ -30,7 +30,7 @@ func SetupBackend(t testing.TB) *server.Server { OK(t, err) s := server.NewServer(b) - OK(t, s.CreateKey(*TestPassword)) + OK(t, s.CreateMasterKey(*TestPassword)) return s }