Skip to content

Instance Method

add(eddsa:kid:parser:serializer:)

Adds an EdDSA key to the collection using an EdDSAKey.
@discardableResult func add(eddsa key: some EdDSAKey, kid: JWKIdentifier? = nil, parser: some JWTParser = DefaultJWTParser(), serializer: some JWTSerializer = DefaultJWTSerializer()) -> Self

Parameters

key

The EdDSAKey used for EdDSA signing. EdDSA keys are known for their short signature and key sizes, which contribute to their efficiency and speed.

kid

An optional JWKIdentifier (Key ID). Providing this identifier allows the JWT kid header field to reference this specific signer.

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)