feat(BRIDGE-324): added a log entry for the vault key hash

This commit is contained in:
Atanas Janeshliev
2025-03-18 12:20:21 +01:00
parent c66f0b800a
commit 899d3293bc

View File

@ -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")
}