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)
err = s.CreateMasterKey(pw)
err = s.Init(pw)
if err != nil {
fmt.Fprintf(os.Stderr, "creating key in backend at %s failed: %v\n", opts.Repo, err)
os.Exit(1)

View File

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

View File

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

View File

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