cmd/jwt/main.go
func doEnc(signer jwt.Signer, in []byte) ([]byte, error) {
	var err error

	// make sure its valid json first
	m := make(map[string]interface{})

	// do the initial decode
	d := json.NewDecoder(bytes.NewBuffer(in))
	d.UseNumber()
	err = d.Decode(&m)
	if err != nil {
		return nil, err
	}

	// encode claims
	out, err := signer.Encode(&m)
	if err != nil {
		return nil, err
	}

	return out, nil
}
func doEnc(signer jwt.Signer, in []byte) ([]byte, error) {
	var err error

	// make sure its valid json first
	m := make(map[string]interface{})

	// do the initial decode
	d := json.NewDecoder(bytes.NewBuffer(in))
	d.UseNumber()
	err = d.Decode(&m)
	if err != nil {
		return nil, err
	}

	// encode claims
	out, err := signer.Encode(&m)
	if err != nil {
		return nil, err
	}

	return out, nil
}
func doEnc ( signer jwt . Signer , in [ ] byte ) ( [ ] byte , error ) { var err error // make sure its valid json first m := make ( map [ string ] interface { } ) // do the initial decode d := json . NewDecoder ( bytes . NewBuffer ( in ) ) d . UseNumber ( ) err = d . Decode ( & m ) if err != nil { return nil , err } // encode claims out , err := signer . Encode ( & m ) if err != nil { return nil , err } return out , nil }
// doEnc encodes in as the payload in a JWT.
doEnc encodes in as the payload in a JWT .