Files
photoprism/pkg/rnd/client.go
2025-11-21 15:40:26 +01:00

21 lines
492 B
Go

package rnd
const (
// ClientSecretLength defines the length of generated client secrets.
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
}