dnsSafeShortid (#79)

This commit is contained in:
Michael Quigley 2022-10-18 15:49:30 -04:00
parent 67377ed985
commit 095024c179
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -48,7 +48,21 @@ func createToken() (string, error) {
}
func createServiceName() (string, error) {
return shortid.Generate()
return dnsSafeShortId()
}
func dnsSafeShortId() (string, error) {
sid, err := shortid.Generate()
if err != nil {
return "", err
}
for sid[0] == '-' || sid[0] == '_' {
sid, err = shortid.Generate()
if err != nil {
return "", err
}
}
return sid, nil
}
func hashPassword(raw string) string {