goanna/cookie_signer.go
func (c CookieSigner) DecodeValue(encodedvalue string) (string, error) {
	parts := strings.SplitN(encodedvalue, ".", 2)
	if len(parts) != 2 {
		return "", errors.New("Wrong number of parts")
	}
	mac, err := base64.URLEncoding.DecodeString(parts[0])
	value := parts[1]

	if err != nil {
		return "", err
	}
	if !hmac.Equal(c.mac(value), mac) {
		return "", errors.New("Bad signature")
	}

	return value, nil
}
func (c CookieSigner) DecodeValue(encodedvalue string) (string, error) {
	parts := strings.SplitN(encodedvalue, ".", 2)
	if len(parts) != 2 {
		return "", errors.New("Wrong number of parts")
	}
	mac, err := base64.URLEncoding.DecodeString(parts[0])
	value := parts[1]

	if err != nil {
		return "", err
	}
	if !hmac.Equal(c.mac(value), mac) {
		return "", errors.New("Bad signature")
	}

	return value, nil
}
func ( c CookieSigner ) DecodeValue ( encodedvalue string ) ( string , error ) { parts := strings . SplitN ( encodedvalue , " " , 2 ) if len ( parts ) != 2 { return " " , errors . New ( " " ) } mac , err := base64 . URLEncoding . DecodeString ( parts [ 0 ] ) value := parts [ 1 ] if err != nil { return " " , err } if ! hmac . Equal ( c . mac ( value ) , mac ) { return " " , errors . New ( " " ) } return value , nil }
// DecodeValue validates and decodes a cookie value
DecodeValue validates and decodes a cookie value