Instance Method
sign(_:kid:header:)
Signs a JWT payload and returns the JWT string.
func sign(_ payload: some JWTPayload, kid: JWKIdentifier? = nil, header: JWTHeader = JWTHeader()) async throws -> String
Parameters
payloadThe payload to sign.
kidAn optional key identifier to specify the signer. If not provided, the header is checked for a KID, and if that is not provided, the default signer is used.
headerAn optional header to include in the JWT.
Return Value
A signed JWT token string.
Discussion
Throws
An error if the payload cannot be signed.