feat: add random string to generated domain (#3634)

This commit is contained in:
Fabi
2022-05-16 11:26:24 +02:00
committed by GitHub
parent 4fcf03c9c8
commit 48fbf1a28e
4 changed files with 25 additions and 11 deletions

View File

@@ -102,7 +102,7 @@ func newGenerator(config GeneratorConfig) generator {
}
func NewCode(g Generator) (*CryptoValue, string, error) {
code, err := generateRandomString(g.Length(), g.Runes())
code, err := GenerateRandomString(g.Length(), g.Runes())
if err != nil {
return nil, "", err
}
@@ -133,7 +133,7 @@ func VerifyCode(creationDate time.Time, expiry time.Duration, cryptoCode *Crypto
return errors.ThrowInvalidArgument(nil, "CODE-fW2gNa", "Errors.User.Code.GeneratorAlgNotSupported")
}
func generateRandomString(length uint, chars []rune) (string, error) {
func GenerateRandomString(length uint, chars []rune) (string, error) {
if length == 0 {
return "", nil
}