2
2
mirror of https://github.com/octoleo/restic.git synced 2025-01-22 22:58:26 +00:00

server: Rename CreateMasterKey() to Init()

This commit is contained in:
Alexander Neumann 2015-05-04 20:40:17 +02:00
parent ae1a85c896
commit 35af933f24
4 changed files with 8 additions and 8 deletions

View File

@ -74,7 +74,7 @@ func (cmd CmdInit) Execute(args []string) error {
} }
s := server.NewServer(be) s := server.NewServer(be)
err = s.CreateMasterKey(pw) err = s.Init(pw)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "creating key in backend at %s failed: %v\n", opts.Repo, err) fmt.Fprintf(os.Stderr, "creating key in backend at %s failed: %v\n", opts.Repo, err)
os.Exit(1) os.Exit(1)

View File

@ -532,7 +532,7 @@ func (s *Server) loadIndex(id string) error {
const repositoryIDSize = sha256.Size const repositoryIDSize = sha256.Size
const RepositoryVersion = 1 const RepositoryVersion = 1
func (s *Server) createConfig() (err error) { func createConfig(s *Server) (err error) {
s.Config.ChunkerPolynomial, err = chunker.RandomPolynomial() s.Config.ChunkerPolynomial, err = chunker.RandomPolynomial()
if err != nil { if err != nil {
return err return err
@ -583,9 +583,9 @@ func (s *Server) SearchKey(password string) error {
return s.loadConfig(&s.Config) return s.loadConfig(&s.Config)
} }
// CreateMasterKey creates a new key with the supplied password, afterwards the // Init creates a new master key with the supplied password and initializes the
// repository config is created. // repository config.
func (s *Server) CreateMasterKey(password string) error { func (s *Server) Init(password string) error {
has, err := s.Test(backend.Config, "") has, err := s.Test(backend.Config, "")
if err != nil { if err != nil {
return err return err
@ -601,7 +601,7 @@ func (s *Server) CreateMasterKey(password string) error {
s.key = key.master s.key = key.master
s.keyName = key.Name() s.keyName = key.Name()
return s.createConfig() return createConfig(s)
} }
func (s *Server) Decrypt(ciphertext []byte) ([]byte, error) { func (s *Server) Decrypt(ciphertext []byte) ([]byte, error) {

View File

@ -172,7 +172,7 @@ func TestLoadJSONPack(t *testing.T) {
OK(t, err) OK(t, err)
} }
func TestLoadJSONEncrypted(t *testing.T) { func TestLoadJSONUnpacked(t *testing.T) {
if *benchTestDir == "" { if *benchTestDir == "" {
t.Skip("benchdir not set, skipping TestServerStats") t.Skip("benchdir not set, skipping TestServerStats")
} }

View File

@ -30,7 +30,7 @@ func SetupBackend(t testing.TB) *server.Server {
OK(t, err) OK(t, err)
s := server.NewServer(b) s := server.NewServer(b)
OK(t, s.CreateMasterKey(*TestPassword)) OK(t, s.Init(*TestPassword))
return s return s
} }