jwt/encoder.go

28 lines
628 B
Go
Raw Normal View History

package jwt
2023-09-13 18:24:50 +03:00
import "io"
2023-09-14 22:25:59 +03:00
type Base64Encoding interface {
EncodeToString(src []byte) string
DecodeString(s string) ([]byte, error)
}
2023-09-14 22:25:59 +03:00
type Stricter[T Base64Encoding] interface {
Strict() T
}
2023-09-14 22:25:59 +03:00
// JSONMarshalFunc is an function type that allows to implement custom JSON
// encoding algorithms.
type JSONMarshalFunc func(v any) ([]byte, error)
2023-09-14 22:25:59 +03:00
// JSONUnmarshalFunc is an function type that allows to implement custom JSON
// unmarshal algorithms.
type JSONUnmarshalFunc func(data []byte, v any) error
2023-09-13 18:24:50 +03:00
type JSONDecoder interface {
UseNumber()
Decode(v any) error
}
type JSONNewDecoderFunc[T JSONDecoder] func(r io.Reader) T