From 8ced867c4f2a26e00e32d7703fe13aa47d9df923 Mon Sep 17 00:00:00 2001 From: Pablo Mazzini Date: Sat, 9 Mar 2024 15:11:24 +0000 Subject: init_dir: use masterkey arg --- internal/configfile/config_file.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'internal') 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 -- cgit v1.2.3