mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 21:05:10 +00:00
init: pass proper context to master key generation
This is no change in behavior as a canceled context did later on cause the config file creation to fail. Therefore this change just lets the repository initialization fail a bit earlier.
This commit is contained in:
parent
603bb0e309
commit
a449450021
@ -57,8 +57,8 @@ var (
|
||||
|
||||
// createMasterKey creates a new master key in the given backend and encrypts
|
||||
// it with the password.
|
||||
func createMasterKey(s *Repository, password string) (*Key, error) {
|
||||
return AddKey(context.TODO(), s, password, "", "", nil)
|
||||
func createMasterKey(ctx context.Context, s *Repository, password string) (*Key, error) {
|
||||
return AddKey(ctx, s, password, "", "", nil)
|
||||
}
|
||||
|
||||
// OpenKey tries do decrypt the key specified by name with the given password.
|
||||
|
@ -638,7 +638,7 @@ func (r *Repository) Init(ctx context.Context, password string, chunkerPolynomia
|
||||
// init creates a new master key with the supplied password and uses it to save
|
||||
// the config into the repo.
|
||||
func (r *Repository) init(ctx context.Context, password string, cfg restic.Config) error {
|
||||
key, err := createMasterKey(r, password)
|
||||
key, err := createMasterKey(ctx, r, password)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user