Newer
Older
"github.com/oidc-mytoken/server/internal/utils/hashutils"
func NewConsentCode() *ConsentCode {
return ConsentCodeFromStr(utils.RandReadableAlphaString(consentCodeLen))
// ConsentCode is type for the code used for giving consent to mytoken
code string
state string
}
func (c ConsentCode) String() string {
return c.code
// ConsentCodeFromStr turns a consent code string into a *ConsentCode
func ConsentCodeFromStr(code string) *ConsentCode {
return &ConsentCode{
code: code,
func (c *ConsentCode) GetState() string {
c.state = hashutils.HMACBasedHash([]byte(c.code))[:stateLen]