func NewService(opts Opts) *Service {
	res := Service{Opts: opts}
	setDefault := func(fld *string, def string) {
		if *fld == "" {
			*fld = def
		}
	}
	setDefault(&res.JWTCookieName, defaultJWTCookieName)
	setDefault(&res.JWTHeaderKey, defaultJWTHeaderKey)
	setDefault(&res.XSRFCookieName, defaultXSRFCookieName)
	setDefault(&res.XSRFHeaderKey, defaultXSRFHeaderKey)
	setDefault(&res.JWTQuery, defaultTokenQuery)
	setDefault(&res.Issuer, defaultIssuer)
	setDefault(&res.JWTCookieDomain, defaultJWTCookieDomain)
	if opts.TokenDuration == 0 {
		res.TokenDuration = defaultTokenDuration
	}
	if opts.CookieDuration == 0 {
		res.CookieDuration = defaultCookieDuration
	}
	return &res
}
NewService makes JWT service
package token
import (
	"encoding/json"
	"fmt"
	"net/http"
	"strings"
	"time"
	"github.com/golang-jwt/jwt"
	"github.com/pkg/errors"
)
type Service struct {
	Opts
}
type Claims struct {
	jwt.StandardClaims
	User        *User      `json:"user,omitempty"`  
	SessionOnly bool       `json:"sess_only,omitempty"`
	Handshake   *Handshake `json:"handshake,omitempty"`  
	NoAva       bool       `json:"no-ava,omitempty"`     
}
type Handshake struct {
	State string `json:"state,omitempty"`
	From  string `json:"from,omitempty"`
	ID    string `json:"id,omitempty"`
}
const (
	defaultJWTCookieName   = "JWT"
	defaultJWTCookieDomain = ""
	defaultJWTHeaderKey    = "X-JWT"
	defaultXSRFCookieName  = "XSRF-TOKEN"
	defaultXSRFHeaderKey   = "X-XSRF-TOKEN"
	defaultIssuer = "go-pkgz/auth"
	defaultTokenDuration  = time.Minute * 15
	defaultCookieDuration = time.Hour * 24 * 31
	defaultTokenQuery = "token"
)
type Opts struct {
	SecretReader   Secret
	ClaimsUpd      ClaimsUpdater
	SecureCookies  bool
	TokenDuration  time.Duration
	CookieDuration time.Duration
	DisableXSRF    bool
	DisableIAT     bool  
	JWTCookieName   string
	JWTCookieDomain string
	JWTHeaderKey    string
	XSRFCookieName  string
	XSRFHeaderKey   string
	JWTQuery        string
	AudienceReader  Audience       
	Issuer          string         
	AudSecrets      bool           
	SendJWTHeader   bool           
	SameSite        http.SameSite  
}