1
0
Fork 0
forked from jriou/coller

feat: Rename password by encryption key

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-09-24 07:09:01 +02:00
commit 8e1dd686d3
Signed by: jriou
GPG key ID: 9A099EDA51316854
16 changed files with 118 additions and 117 deletions

View file

@ -58,13 +58,13 @@ func GenerateChars(n int) string {
return string(b)
}
// Passwords must be URL compatible and strong enough
// Encryption key must be URL compatible and strong enough
// Requiring only alphanumeric chars with a size between 16 and 256
var passwordRegexp = regexp.MustCompile("^[a-zA-Z0-9]{16,256}$")
var encryptionKeyRegexp = regexp.MustCompile("^[a-zA-Z0-9]{16,256}$")
func ValidatePassword(p string) error {
if !passwordRegexp.MatchString(p) {
return fmt.Errorf("password doesn't match '%s'", passwordRegexp)
func ValidateEncryptionKey(p string) error {
if !encryptionKeyRegexp.MatchString(p) {
return fmt.Errorf("encryption key doesn't match '%s'", encryptionKeyRegexp)
}
return nil
}