Instance Method
add(pss:digestAlgorithm:kid:parser:serializer:)
Adds a PSS key to the collection.
@discardableResult func add(pss 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.
Return Value
The same instance of the collection (Self), enabling method chaining.
Discussion
This method configures and adds a PSS (RSA PSS Signature) key to the collection. PSS uses RSASSA-PSS for the RSA signature, which is considered more secure than PKCS#1 v1.5 padding used in RSA.
Example Usage:
let collection = await JWTKeyCollection()
.addPSS(key: myRSAKey)