### VerifyOption Examples Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Examples of using `VerifyOption` to configure the verification process. ```APIDOC ## VerifyOption.WithContext ### Description Sets the `context.Context` for the verification operation. ### Parameter Type `VerifyOption` ### Usage `WithContext(v context.Context) VerifyOption` ### Parameters - `v` (context.Context): The context to use. ``` ```APIDOC ## VerifyOption.WithKeyProvider ### Description Specifies a `KeyProvider` to be used for fetching keys during verification. ### Parameter Type `VerifyOption` ### Usage `WithKeyProvider(v KeyProvider) VerifyOption` ### Parameters - `v` (KeyProvider): The key provider implementation. ``` ```APIDOC ## VerifyOption.WithKeySet ### Description Provides a `jwk.Set` containing keys to be used for verification. ### Parameter Type `VerifyOption` ### Usage `WithKeySet(set jwk.Set, options ...WithKeySetSuboption) VerifyOption` ### Parameters - `set` (jwk.Set): The set of JWK keys. - `options` (...WithKeySetSuboption): Additional options for key set processing. ``` ```APIDOC ## VerifyOption.WithKeyUsed ### Description Specifies a particular key that was used for signing, to optimize verification. ### Parameter Type `VerifyOption` ### Usage `WithKeyUsed(v interface{}) VerifyOption` ### Parameters - `v` (interface{}): The key used for signing. ``` ```APIDOC ## VerifyOption.WithMessage ### Description Provides the `Message` object itself, which might be needed for certain verification strategies. ### Parameter Type `VerifyOption` ### Usage `WithMessage(v *Message) VerifyOption` ### Parameters - `v` (*Message): The message object. ``` ```APIDOC ## VerifyOption.WithVerifyAuto ### Description Enables automatic key fetching and verification using a provided `jwk.Fetcher`. ### Parameter Type `VerifyOption` ### Usage `WithVerifyAuto(f jwk.Fetcher, options ...jwk.FetchOption) VerifyOption` ### Parameters - `f` (jwk.Fetcher): The fetcher to use for retrieving keys. - `options` (...jwk.FetchOption): Options for the key fetching process. ``` -------------------------------- ### SignOption Examples Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Examples of using `SignOption` to configure the signing process. ```APIDOC ## SignOption.WithHeaders ### Description An option for `Sign` that allows specifying custom headers to be included in the JWS. ### Parameter Type `SignOption` ### Usage `WithHeaders(h Headers) SignOption` ### Parameters - `h` (Headers): The headers to include. ``` ```APIDOC ## SignOption.WithInsecureNoSignature ### Description An option for `Sign` that disables signature generation. Use with caution as it compromises security. ### Parameter Type `SignOption` ### Usage `WithInsecureNoSignature(options ...WithKeySuboption) SignOption` ### Parameters - `options` (...WithKeySuboption): Additional key-related suboptions. ``` -------------------------------- ### WithKeySetSuboption Examples Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Suboptions for configuring how `jwk.Set` is processed. ```APIDOC ## WithKeySetSuboption.WithInferAlgorithmFromKey ### Description Enables inferring the algorithm from the key itself when processing a `jwk.Set`. ### Parameter Type `WithKeySetSuboption` ### Usage `WithInferAlgorithmFromKey(v bool) WithKeySetSuboption` ### Parameters - `v` (bool): Whether to infer the algorithm. ``` ```APIDOC ## WithKeySetSuboption.WithMultipleKeysPerKeyID ### Description Allows multiple keys to be associated with the same key ID within a `jwk.Set`. ### Parameter Type `WithKeySetSuboption` ### Usage `WithMultipleKeysPerKeyID(v bool) WithKeySetSuboption` ### Parameters - `v` (bool): Whether to allow multiple keys per key ID. ``` ```APIDOC ## WithKeySetSuboption.WithRequireKid ### Description Enforces that all keys in the `jwk.Set` must have a `kid` (Key ID) parameter. ### Parameter Type `WithKeySetSuboption` ### Usage `WithRequireKid(v bool) WithKeySetSuboption` ### Parameters - `v` (bool): Whether to require the `kid` parameter. ``` ```APIDOC ## WithKeySetSuboption.WithUseDefault ### Description Specifies whether to use the default key set if no specific set is provided. ### Parameter Type `WithKeySetSuboption` ### Usage `WithUseDefault(v bool) WithKeySetSuboption` ### Parameters - `v` (bool): Whether to use the default key set. ``` -------------------------------- ### WithKeySuboption Examples Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Suboptions that can be used with `WithKey` and other key-related options. ```APIDOC ## WithKeySuboption.WithProtectedHeaders ### Description An option used with `WithKey` to specify protected headers that should be associated with the key. ### Parameter Type `WithKeySuboption` ### Usage `WithProtectedHeaders(v Headers) WithKeySuboption` ### Parameters - `v` (Headers): The protected headers. ``` -------------------------------- ### WithJSONSuboption Examples Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Suboptions for configuring JSON serialization/deserialization. ```APIDOC ## WithJSONSuboption.WithPretty ### Description Enables pretty-printing for JSON output. ### Parameter Type `WithJSONSuboption` ### Usage `WithPretty(v bool) WithJSONSuboption` ### Parameters - `v` (bool): Whether to pretty-print the JSON. ``` -------------------------------- ### SignVerifyOption Examples Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Options applicable to both signing and verification processes. ```APIDOC ## SignVerifyOption.WithDetachedPayload ### Description Specifies the detached payload for signing or verification. This is used when the payload is not included in the JWS itself. ### Parameter Type `SignVerifyOption` ### Usage `WithDetachedPayload(v []byte) SignVerifyOption` ### Parameters - `v` ([]byte): The detached payload. ``` ```APIDOC ## SignVerifyOption.WithKey ### Description Provides the cryptographic key and algorithm to be used for signing or verification. ### Parameter Type `SignVerifyOption` ### Usage `WithKey(alg jwa.KeyAlgorithm, key interface{}, options ...WithKeySuboption) SignVerifyOption` ### Parameters - `alg` (jwa.KeyAlgorithm): The key algorithm. - `key` (interface{}): The key material. - `options` (...WithKeySuboption): Additional options related to the key. ``` ```APIDOC ## SignVerifyOption.WithValidateKey ### Description Enables or disables validation of the provided key during the operation. ### Parameter Type `SignVerifyOption` ### Usage `WithValidateKey(v bool) SignVerifyOption` ### Parameters - `v` (bool): Whether to validate the key. ``` -------------------------------- ### SignVerifyParseOption Examples Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Options that combine signing, verification, and parsing behaviors. ```APIDOC ## SignVerifyParseOption.WithCompact ### Description Specifies that the operation should use the JWS compact serialization format. ### Parameter Type `SignVerifyParseOption` ### Usage `WithCompact() SignVerifyParseOption` ``` ```APIDOC ## SignVerifyParseOption.WithJSON ### Description Specifies that the operation should use the JWS JSON serialization format. ### Parameter Type `SignVerifyParseOption` ### Usage `WithJSON(options ...WithJSONSuboption) SignVerifyParseOption` ### Parameters - `options` (...WithJSONSuboption): Options specific to JSON serialization. ``` -------------------------------- ### jwx README Example: JWK, JWT, JWE, JWS Operations Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2 This example demonstrates core functionalities of the jwx library, including parsing and manipulating JWKs, building, signing, and verifying JWTs, encrypting and decrypting arbitrary payloads with JWE, and signing/verifying payloads with JWS. It showcases usage with both JWK and raw keys, and includes JWT parsing from HTTP requests. ```go package examples_test import ( "bytes" "fmt" "net/http" "time" "github.com/lestrrat-go/jwx/v2/jwa" "github.com/lestrrat-go/jwx/v2/jwe" "github.com/lestrrat-go/jwx/v2/jwk" "github.com/lestrrat-go/jwx/v2/jws" "github.com/lestrrat-go/jwx/v2/jwt" ) func Example_jwx_readme() { // Parse, serialize, slice and dice JWKs! privkey, err := jwk.ParseKey(jsonRSAPrivateKey) if err != nil { fmt.Printf("failed to parse JWK: %s\n", err) return } pubkey, err := jwk.PublicKeyOf(privkey) if err != nil { fmt.Printf("failed to get public key: %s\n", err) return } // Work with JWTs! { // Build a JWT! tok, err := jwt.NewBuilder(). Issuer(`github.com/lestrrat-go/jwx`). IssuedAt(time.Now()). Build() if err != nil { fmt.Printf("failed to build token: %s\n", err) return } // Sign a JWT! signed, err := jwt.Sign(tok, jwt.WithKey(jwa.RS256, privkey)) if err != nil { fmt.Printf("failed to sign token: %s\n", err) return } // Verify a JWT! { verifiedToken, err := jwt.Parse(signed, jwt.WithKey(jwa.RS256, pubkey)) if err != nil { fmt.Printf("failed to verify JWS: %s\n", err) return } _ = verifiedToken } // Work with *http.Request! { req, err := http.NewRequest(http.MethodGet, `https://github.com/lestrrat-go/jwx`, nil) req.Header.Set(`Authorization`, fmt.Sprintf(`Bearer %s`, signed)) verifiedToken, err := jwt.ParseRequest(req, jwt.WithKey(jwa.RS256, pubkey)) if err != nil { fmt.Printf("failed to verify token from HTTP request: %s\n", err) return } _ = verifiedToken } } // Encrypt and Decrypt arbitrary payload with JWE! { encrypted, err := jwe.Encrypt(payloadLoremIpsum, jwe.WithKey(jwa.RSA_OAEP, jwkRSAPublicKey)) if err != nil { fmt.Printf("failed to encrypt payload: %s\n", err) return } decrypted, err := jwe.Decrypt(encrypted, jwe.WithKey(jwa.RSA_OAEP, jwkRSAPrivateKey)) if err != nil { fmt.Printf("failed to decrypt payload: %s\n", err) return } if !bytes.Equal(decrypted, payloadLoremIpsum) { fmt.Printf("verified payload did not match\n") return } } // Sign and Verify arbitrary payload with JWS! { signed, err := jws.Sign(payloadLoremIpsum, jws.WithKey(jwa.RS256, jwkRSAPrivateKey)) if err != nil { fmt.Printf("failed to sign payload: %s\n", err) return } verified, err := jws.Verify(signed, jws.WithKey(jwa.RS256, jwkRSAPublicKey)) if err != nil { fmt.Printf("failed to verify payload: %s\n", err) return } if !bytes.Equal(verified, payloadLoremIpsum) { fmt.Printf("verified payload did not match\n") return } } // OUTPUT: } ``` -------------------------------- ### KeyProvider Pseudocode Example Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Illustrates the pseudocode for filtering KeyProviders from options during JWE decryption. ```pseudocode keyProviders := filterKeyProviders(options) ``` -------------------------------- ### Get Available Compression Algorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Returns a slice containing all available CompressionAlgorithm values supported by the library. ```go func CompressionAlgorithms() []CompressionAlgorithm ``` -------------------------------- ### Get Possible Signature Algorithms for a Key Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Use AlgorithmsForKey to determine the signature algorithms suitable for verifying a given key. This is useful when dynamic algorithm selection is needed. ```go func AlgorithmsForKey(key interface{}) ([]jwa.SignatureAlgorithm, error) ``` -------------------------------- ### Token Option String Representation Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Provides a String method for TokenOption to get its string representation. ```go func (i TokenOption) String() string ``` -------------------------------- ### Get Available Key Encryption Algorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Retrieves a list of all supported KeyEncryptionAlgorithm values. This is useful for validation or enumeration purposes. ```go func KeyEncryptionAlgorithms() []KeyEncryptionAlgorithm ``` -------------------------------- ### Get All Signature Algorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Retrieves a list of all available SignatureAlgorithm values. This function is useful for iterating through or validating supported algorithms. ```go func SignatureAlgorithms() []SignatureAlgorithm ``` -------------------------------- ### Get Available Elliptic Curve Algorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/ecutil Returns a slice of all available JWA elliptic curve algorithms. ```go func AvailableAlgorithms() []jwa.EllipticCurveAlgorithm ``` -------------------------------- ### StringList Get Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/internal/types The Get method for StringList, used to retrieve the underlying slice of strings. ```go func (l StringList) Get() []string ``` -------------------------------- ### Get Available Key Types Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Retrieves a list of all supported KeyType values. This function is useful for enumerating or validating key types. ```go func KeyTypes() []KeyType ``` -------------------------------- ### Get String Representation of Signature Algorithm Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Returns the string representation of a SignatureAlgorithm. This is useful for logging or displaying the algorithm name. ```go func (v SignatureAlgorithm) String() string ``` -------------------------------- ### NumericDate Get Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/internal/types The Get method for NumericDate, used to retrieve the underlying time.Time value. ```go func (n *NumericDate) Get() time.Time ``` -------------------------------- ### Builder.Website Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Sets the 'website' claim on the builder. This claim represents the End-User's website. ```go func (b *Builder) Website(v string) *Builder ``` -------------------------------- ### ExecutablePath Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/jose Gets the path to the JOSE executable. ```APIDOC ## ExecutablePath ### Description Gets the path to the JOSE executable. ### Signature ```go func ExecutablePath() string ``` ``` -------------------------------- ### Create New AlgorithmSet Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/jose Initializes and returns a new, empty AlgorithmSet. Use this to build a custom set of algorithms. ```go func NewAlgorithmSet() *AlgorithmSet ``` -------------------------------- ### KeyProviderFunc FetchKeys Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Implements the FetchKeys method for KeyProviderFunc, enabling function-based key provision. ```go func (kp KeyProviderFunc) FetchKeys(ctx context.Context, sink KeySink, r Recipient, msg *Message) error ``` -------------------------------- ### Parse and Use a JWK Key from URL Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Shows how to fetch a JWK set from a URL, parse it, and iterate through the keys. It demonstrates serializing the key set and individual keys to JSON, and converting keys between raw and `jwk.Key` types. ```go package examples_test import ( "context" "fmt" "log" "github.com/lestrrat-go/jwx/v2/internal/json" "github.com/lestrrat-go/jwx/v2/jwk" ) func Example_jwk_usage() { set, err := jwk.Fetch(context.Background(), "https://www.googleapis.com/oauth2/v3/certs") if err != nil { log.Printf("failed to parse JWK: %s", err) return } { jsonbuf, err := json.Marshal(set) if err != nil { log.Printf("failed to marshal key set into JSON: %s", err) return } log.Printf("%s", jsonbuf) } for it := set.Keys(context.Background()); it.Next(context.Background()); { pair := it.Pair() key := pair.Value.(jwk.Key) var rawkey interface{} if err := key.Raw(&rawkey); err != nil { log.Printf("failed to create public key: %s", err) return } _ = rawkey fromRawKey, err := jwk.FromRaw(rawkey) if err != nil { log.Printf("failed to acquire raw key from jwk.Key: %s", err) return } jsonbuf, err := json.Marshal(key) if err != nil { log.Printf("failed to marshal key into JSON: %s", err) return } fromJSONKey, err := jwk.Parse(jsonbuf) if err != nil { log.Printf("failed to parse json: %s", err) return } _ = fromJSONKey _ = fromRawKey } } ``` -------------------------------- ### Create and Sign JWT Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Demonstrates creating a new JWT, setting standard and custom claims, marshaling to JSON, and signing it using both raw RSA private keys and JWK keys. ```go const aLongLongTimeAgo = 233431200 t := jwt.New() t.Set(jwt.SubjectKey, `https://github.com/lestrrat-go/jwx/v2/jwt`) t.Set(jwt.AudienceKey, `Golang Users`) t.Set(jwt.IssuedAtKey, time.Unix(aLongLongTimeAgo, 0)) t.Set(`privateClaimKey`, `Hello, World!`) buf, err := json.MarshalIndent(t, "", " ") if err != nil { fmt.Printf("failed to generate JSON: %s\n", err) return } fmt.Printf("%s\n", buf) fmt.Printf("aud -> '%s'\n", t.Audience()) fmt.Printf("iat -> '%s'\n", t.IssuedAt().Format(time.RFC3339)) if v, ok := t.Get(`privateClaimKey`); ok { fmt.Printf("privateClaimKey -> '%s'\n", v) } fmt.Printf("sub -> '%s'\n", t.Subject()) key, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { log.Printf("failed to generate private key: %s", err) return } { // Signing a token (using raw rsa.PrivateKey) signed, err := jwt.Sign(t, jwt.WithKey(jwa.RS256, key)) if err != nil { log.Printf("failed to sign token: %s", err) return } _ = signed } { // Signing a token (using JWK) jwkKey, err := jwk.New(key) if err != nil { log.Printf("failed to create JWK key: %s", err) return } signed, err := jwt.Sign(t, jwt.WithKey(jwa.RS256, jwkKey)) if err != nil { log.Printf("failed to sign token: %s", err) return } _ = signed } ``` -------------------------------- ### Get Length of CachedSet Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Returns the number of elements in the CachedSet. ```go func (cs *CachedSet) Len() int ``` -------------------------------- ### Get Decode Context Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Retrieves the DecodeCtx associated with the message. ```go func (m *Message) DecodeCtx() DecodeCtx ``` -------------------------------- ### Sign and Verify JWS with RSA Key Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Demonstrates how to generate an RSA private key, sign a payload using jws.Sign with a specified algorithm and key, and then verify the signature and retrieve the payload using jws.Verify. Ensure the correct public key is used for verification. ```go import( "crypto/rand" "crypto/rsa" "log" "github.com/lestrrat-go/jwx/v2/jwa" "github.com/lestrrat-go/jwx/v2/jws" ) func main() { privkey, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { log.Printf("failed to generate private key: %s", err) return } buf, err := jws.Sign([]byte("Lorem ipsum"), jws.WithKey(jwa.RS256, privkey)) if err != nil { log.Printf("failed to created JWS message: %s", err) return } // When you receive a JWS message, you can verify the signature // and grab the payload sent in the message in one go: verified, err := jws.Verify(buf, jws.WithKey(jwa.RS256, &privkey.PublicKey)) if err != nil { log.Printf("failed to verify message: %s", err) return } log.Printf("signed message verified! -> %s", verified) } ``` -------------------------------- ### CachedSet.Get Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Get returns the value of non-Key field stored in the jwk.Set. ```APIDOC ## CachedSet.Get ### Description Get returns the value of non-Key field stored in the `jwk.Set`. ### Signature ```go func (cs *CachedSet) Get(name string) (interface{}, bool) ``` ``` -------------------------------- ### Get Decode Context from Signature Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Retrieve the DecodeCtx associated with a Signature object. ```go func (s *Signature) DecodeCtx() DecodeCtx ``` -------------------------------- ### Get Key by Index from CachedSet Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Retrieves the Key at the specified index from the CachedSet. ```go func (cs *CachedSet) Key(idx int) (Key, bool) ``` -------------------------------- ### Create X.509 Certificate Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/cert Wraps x509.CreateCertificate to additionally encode the certificate in base64 for easy inclusion in 'x5c' fields. ```go func Create(rand io.Reader, template, parent *x509.Certificate, pub, priv interface{}) ([]byte, error) ``` -------------------------------- ### Get All Signatures Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Returns a slice containing all Signature objects associated with the message. ```go func (m Message) Signatures() []*Signature ``` -------------------------------- ### Get Available Elliptic Curves Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/ecutil Returns a slice of all available elliptic curves. ```go func AvailableCurves() []elliptic.Curve ``` -------------------------------- ### Handle OpenID Claims Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Demonstrates creating an OpenID token, setting OpenID-specific claims like address, and parsing it back using jwt.Parse with jwt.WithToken(openid.New()). ```go const aLongLongTimeAgo = 233431200 t := openid.New() t.Set(jwt.SubjectKey, `https://github.com/lestrrat-go/jwx/v2/jwt`) t.Set(jwt.AudienceKey, `Golang Users`) t.Set(jwt.IssuedAtKey, time.Unix(aLongLongTimeAgo, 0)) t.Set(`privateClaimKey`, `Hello, World!`) addr := openid.NewAddress() addr.Set(openid.AddressPostalCodeKey, `105-0011`) addr.Set(openid.AddressCountryKey, `日本`) addr.Set(openid.AddressRegionKey, `東京都`) addr.Set(openid.AddressLocalityKey, `港区`) addr.Set(openid.AddressStreetAddressKey, `芝公園 4-2-8`) t.Set(openid.AddressKey, addr) buf, err := json.MarshalIndent(t, "", " ") if err != nil { fmt.Printf("failed to generate JSON: %s\n", err) return } fmt.Printf("%s\n", buf) t2, err := jwt.Parse(buf, jwt.WithToken(openid.New())) if err != nil { fmt.Printf("failed to parse JSON: %s\n", err) return } if _, ok := t2.(openid.Token); !ok { fmt.Printf("using jwt.WithToken(openid.New()) creates an openid.Token instance") return } ``` -------------------------------- ### Get Public Headers from Signature Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Access the public headers associated with a JWS Signature. ```go func (s Signature) PublicHeaders() Headers ``` -------------------------------- ### Configure HTTP Client for JWK Fetch Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Allows specifying the net/http.Client for fetching JWK sets. ```go func WithHTTPClient(v HTTPClient) FetchOption ``` -------------------------------- ### Get Protected Headers from Signature Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Access the protected headers associated with a JWS Signature. ```go func (s Signature) ProtectedHeaders() Headers ``` -------------------------------- ### Method Implementation: MapVisitorFunc.Visit Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/iter The Visit method for MapVisitorFunc, enabling it to be used directly as a MapVisitor. It simply calls the underlying function. ```go func (fn MapVisitorFunc) Visit(s string, v interface{}) error ``` -------------------------------- ### Get non-Key field from CachedSet Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Retrieves the value of a non-Key field stored in the jwk.Set. ```go func (cs *CachedSet) Get(name string) (interface{}, bool) ``` -------------------------------- ### JWT Token Initialization Comparison Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Illustrates the difference between an initialized map and a nil map for private claims in a JWT token, emphasizing the need for consistent initialization to avoid semantic differences during comparisons. ```go token1 := jwt.Token{ privateClaims: make(map[string]interface{}) } token2 := jwt.Token{ privateClaims: nil } ``` -------------------------------- ### Get Decoded Payload Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Returns the decoded payload of the JWS message as a byte slice. ```go func (m Message) Payload() []byte ``` -------------------------------- ### Builder.Build Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Constructs and returns the JWT token based on the claims set on the builder. Returns an error if any claim cannot be set. ```go func (b *Builder) Build() (Token, error) ``` -------------------------------- ### AddressClaim Get Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Retrieves a specific value from the AddressClaim by key and indicates its presence. ```go func (t *AddressClaim) Get(s string) (interface{}, bool) ``` -------------------------------- ### GetBigInt - pool Package Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/pool Acquires a *big.Int from the pool. Use ReleaseBigInt to return it. ```go func GetBigInt() *big.Int ``` -------------------------------- ### AesContentCipher TagSize Method Signature Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/cipher Method signature for getting the tag size of AesContentCipher. ```go func (c AesContentCipher) TagSize() int ``` -------------------------------- ### Create Option for Specifying Algorithm and Key Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws WithKey is used to provide a static algorithm/key pair for signing or verification. The algorithm must be a jwa.SignatureAlgorithm. The 'none' algorithm is disallowed. The key must be compatible with the specified algorithm. Accepted key types include raw keys, crypto.Signer, or jwk.Key. If the key is a jwk.Key with a 'kid', it's added to the protected header. ```go func WithKey(alg jwa.KeyAlgorithm, key interface{}, options ...WithKeySuboption) SignVerifyOption ``` -------------------------------- ### Register Signature Algorithm with Options Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Registers a SignatureAlgorithm with optional configurations. This is an experimental function and may change in future versions. Use WithSymmetricAlgorithm(true) to indicate a symmetric algorithm. ```go func RegisterSignatureAlgorithmWithOptions(v SignatureAlgorithm, options ...RegisterAlgorithmOption) ``` -------------------------------- ### AesContentCipher KeySize Method Signature Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/cipher Method signature for getting the key size of AesContentCipher. ```go func (c AesContentCipher) KeySize() int ``` -------------------------------- ### Get Raw Signature Value Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Retrieve the raw binary signature value from a Signature object. ```go func (s Signature) Signature() []byte ``` -------------------------------- ### JWT Standard Claim Storage with Pointers Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Demonstrates the use of pointers for storing standard claims to differentiate between an uninitialized state (nil) and an initialized empty state (pointer to empty string). ```go type stdToken struct { .... issuer *string // if nil, uninitialized. if &(""), initialized to empty } ``` -------------------------------- ### Register Key Encryption Algorithm with Options Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Registers a KeyEncryptionAlgorithm with optional configurations. This is an experimental function and may change in future versions. Use WithSymmetricAlgorithm(true) to indicate a symmetric algorithm. ```go func RegisterKeyEncryptionAlgorithmWithOptions(v KeyEncryptionAlgorithm, options ...RegisterAlgorithmOption) ``` -------------------------------- ### Cache.Register Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Registers a URL to be managed by the cache. URLs must be registered before they can be retrieved using Get(). ```APIDOC ## Cache.Register ### Description Registers a URL to be managed by the cache. URLs must be registered before issuing `Get`. ### Signature ```go func (c *Cache) Register(u string, options ...RegisterOption) error ``` ### Parameters * `u` (string) - The URL to register. * `options` (...RegisterOption) - Optional configuration options for registration, such as `jwk.WithParser`. ### Example ```go _ = cache.Register(url) if _, err := cache.Refresh(ctx, url); err != nil { // url is not a valid JWKS panic(err) } ``` ``` -------------------------------- ### Get Validation Context Skew Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Retrieves the time skew allowed for validation from a given context. ```go func ValidationCtxSkew(ctx context.Context) time.Duration ``` -------------------------------- ### Auto-Refresh JWK Set with jwk.Cache Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Demonstrates how to use `jwk.Cache` to automatically refresh a JWK set from a URL during a long-running process. It shows how to register a URL with a minimum refresh interval and how to retrieve keys from the cache. ```go package examples_test import ( "context" "fmt" "time" "github.com/lestrrat-go/jwx/v2/jwk" ) func Example_jwk_cache() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() const googleCerts = `https://www.googleapis.com/oauth2/v3/certs` c := jwk.NewCache(ctx) c.Register(googleCerts, jwk.WithMinRefreshInterval(15*time.Minute)) _, err := c.Refresh(ctx, googleCerts) if err != nil { fmt.Printf("failed to refresh google JWKS: %s\n", err) return } MAIN: for { select { case <-ctx.Done(): break MAIN default: } keyset, err := c.Get(ctx, googleCerts) if err != nil { fmt.Printf("failed to fetch google JWKS: %s\n", err) return } _ = keyset time.Sleep(time.Second) cancel() } } ``` -------------------------------- ### Get Number of Certificates in Chain Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/cert Returns the total number of certificates stored within the Chain. ```go func (cc *Chain) Len() int ``` -------------------------------- ### New Token Creation Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Creates a new standard token with minimal claim knowledge. This function is useful for initializing a token before populating it with specific claims. ```go func New() Token ``` -------------------------------- ### JWT Token Initialization Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Illustrates the correct way to initialize and unmarshal JWT tokens. Uninitialized tokens are nil and cannot be directly used with json.Unmarshal. ```go var token1 jwt.Token // this is nil, you can't just start using this if err := json.Unmarshal(data, &token1); err != nil { // so you can't do this ... } // But you _can_ do this, and we _want_ you to do this so the object is properly initialized token2 = jwt.New() if err := json.Unmarshal(data, &token2); err != nil { // actually, in practice you should use jwt.Parse() .... } ``` -------------------------------- ### Get Token Option Set Value Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Returns the uint64 bit flag value of the entire TokenOptionSet. ```go func (o TokenOptionSet) Value() uint64 ``` -------------------------------- ### Configure Global JWE Settings Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Applies global options to the JWE library, such as default buffer sizes. ```go func Settings(options ...GlobalOption) ``` -------------------------------- ### Get Overhead Size Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/aescbc Returns the overhead size of the authentication tag. This method fulfills the crypto.AEAD interface. ```go func (c Hmac) Overhead() int ``` -------------------------------- ### Settings Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Settings allows for global configuration of JWE behavior through various options. ```APIDOC ## Settings ### Description Settings allows for global configuration of JWE behavior through various options. ### Method ```go func Settings(options ...GlobalOption) ``` ### Parameters #### Options (`GlobalOption`) - `jwe.WithMaxDecompressBufferSize(size int)`: Sets the default maximum allowed size for decompressed payloads globally. ``` -------------------------------- ### Generic Encrypt Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/content_crypt Encrypts the plaintext using the provided key and additional authenticated data. Returns the initialization vector, ciphertext, and authentication tag. ```go func (c Generic) Encrypt(cek, plaintext, aad []byte) ([]byte, []byte, []byte, error) ``` -------------------------------- ### AvailableAlgorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/ecutil AvailableAlgorithms returns a slice of all supported JWA elliptic curve algorithms. ```APIDOC ## AvailableAlgorithms ### Description Returns a slice of all supported JWA elliptic curve algorithms. ### Signature ```go func AvailableAlgorithms() []jwa.EllipticCurveAlgorithm ``` ``` -------------------------------- ### Builder.Zoneinfo Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Sets the 'zoneinfo' claim on the builder. This claim represents the End-User's time zone. ```go func (b *Builder) Zoneinfo(v string) *Builder ``` -------------------------------- ### Get Tag from JWE Message Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Retrieves the authentication tag from a JWE message. This tag is used for integrity verification. ```go func (m *Message) Tag() []byte ``` -------------------------------- ### WithKeyProvider Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Allows users to specify an object to provide keys for signing/verifying tokens using arbitrary code. Refer to the `jws.KeyProvider` documentation for details. ```APIDOC ## func WithKeyProvider ### Description Allows users to specify an object to provide keys to sign/verify tokens using arbitrary code. ### Method Signature ```go func WithKeyProvider(v jws.KeyProvider) ParseOption ``` ### Usage Notes Please read the documentation for `jws.KeyProvider` in the `jws` package for details on how this works. ``` -------------------------------- ### Get Recipients of a JWE Message Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Retrieves the recipients associated with a JWE message. This method is part of the Message type. ```go func (m *Message) Recipients() []Recipient ``` -------------------------------- ### Get Nonce Size Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/aescbc Returns the size of the nonce used by this HMAC implementation. This method fulfills the crypto.AEAD interface. ```go func (c Hmac) NonceSize() int ``` -------------------------------- ### Builder.Address Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Sets the 'address' claim on the builder. This claim is used for address-related information. ```go func (b *Builder) Address(v *AddressClaim) *Builder ``` -------------------------------- ### Create a New JWS Verifier Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Instantiate a Verifier for a specific JWS signature algorithm. ```go func NewVerifier(alg jwa.SignatureAlgorithm) (Verifier, error) ``` -------------------------------- ### Get Validation Context Truncation Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Retrieves the duration for truncating time values during validation from a given context. Added in v2.0.4. ```go func ValidationCtxTruncation(ctx context.Context) time.Duration ``` -------------------------------- ### (KeyEncryptionAlgorithm) String() string Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Returns the string representation of a KeyEncryptionAlgorithm. ```APIDOC ## func (KeyEncryptionAlgorithm) String() string ### Description String returns the string representation of a KeyEncryptionAlgorithm. ### Signature ```go func (v KeyEncryptionAlgorithm) String() string ``` ``` -------------------------------- ### Get Unprotected Headers of a JWE Message Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Retrieves the unprotected headers from a JWE message. These headers are not encrypted and can be accessed directly. ```go func (m *Message) UnprotectedHeaders() Headers ``` -------------------------------- ### Default Token Option Set Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Creates a new TokenOptionSet using the default configuration. The actual default may vary based on global settings. ```go func DefaultOptionSet() TokenOptionSet ``` -------------------------------- ### Create KeyAlgorithm from Interface Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Converts a string, jwa.SignatureAlgorithm, or jwa.KeyEncryptionAlgorithm into a jwa.KeyAlgorithm. Returns jwa.InvalidKeyAlgorithm for unhandled types, allowing direct use in functions like jws.Sign(). ```go func KeyAlgorithmFrom(v interface{}) KeyAlgorithm ``` -------------------------------- ### Get JSON Engine Name Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/json Engine returns the name of the JSON engine being used. This can be helpful for identifying the underlying implementation. ```go func Engine() string ``` -------------------------------- ### KeyEncryptionAlgorithms() Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Returns a list of all available values for KeyEncryptionAlgorithm. ```APIDOC ## func KeyEncryptionAlgorithms() ### Description KeyEncryptionAlgorithms returns a list of all available values for KeyEncryptionAlgorithm. ### Signature ```go func KeyEncryptionAlgorithms() []KeyEncryptionAlgorithm ``` ``` -------------------------------- ### Get Available Algorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/jose Retrieves the set of available JOSE algorithms. This function is useful for understanding what cryptographic operations are supported. ```go func Algorithms(ctx context.Context, t *testing.T) (*AlgorithmSet, error) ``` -------------------------------- ### Builder.Email Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Sets the 'email' claim on the builder. This claim represents the End-User's email address. ```go func (b *Builder) Email(v string) *Builder ``` -------------------------------- ### Encrypt Option: Specify Compression Algorithm Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Use WithCompress to specify the compression algorithm for the JWE payload. Currently, only empty or 'DEF' are supported. ```go func WithCompress(v jwa.CompressionAlgorithm) EncryptOption ``` -------------------------------- ### Get Available EllipticCurveAlgorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Retrieves a list of all supported EllipticCurveAlgorithm values. This function helps in enumerating or validating EC key algorithms. ```go func EllipticCurveAlgorithms() []EllipticCurveAlgorithm ``` -------------------------------- ### Create a New Map Whitelist Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk NewMapWhitelist creates an empty JWK whitelist based on a map. URLs added to this whitelist can be fetched. ```go func NewMapWhitelist() *MapWhitelist ``` -------------------------------- ### Get Available ContentEncryptionAlgorithms Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Retrieves a list of all supported ContentEncryptionAlgorithm values. This function is useful for validating or enumerating available encryption methods. ```go func ContentEncryptionAlgorithms() []ContentEncryptionAlgorithm ``` -------------------------------- ### Builder.Profile Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Sets the 'profile' claim on the builder. This claim represents a URL for the End-User's profile page. ```go func (b *Builder) Profile(v string) *Builder ``` -------------------------------- ### Get Public Key from Private Key Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/x25519 Derives the corresponding X25519 public key from a private key. Implements the `crypto.PrivateKey` interface. ```go func (priv PrivateKey) Public() crypto.PublicKey ``` -------------------------------- ### KeyProvider FetchKeys Loop Pseudocode Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe Shows the pseudocode for iterating through recipients and KeyProviders to fetch keys for decryption. ```pseudocode for r in msg.Recipients { for kp in keyProviders { kp.FetchKeys(ctx, sink, r, msg) ... } } ``` -------------------------------- ### Get JOSE Executable Path Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/jose Retrieves the file system path to the JOSE executable. This is useful for direct interaction with the JOSE CLI. ```go func ExecutablePath() string ``` -------------------------------- ### KeyTypes() Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Returns a list of all available values for KeyType. ```APIDOC ## func KeyTypes() ### Description KeyTypes returns a list of all available values for KeyType. ### Signature ```go func KeyTypes() []KeyType ``` ``` -------------------------------- ### Get Certificate from Chain Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/cert Retrieves the n-th ASN.1 DER + base64 encoded certificate from the chain. Returns false if the index is out of range. ```go func (cc *Chain) Get(index int) ([]byte, bool) ``` -------------------------------- ### Builder.Nickname Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Sets the 'nickname' claim on the builder. This claim represents the End-User's casual name. ```go func (b *Builder) Nickname(v string) *Builder ``` -------------------------------- ### NewSet Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Creates an empty JWK Set object. This can be used as a starting point for building a JWK Set or for parsing JWK data. ```APIDOC ## func NewSet ### Description Creates and returns an empty `jwk.Set` object. ### Signature ```go func NewSet() Set ``` ``` -------------------------------- ### Builder.Name Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/openid Sets the 'name' claim on the builder. This claim represents the End-User's full name. ```go func (b *Builder) Name(v string) *Builder ``` -------------------------------- ### Register Compression Algorithm Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Registers a new CompressionAlgorithm. Duplicates are silently ignored. Use this to add support for custom compression algorithms. ```go func RegisterCompressionAlgorithm(v CompressionAlgorithm) ``` -------------------------------- ### Get Immutable Invalid Issued At Error Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Returns the immutable error used when the 'iat' claim is not satisfied. This error should only be used for comparison with errors.Is(). ```go errors.Is(err, jwt.ErrInvalidIssuedAt()) ``` -------------------------------- ### Configure JWK Fetch Whitelist Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Specifies the Whitelist for fetching JWKs from remote sources. Usable with jwk.Fetch(), jwk.NewCache(), and (*jwk.Cache).Configure(). ```go func WithFetchWhitelist(v Whitelist) FetchOption ``` -------------------------------- ### Get Immutable Invalid Audience Error Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt Returns the immutable error used when the 'aud' claim is not satisfied. This error should only be used for comparison with errors.Is(). ```go errors.Is(err, jwt.ErrInvalidAudience()) ``` -------------------------------- ### Get Private Key Seed Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/x25519 Returns the private key seed corresponding to the X25519 private key. This is useful for interoperability with RFC 7748. ```go func (priv PrivateKey) Seed() []byte ``` -------------------------------- ### RegisterKeyEncryptionAlgorithmWithOptions Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwa Registers a new KeyEncryptionAlgorithm with optional configurations. This is an experimental function and subject to change. ```APIDOC ## RegisterKeyEncryptionAlgorithmWithOptions ### Description Registers a new KeyEncryptionAlgorithm with optional configurations. This is an experimental function and subject to change. ### Function Signature ```go func RegisterKeyEncryptionAlgorithmWithOptions(v KeyEncryptionAlgorithm, options ...RegisterAlgorithmOption) ``` ### Options - `WithSymmetricAlgorithm(true)`: Indicates that the algorithm is symmetric. ``` -------------------------------- ### Create New JWK Set Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk Creates an empty jwk.Set object. This is a fundamental starting point for building or populating JWK sets programmatically. ```go func NewSet() Set ``` -------------------------------- ### Create Option to Validate Key Before Use Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws WithValidateKey (added in v2.0.16) specifies whether to validate the key before signing or verification. This requires the key to be a jwk.Key or convertible to one. Custom hardware-backed keys may not work. By default, keys are not validated. ```go func WithValidateKey(v bool) SignVerifyOption ``` -------------------------------- ### KeyProviderFunc.FetchKeys Method Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe The FetchKeys method for KeyProviderFunc executes the function to retrieve keys. ```APIDOC ## func (KeyProviderFunc) FetchKeys ```go func (kp KeyProviderFunc) FetchKeys(ctx context.Context, sink KeySink, r Recipient, msg *Message) error ``` This method is part of the KeyProviderFunc type, allowing it to fulfill the KeyProvider interface. ``` -------------------------------- ### Get X25519 Key Size Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/keygen Returns the key size associated with this X25519 key generator. Use this to understand the expected size of generated keys. ```go func (g X25519) Size() int ``` -------------------------------- ### NumericDate Type Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwt/internal/types NumericDate represents the date format used in the 'nbf' claim. It provides methods for accepting, getting, marshaling, and unmarshaling date values. ```APIDOC ## type NumericDate ```go type NumericDate struct { time.Time } ``` NumericDate represents the date format used in the 'nbf' claim. ### Methods #### func (*NumericDate) Accept(v interface{}) error #### func (*NumericDate) Get() time.Time #### func (*NumericDate) MarshalJSON() ([]byte, error) MarshalJSON translates from internal representation to JSON NumericDate See https://tools.ietf.org/html/rfc7519#page-6 #### func (NumericDate) String() string added in v2.0.1 #### func (*NumericDate) UnmarshalJSON(data []byte) error ``` -------------------------------- ### New KDF Function Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/concatkdf Constructor for creating a new KDF instance. Requires a crypto.Hash, algorithm identifier, and various byte slices for key derivation. ```go func New(hash crypto.Hash, alg, Z, apu, apv, pubinfo, privinfo []byte) *KDF ``` -------------------------------- ### Create Option for Insecure 'none' Signature Algorithm Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Use WithInsecureNoSignature to allow the 'none' signature algorithm. This is insecure and should not be used in production. It prevents accidental use of 'none' by requiring an explicit option. ```go func WithInsecureNoSignature(options ...WithKeySuboption) SignOption ``` -------------------------------- ### Get Elliptic Curve for Algorithm Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/ecutil Retrieves the elliptic curve associated with a given JWA elliptic curve algorithm. Returns true if the algorithm is supported. ```go func CurveForAlgorithm(alg jwa.EllipticCurveAlgorithm) (elliptic.Curve, bool) ``` -------------------------------- ### GetBigInt Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/pool Acquires a *big.Int from the pool. ```APIDOC ## GetBigInt ### Description Acquires a *big.Int from the pool. ### Signature ``` func GetBigInt() *big.Int ``` ``` -------------------------------- ### jws.Parse Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jws Parses JWS contents from a byte slice. It can automatically detect compact or JSON serialization, or be explicitly guided using WithJSON() and WithCompact() options. ```APIDOC ## func Parse ### Description Parse parses contents from the given source and creates a jws.Message struct. By default the input can be in either compact or full JSON serialization. You may pass `jws.WithJSON()` and/or `jws.WithCompact()` to specify explicitly which format to use. If neither or both is specified, the function will attempt to autodetect the format. If one or the other is specified, only the specified format will be attempted. ### Method ```go func Parse(src []byte, options ...ParseOption) (*Message, error) ``` ``` -------------------------------- ### RSA PKCS1v1.5 Decryptor Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwe/internal/keyenc RSAPKCS15Decrypt decrypts keys using the RSA PKCS1v1.5 algorithm. It requires the algorithm, private key, and key size for setup. ```go type RSAPKCS15Decrypt struct { // contains filtered or unexported fields } ``` ```go func NewRSAPKCS15Decrypt(alg jwa.KeyEncryptionAlgorithm, privkey *rsa.PrivateKey, keysize int) *RSAPKCS15Decrypt ``` ```go func (d RSAPKCS15Decrypt) Algorithm() jwa.KeyEncryptionAlgorithm ``` ```go func (d RSAPKCS15Decrypt) Decrypt(enckey []byte) ([]byte, error) ``` -------------------------------- ### NewAlgorithmSet Source: https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/internal/jose Creates a new empty AlgorithmSet. ```APIDOC ## NewAlgorithmSet ### Description Creates a new empty AlgorithmSet. ### Signature ```go func NewAlgorithmSet() *AlgorithmSet ``` ```