github.com/lestrrat-go/jwx/v2@v2.0.21/jwx.go (about)

     1  //go:generate ./tools/cmd/genreadfile.sh
     2  //go:generate ./tools/cmd/genoptions.sh
     3  //go:generate stringer -type=FormatKind
     4  //go:generate mv formatkind_string.go formatkind_string_gen.go
     5  
     6  // Package jwx contains tools that deal with the various JWx (JOSE)
     7  // technologies such as JWT, JWS, JWE, etc in Go.
     8  //
     9  //	JWS (https://tools.ietf.org/html/rfc7515)
    10  //	JWE (https://tools.ietf.org/html/rfc7516)
    11  //	JWK (https://tools.ietf.org/html/rfc7517)
    12  //	JWA (https://tools.ietf.org/html/rfc7518)
    13  //	JWT (https://tools.ietf.org/html/rfc7519)
    14  //
    15  // Examples are stored in a separate Go module (to avoid adding
    16  // dependencies to this module), and thus does not appear in the
    17  // online documentation for this module.
    18  // You can find the examples in Github at https://github.com/lestrrat-go/jwx/tree/v2/examples
    19  //
    20  // You can find more high level documentation at Github (https://github.com/lestrrat-go/jwx/tree/v2)
    21  //
    22  // FAQ style documentation can be found in the repository (https://github.com/lestrrat-go/jwx/tree/develop/v2/docs)
    23  package jwx
    24  
    25  import (
    26  	"github.com/lestrrat-go/jwx/v2/internal/json"
    27  )
    28  
    29  // DecoderSettings gives you a access to configure the "encoding/json".Decoder
    30  // used to decode JSON objects within the jwx framework.
    31  func DecoderSettings(options ...JSONOption) {
    32  	// XXX We're using this format instead of just passing a single boolean
    33  	// in case a new option is to be added some time later
    34  	var useNumber bool
    35  	for _, option := range options {
    36  		//nolint:forcetypeassert
    37  		switch option.Ident() {
    38  		case identUseNumber{}:
    39  			useNumber = option.Value().(bool)
    40  		}
    41  	}
    42  
    43  	json.DecoderSettings(useNumber)
    44  }