upgrade deps; rewrite smtp session

This commit is contained in:
Aine
2024-02-19 22:55:14 +02:00
parent 10213cc7d7
commit a01720da00
277 changed files with 106832 additions and 7641 deletions

View File

@@ -2,6 +2,7 @@ package secgen
import (
"crypto/rand"
"encoding/base64"
"math/big"
"strings"
)
@@ -20,3 +21,10 @@ func Password(length int) string {
return password.String()
}
// Base64Bytes generates secure bytes with the given length and returns it as a base64 string
func Base64Bytes(length int) string {
randomBytes := make([]byte, length)
rand.Read(randomBytes) //nolint:errcheck // nothing could be done anyway
return base64.StdEncoding.EncodeToString(randomBytes)
}