Skip to content

Instance Method

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

key

The ECDSAKey to be used for signing. This key should be securely stored and not exposed.

kid

An optional JWKIdentifier (Key ID). If provided, this identifier will be used in the JWT kid header field to identify the key.

Return Value

The same instance of the collection (Self), which allows for method chaining.

Discussion

Example Usage:

let collection = await JWTKeyCollection()
    .addECDSA(key: myECDSAKey)