JWSETKit icon indicating copy to clipboard operation
JWSETKit copied to clipboard

A kit to create, sign and verify a JWT or JWS object

JWSETKit

A library for working with JSON Web Signature (JWS) and JSON Web Token (JWT).

Swift CodeQL License Release version

Lines of Code Duplicated Lines

Quality Gate Status Technical Debt Maintainability Rating Coverage

Overview

JSON Web Signature (JWS) represents content secured with digital signatures or Message Authentication Codes (MACs) using JSON-based RFC7159 data structures. The JWS cryptographic mechanisms provide integrity protection for an arbitrary sequence of octets.

JSON Web Token (JWT) is a compact claims representation format intended for space constrained environments such as HTTP Authorization headers and URI query parameters.

This module makes it possible to serialize, deserialize, create, and verify JWS/JWT messages.

Supported Swift Versions

This library was introduced with support for Swift 5.8 or later.

Getting Started

To use JWSETKit, add the following dependency to your Package.swift:

dependencies: [
    .package(url: "https://github.com/amosavian/JWSETKit", .upToNextMinor(from: "0.19.0"))
]

Note that this repository does not have a 1.0 tag yet, so the API is not stable.

You can then add the specific product dependency to your target:

dependencies: [
    .product(name: "JWSETKit", package: "JWSETKit"),
]

Usage

For detailed usage and API documentation, check the documentation.

Comparison To Other Libraries

Features

JWSETKit jwt-kit JOSESwift Auth0's JWTDecode
JSON Web Signature (JWS) :white_check_mark: :x: :white_check_mark: :x:
JWS Multiple Signatures :white_check_mark: :x: :x: :x:
JWS Unencoded/Detached Payload :white_check_mark: :x: :x: :x:
JSON Web Token (JWT) :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
JWT Signature Verfication :white_check_mark: :white_check_mark: :white_check_mark: :x:
JWT Expire/NotBefore Validity :white_check_mark: :white_check_mark: :white_check_mark: :x:
JSON Web Encryption (JWE) :white_check_mark: :x: :white_check_mark: :x:
Support CommonCrypto Keys :white_check_mark: :x: :x: :x:
Support CryptoKit Keys :white_check_mark: :x: :x: :x:

Supported Algorithms

Signature/HMAC

JWSETKit jwt-kit JOSESwift Auth0's JWTDecode
HS256 :white_check_mark: :white_check_mark: :white_check_mark: :x:
HS384 :white_check_mark: :white_check_mark: :white_check_mark: :x:
HS512 :white_check_mark: :white_check_mark: :white_check_mark: :x:
RS256 :white_check_mark: :white_check_mark: :white_check_mark: :x:
RS384 :white_check_mark: :white_check_mark: :white_check_mark: :x:
RS512 :white_check_mark: :white_check_mark: :white_check_mark: :x:
ES256 :white_check_mark: :white_check_mark: :white_check_mark: :x:
ES384 :white_check_mark: :white_check_mark: :white_check_mark: :x:
ES512 :white_check_mark: :white_check_mark: :white_check_mark: :x:
PS256 :white_check_mark: :white_check_mark: :white_check_mark: :x:
PS384 :white_check_mark: :white_check_mark: :white_check_mark: :x:
PS512 :white_check_mark: :white_check_mark: :white_check_mark: :x:
PS512 :white_check_mark: :white_check_mark: :white_check_mark: :x:
EdDSA :white_check_mark: :white_check_mark: :x: :x:
E256K :x: :x: :x: :x:

Key Encryption

JWSETKit JOSESwift
RSA1_5 :white_check_mark: :white_check_mark:
RSA-OAEP :white_check_mark: :white_check_mark:
RSA-OAEP-256 :white_check_mark: :white_check_mark:
A128KW :white_check_mark: :white_check_mark:
A192KW :white_check_mark: :white_check_mark:
A256KW :white_check_mark: :white_check_mark:
dir :white_check_mark: :white_check_mark:
ECDH-ES :white_check_mark: :x:
ECDH-ES+A128KW :white_check_mark: :x:
ECDH-ES+A192KW :white_check_mark: :x:
ECDH-ES+A256KW :white_check_mark: :x:
A128GCMKW :white_check_mark: :x:
A192GCMKW :white_check_mark: :x:
A256GCMKW :white_check_mark: :x:
PBES2-HS256+A128KW :white_check_mark: :x:
PBES2-HS384+A192KW :white_check_mark: :x:
PBES2-HS512+A256KW :white_check_mark: :x:

Content Encryption

JWSETKit JOSESwift
A128CBC-HS256 :white_check_mark: :white_check_mark:
A192CBC-HS384 :white_check_mark: :white_check_mark:
A256CBC-HS512 :white_check_mark: :white_check_mark:
A128GCM :white_check_mark: :x:
A192GCM :white_check_mark: :x:
A256GCM :white_check_mark: :x: