Swiftpack.co - hendrickson-tyler/swift-pkce as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hendrickson-tyler.
hendrickson-tyler/swift-pkce 1.0.0
Commonly used methods in OAuth 2.0 PKCE protocol
⭐️ 1
🕓 1 year ago
iOS macOS watchOS tvOS macCatalyst
.package(url: "https://github.com/hendrickson-tyler/swift-pkce.git", from: "1.0.0")

Swift PKCE

Swift PKCE is a lightweight collection of commonly used, client-side code generations in an OAuth 2.0 Authorization Code flow + PKCE implemented in Swift. Each function conforms to the RFC 7636 protocol.

Availability

Due to the dependency on Apple CryptoKit, Swift PKCE is available to the following platforms:

iOS 13.0+
iPadOS 13.0+
macOS 10.15+
Mac Catalyst 15.0+
tvOS 15.0+
watchOS 8.0+

Usage

Import the Swift PKCE framework by adding it to the imports at the top of the file:

import PKCE

Functions

generateCodeVerifier
Generates a new, random code verifier with a specified length of characters.

func generateCodeVerifier(length: Int = 128) throws -> String {

generateCodeChallenge
Generates a code challenge for a given code verifier.

func generateCodeChallenge(for: String) throws -> String

Attribution

The original code for Swift PKCE was sourced from a Bootstragram blog post written by @dirtyhenry and updated slightly.

GitHub

link
Stars: 1
Last commit: 6 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

1.0.0
1 year ago

Initial release:

  • Ability to generate a code verifier
  • Ability to generate a code challenge

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics