2023-03-24 21:13:09 +03:00
|
|
|
package jwt
|
|
|
|
|
|
|
|
// TokenOption is a reserved type, which provides some forward compatibility,
|
|
|
|
// if we ever want to introduce token creation-related options.
|
|
|
|
type TokenOption func(*Token)
|
2023-04-02 18:54:36 +03:00
|
|
|
|
|
|
|
func WithJSONEncoder(f JSONMarshalFunc) TokenOption {
|
|
|
|
return func(token *Token) {
|
2023-09-13 17:53:08 +03:00
|
|
|
token.jsonMarshal = f
|
2023-04-02 18:54:36 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithBase64Encoder(f Base64EncodeFunc) TokenOption {
|
|
|
|
return func(token *Token) {
|
2023-09-13 17:53:08 +03:00
|
|
|
token.base64Encode = f
|
2023-04-02 18:54:36 +03:00
|
|
|
}
|
|
|
|
}
|