jwt.go
func PeekAlgorithm(buf []byte) (Algorithm, error) {
	alg := NONE

	// get alg
	algVal, err := PeekHeaderField(buf, "alg")
	if err != nil {
		return NONE, err
	}

	// decode alg
	err = (&alg).UnmarshalText([]byte(algVal))
	if err != nil {
		return NONE, err
	}

	return alg, nil
}
func PeekAlgorithm(buf []byte) (Algorithm, error) {
	alg := NONE

	// get alg
	algVal, err := PeekHeaderField(buf, "alg")
	if err != nil {
		return NONE, err
	}

	// decode alg
	err = (&alg).UnmarshalText([]byte(algVal))
	if err != nil {
		return NONE, err
	}

	return alg, nil
}
// PeekAlgorithm extracts the signing algorithm listed in the "alg" field of
// the serialized JWT buf's header and attempts to unmarshal it into an
// Algorithm. An error will be returned if the alg field is not specified in
// the JWT header, or is otherwise invalid.