Instance MethodJWTKit
add(ecdsa:kid:parser:serializer:)
Adds an ECDSA key to the collection.
@discardableResult func add(ecdsa key: some ECDSAKey, kid: JWKIdentifier? = nil, parser: some JWTParser = DefaultJWTParser(), serializer: some JWTSerializer = DefaultJWTSerializer()) -> Self
Parameters
keyThe
ECDSAKeyto be used for signing. This key should be securely stored and not exposed.kidAn optional
JWKIdentifier(Key ID). If provided, this identifier will be used in the JWTkidheader field to identify the key.jsonEncoderAn optional custom JSON encoder conforming to
JWTJSONEncoder, used for encoding JWTs. Ifnil, a default encoder is used.jsonDecoderAn optional custom JSON decoder conforming to
JWTJSONDecoder, used for decoding JWTs. Ifnil, a default decoder is used.
Return Value
The same instance of the collection (Self), which allows for method chaining.
Discussion
Example Usage:
let collection = await JWTKeyCollection()
.addECDSA(key: myECDSAKey)