photoprism/pkg/rnd/client.go
Michael Mayer 305e7bac68 OAuth2: Refactor "client add" and "client mod" CLI commands #808 #3943
Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-01-29 13:54:50 +01:00

20 lines
421 B
Go

package rnd
const (
ClientSecretLength = 32
)
// ClientSecret generates a random client secret containing 32 upper and lower case letters as well as numbers.
func ClientSecret() string {
return Base62(ClientSecretLength)
}
// IsClientSecret checks if the string represents a valid client secret.
func IsClientSecret(s string) bool {
if l := len(s); l == ClientSecretLength {
return IsAlnum(s)
}
return false
}