...

Source file src/github.com/lestrrat-go/jwx/jwx.go

Documentation: github.com/lestrrat-go/jwx

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

View as plain text