JWTDecode.swift

A JWT decoder for iOS, macOS, tvOS, and watchOS

MIT License

Stars
639
Committers
24

Bot releases are visible (Hide)

JWTDecode.swift - 3.2.0-beta.0 Latest Release

Published by desusai7 4 months ago

Added

Changed

  • Dropped support for Xcode 14, Swift versions [5,7, 5.8]
  • Dropped support for iOS 13 & tvOS 13.
JWTDecode.swift - 3.1.0

Published by Widcket over 1 year ago

Removed

  • Drop support for iOS 12, tvOS 12, macOS 10.15, watch0S < 7, and Xcode 13 #199 (Widcket)
JWTDecode.swift - 3.0.1

Published by Widcket over 1 year ago

Fixed

  • Fix conversion of boolean claim values #193 (Widcket)
JWTDecode.swift - 3.0.0

Published by Widcket about 2 years ago

💡 Check the Migration Guide to understand the changes required to migrate your application to v3.

⚠️ BREAKING CHANGES

  • Rename DecodeError and error case #162 (Widcket)
  • Drop support for Objective-C [SDK-3405] #149 (Widcket)
  • Remove ID token validator [SDK-3395] #145 (Widcket)
  • Drop support for old platform versions [SDK-3386] #143 (Widcket)
  • Drop support for old Swift versions [SDK-3394] #142 (Widcket)

Added

  • Add subscript getter for claims [SDK-3421] #156 (Widcket)

Changed

JWTDecode.swift - 3.0.0-fa

Published by Widcket over 2 years ago

💡 Check the Migration Guide to understand the changes required to migrate your application to v3.

⚠️ BREAKING CHANGES

  • Rename DecodeError and error case #162 (Widcket)
  • Drop support for Objective-C [SDK-3405] #149 (Widcket)
  • Remove ID token validator [SDK-3395] #145 (Widcket)
  • Drop support for old platform versions [SDK-3386] #143 (Widcket)
  • Drop support for old Swift versions [SDK-3394] #142 (Widcket)

Added

  • Add subscript getter for claims [SDK-3421] #156 (Widcket)

Changed

JWTDecode.swift - 2.6.3

Published by Widcket about 3 years ago

Changed

Fixed

  • Add supported Plattforms to Package.swift #131 (obrhoff)
JWTDecode.swift - 2.6.2

Published by Widcket about 3 years ago

Security

JWTDecode.swift - 2.6.1

Published by Widcket over 3 years ago

Changed

  • Make test dependencies not resolve when installing with SPM [SDK-2599] #125 (Widcket)
JWTDecode.swift - 2.6.0

Published by Widcket over 3 years ago

JWTDecode.swift - 2.5.0

Published by Widcket about 4 years ago

⚠️ This release adds support for Xcode 12 and drops support for Xcode < 11.4

Changed

JWTDecode.swift - 2.4.1

Published by Widcket almost 5 years ago

Changed

  • Lowered tvOS deployment target to 9.0 #100 (Widcket)
  • Added SPM instructions to the README #99 (Widcket)
JWTDecode.swift - 2.4.0

Published by Widcket almost 5 years ago

Added

  • Added Swift Package Manager Support [SDK-1181] #97 (Widcket)
  • Added watchOS support #91 (jklp)
JWTDecode.swift - 2.3.1

Published by cocojoe about 5 years ago

Added

  • Multiple Swift version support in CocoaPods #94 (ericbuehl)
JWTDecode.swift - 2.3.0

Published by cocojoe over 5 years ago

Added

  • Added Swift 5 / Xcode 10.2 support #88 (cocojoe)
JWTDecode.swift - 2.2.0

Published by cocojoe almost 6 years ago

Added

Changed

JWTDecode.swift - 2.1.1

Published by cocojoe about 7 years ago

Added

JWTDecode.swift - 2.1.0

Published by cocojoe about 7 years ago

Added

JWTDecode.swift - 2.0.0

Published by hzalaz about 8 years ago

Full Changelog

Support for Xcode 8 & Swift 3.

Following Swift API Guidelines, all functions and methods requires a parameter label.

So now to decode a token

try JWTDecode.decode(jwt: "token")

Also now JWTDecode errors conforms the protocol LocalizableError

public enum DecodeError: LocalizedError {
    case invalidBase64Url(String)
    case invalidJSON(String)
    case invalidPartCount(String, Int)

    public var localizedDescription: String {
        switch self {
        case .invalidJSON(let value):
            return NSLocalizedString("Malformed jwt token, failed to parse JSON value from base64Url \(value)", comment: "Invalid JSON value inside base64Url")
        case .invalidPartCount(let jwt, let parts):
            return NSLocalizedString("Malformed jwt token \(jwt) has \(parts) parts when it should have 3 parts", comment: "Invalid amount of jwt parts")
        case .invalidBase64Url(let value):
            return NSLocalizedString("Malformed jwt token, failed to decode base64Url value \(value)", comment: "Invalid JWT token base64Url value")
        }
    }
}
JWTDecode.swift - 1.2.0

Published by hzalaz about 8 years ago

Full Changelog

Support for Xcode 8 & Swift 2.3.

JWTDecode.swift - 1.1.0

Published by hzalaz about 8 years ago

Full Changelog

Changed:

  • Rework how claims are decoded #35 (hzalaz)
  • Add expired method to A0JWT #25 (wkoszek)
  • Require only App Extension Safe API (in iOS) #20 (hzalaz)

Added:

Deprecated:

To provide a better experience while dealing with claims and converting their values to Swift types, we deprecated the following method to retrive JWT claims

public func claim<T>(name: String) -> T?

In favor of the following method to retrieve the claim

let claim = jwt.claim(name: "claim_name")

and then you can try converting it's value to the proper type like

if let email = claim.string {
    print("JWT had email \(email)")
}

The supported conversions are:

var string: String?
var integer: Int?
var double: Double?
var date: NSDate?
var array: [String]?