Skip to content

Instance Method

getKey(for:alg:)

Retrieves the key associated with the provided key identifier (KID) and algorithm (ALG), if available.
func getKey(for kid: JWKIdentifier? = nil, alg: String? = nil) async throws -> any JWTAlgorithm

Return Value

A JWTKey if one is found; otherwise, nil.

Discussion

  • kid: An optional JWKIdentifier. If not provided, the default signer is returned.

  • alg: An optional algorithm identifier.

Throws

JWTError/generic if the algorithm cannot be retrieved.