GenerateNotExistingToken receives a token generation func and a func to check whether the token exists, returns a unique token.
(generateToken func() string, tokenExists func(token string) bool)
| 26 | |
| 27 | // GenerateNotExistingToken receives a token generation func and a func to check whether the token exists, returns a unique token. |
| 28 | func GenerateNotExistingToken(generateToken func() string, tokenExists func(token string) bool) string { |
| 29 | for { |
| 30 | token := generateToken() |
| 31 | if !tokenExists(token) { |
| 32 | return token |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // GenerateApplicationToken generates an application token. |
| 38 | func GenerateApplicationToken() string { |
no outgoing calls
searching dependent graphs…