Instance MethodJWTKit
add(eddsa:kid:parser:serializer:)
EdDSAKey.@discardableResult func add(eddsa key: some EdDSAKey, kid: JWKIdentifier? = nil, parser: some JWTParser = DefaultJWTParser(), serializer: some JWTSerializer = DefaultJWTSerializer()) -> Self
Parameters
keyThe
EdDSAKeyused for EdDSA signing. EdDSA keys are known for their short signature and key sizes, which contribute to their efficiency and speed.kidAn optional
JWKIdentifier(Key ID). Providing this identifier allows the JWTkidheader field to reference this specific signer.jsonEncoderAn optional custom JSON encoder that conforms to
JWTJSONEncoder. If not specified, a default encoder is used for encoding JWT payloads.jsonDecoderAn optional custom JSON decoder that conforms to
JWTJSONDecoder. If not specified, a default decoder is used for decoding JWT payloads.
Return Value
The same instance of the collection (Self), useful for chaining multiple configuration calls.
Discussion
This method incorporates an EdDSA (Edwards-curve Digital Signature Algorithm) signer into the collection.
Usage Example:
let collection = await JWTKeyCollection()
.addEdDSA(key: myEdDSAKey)