feat: add qr code alternative sign in method

This commit is contained in:
Elias Schneider
2026-07-16 23:06:38 +02:00
parent 525946e94e
commit c079bc4b6c
37 changed files with 1519 additions and 66 deletions
+10
View File
@@ -23,6 +23,12 @@ func GenerateRandomUnambiguousString(length int) (string, error) {
return GenerateRandomString(length, charset)
}
// GenerateRandomUppercaseUnambiguousString generates a random uppercase string of the given length using unambiguous characters
func GenerateRandomUppercaseUnambiguousString(length int) (string, error) {
const charset = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"
return GenerateRandomString(length, charset)
}
// GenerateRandomString generates a random string of the given length using the provided character set
func GenerateRandomString(length int, charset string) (string, error) {
@@ -30,6 +36,10 @@ func GenerateRandomString(length int, charset string) (string, error) {
return "", errors.New("length must be a positive integer")
}
if len(charset) == 0 {
return "", errors.New("character set must not be empty")
}
// The algorithm below is adapted from https://stackoverflow.com/a/35615565
const (
letterIdxBits = 6 // 6 bits to represent a letter index