more logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-09 21:25:05 +11:00
parent dc9ffceb3e
commit d86ce64ea7

View File

@@ -29,11 +29,13 @@ func getHashFilePath() (string, error) {
func storeKeyHash(plaintext string, filePath string) error { func storeKeyHash(plaintext string, filePath string) error {
hash, err := bcrypt.GenerateFromPassword([]byte(plaintext), bcrypt.DefaultCost) hash, err := bcrypt.GenerateFromPassword([]byte(plaintext), bcrypt.DefaultCost)
if err != nil { if err != nil {
log.Printf("storeKeyHash error generating hash : '%s'\n", err)
return err return err
} }
err = os.WriteFile(filePath, hash, 0600) err = os.WriteFile(filePath, hash, 0600)
if err != nil { if err != nil {
log.Printf("storeKeyHash error writing file : '%s'\n", err)
return err return err
} }
@@ -78,6 +80,7 @@ func ReceiveKey(key string) error {
return errors.New("secret key is not correct") return errors.New("secret key is not correct")
} }
} else { } else {
log.Printf("ReceiveKey storing key into file '%s'\n", filePath)
storeKeyHash(key, filePath) storeKeyHash(key, filePath)
} }