mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
feat(BRIDGE-324): added a log entry for the vault key hash
This commit is contained in:
@ -18,6 +18,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"path"
|
||||
|
||||
@ -89,6 +91,7 @@ func newVault(reporter *sentry.Reporter, locations *locations.Locations, keychai
|
||||
vaultDir = path.Join(vaultDir, "insecure")
|
||||
} else {
|
||||
vaultKey = key
|
||||
logHashedVaultKey(vaultKey) // Log a hash of the vault key.
|
||||
}
|
||||
|
||||
gluonCacheDir, err := locations.ProvideGluonCachePath()
|
||||
@ -127,3 +130,9 @@ func loadVaultKey(vaultDir string, keychains *keychain.List) ([]byte, error) {
|
||||
|
||||
return key, nil
|
||||
}
|
||||
|
||||
// logHashedVaultKey - computes a sha256 hash and encodes it to base 64. The resulting string is logged.
|
||||
func logHashedVaultKey(vaultKey []byte) {
|
||||
hashedKey := sha256.Sum256(vaultKey)
|
||||
logrus.WithField("hashedKey", hex.EncodeToString(hashedKey[:])).Info("Found vault key")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user