fix: replace magic file permissions and add crypto constant comments

Replace hardcoded 0o600 with secret.FilePerms constant for consistency.
Add explanatory comments for cryptographic constants (32-byte keys,
bech32 encoding parameters) rather than extracting them as they are
well-known cryptographic standard values.
This commit is contained in:
2025-06-20 09:23:50 -07:00
parent c450e1c13d
commit dd2e95f8af
2 changed files with 6 additions and 6 deletions

View File

@@ -219,7 +219,7 @@ func (cli *Instance) VaultImport(cmd *cobra.Command, vaultName string) error {
ltPublicKey := ltIdentity.Recipient().String()
secret.Debug("Storing long-term public key", "pubkey", ltPublicKey, "vault_dir", vaultDir)
if err := afero.WriteFile(cli.fs, pubKeyPath, []byte(ltPublicKey), 0o600); err != nil {
if err := afero.WriteFile(cli.fs, pubKeyPath, []byte(ltPublicKey), secret.FilePerms); err != nil {
return fmt.Errorf("failed to store long-term public key: %w", err)
}