tenseleyflow/shithub / 9f24a0e

Browse files

Add auth.totp_key_b64 config + SHITHUB_TOTP_KEY alias for at-rest TOTP encryption key

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
9f24a0e3a08242c4801373b1cf31d5917e003c5a
Parents
7fb6cba
Tree
455fedd

1 changed file

StatusFile+-
M internal/infra/config/config.go 6 0
internal/infra/config/config.gomodified
@@ -108,6 +108,7 @@ type AuthConfig struct {
108108
 	SMTP                     SMTPConfig     `toml:"smtp"`
109109
 	Postmark                 PostmarkConfig `toml:"postmark"`
110110
 	Argon2                   Argon2Config   `toml:"argon2"`
111
+	TOTPKeyB64               string         `toml:"totp_key_b64"` // base64 32-byte AEAD key for at-rest TOTP secrets
111112
 }
112113
 
113114
 // SMTPConfig holds plain-SMTP backend settings (e.g. MailHog in dev).
@@ -233,6 +234,11 @@ func applyAliases(cfg *Config) {
233234
 			cfg.Session.KeyB64 = v
234235
 		}
235236
 	}
237
+	if cfg.Auth.TOTPKeyB64 == "" {
238
+		if v := os.Getenv("SHITHUB_TOTP_KEY"); v != "" {
239
+			cfg.Auth.TOTPKeyB64 = v
240
+		}
241
+	}
236242
 }
237243
 
238244
 // Validate enforces invariants. Errors are precise enough to point at the