mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 22:56:48 +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
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
@ -89,6 +91,7 @@ func newVault(reporter *sentry.Reporter, locations *locations.Locations, keychai
|
|||||||
vaultDir = path.Join(vaultDir, "insecure")
|
vaultDir = path.Join(vaultDir, "insecure")
|
||||||
} else {
|
} else {
|
||||||
vaultKey = key
|
vaultKey = key
|
||||||
|
logHashedVaultKey(vaultKey) // Log a hash of the vault key.
|
||||||
}
|
}
|
||||||
|
|
||||||
gluonCacheDir, err := locations.ProvideGluonCachePath()
|
gluonCacheDir, err := locations.ProvideGluonCachePath()
|
||||||
@ -127,3 +130,9 @@ func loadVaultKey(vaultDir string, keychains *keychain.List) ([]byte, error) {
|
|||||||
|
|
||||||
return key, nil
|
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