Skip to content

Releases: coenttb/swift-jwt

Release 0.0.2

22 Aug 17:34

Choose a tag to compare

What's Changed

  • JWT implementation improvements and bug fixes
  • Enhanced error handling
  • Code cleanup and optimizations

Full Changelog

0.0.1...0.0.2

swift-jwt 0.0.1

28 Jul 07:58

Choose a tag to compare

swift-jwt 0.0.1

Initial release of swift-jwt, a comprehensive Swift package for creating, signing, and verifying JSON Web Tokens (JWTs) using Apple's Crypto framework.

✨ Features

  • Multiple Signing Algorithms: HMAC-SHA256/384/512 and ECDSA-SHA256 support
  • Standards Compliant: Built on swift-rfc-7519 and swift-crypto
  • Easy to Use: Convenience methods for common JWT operations
  • Type Safe: Leverages Swift's type system for secure JWT handling
  • Comprehensive: Full signature verification and timing validation
  • Flexible: Custom claims and header parameters support

🚀 Quick Start

import JWT

// Create a JWT with HMAC-SHA256
let jwt = try JWT.hmacSHA256(
    issuer: "example.com",
    subject: "user123",
    audience: "api.example.com",
    expiresIn: 3600,
    claims: ["role": "admin"],
    secretKey: "your-secret-key"
)

// Verify the JWT
let verificationKey = VerificationKey.symmetric(string: "your-secret-key")
let isValid = try jwt.verifyAndValidate(with: verificationKey)

📦 Installation

Add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/coenttb/swift-jwt.git", from: "0.0.1")
]

📋 Requirements

  • Platforms: macOS 13.0+, iOS 16.0+
  • Swift: 5.9+ (Swift 6.0 supported)

🔒 Security

This package includes comprehensive security features and follows JWT best practices. Please review the documentation for security considerations when implementing JWT authentication in your applications.


For complete documentation, examples, and advanced usage, see the README.