aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/configfile/config_file.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index 2d11346..3d59dc5 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -74,6 +74,7 @@ type CreateArgs struct {
DeterministicNames bool
XChaCha20Poly1305 bool
LongNameMax uint8
+ Masterkey []byte
}
// Create - create a new config with a random key encrypted with
@@ -126,8 +127,11 @@ func Create(args *CreateArgs) error {
return err
}
{
- // Generate new random master key
- key := cryptocore.RandBytes(cryptocore.KeyLen)
+ key := args.Masterkey
+ if key == nil {
+ // Generate new random master key
+ key = cryptocore.RandBytes(cryptocore.KeyLen)
+ }
tlog.PrintMasterkeyReminder(key)
// Encrypt it using the password
// This sets ScryptObject and EncryptedKey