Instance Method
add(rsa:digestAlgorithm:kid:parser:serializer:)
Adds an RSA key to the collection.
@discardableResult func add(rsa key: some RSAKey, digestAlgorithm: DigestAlgorithm, kid: JWKIdentifier? = nil, parser: some JWTParser = DefaultJWTParser(), serializer: some JWTSerializer = DefaultJWTSerializer()) -> Self
Parameters
keyThe
RSAKeyto use for signing. This key should be kept secure and not exposed.kidAn optional
JWKIdentifier(Key ID). If provided, it will be used to identify this key in the JWTkidheader field.
Discussion
This method configures and adds an RSA key to the collection. The key is used for signing JWTs
Example Usage:
let collection = await JWTKeyCollection()
.addRSA(key: myRSAKey)