Skip to content

Commit c783ed6

Browse files
authored
Added Swift Package Manager support [SDK-2014] (#425)
* Add Objective-C target * Implement test target * Gate WebAuth files * Add preprocessor definitions * Fix Catalyst support * Add Catalyst fix for logout as well * Add an alternate crypto implementation for macOS * Use latest SimpleKeychain release * Use the right algorithm for macOS * Fix indentation of function params * Add swift test to CI config * Add preprocessor definitions to the Podspec * Remove extra whitespace * Move the swift test command to the macOS job * Inherit other preprocessor definitions * Use the latest release of JWTDecode.swift * Add macOS version constraint * Use macro for macOS version * Update README.md * Fix param name * Fix tests * Change call order for consistency
1 parent bb51382 commit c783ed6

File tree

82 files changed

+390
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+390
-86
lines changed

.circleci/config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ jobs:
7474
security unlock-keychain -p circle "/Users/distiller/Library/Keychains/cikeychain-db"
7575
- run:
7676
name: Run test suite
77-
command: xcodebuild test -scheme Auth0.macOS -destination 'platform=macOS,arch=x86_64' | xcpretty
77+
command: |
78+
xcodebuild test -scheme Auth0.macOS -destination 'platform=macOS,arch=x86_64' | xcpretty
79+
swift test
7880
- save_cache:
7981
key: dependency-cache
8082
paths:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ playground.xcworkspace
6363
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
6464
# Packages/
6565
.build/
66+
Package.resolved
6667

6768
# CocoaPods
6869
#

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Auth0.podspec

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version = `agvtool mvers -terse1`.strip
22

33
web_auth_files = [
4-
'Auth0/A0ChallengeGenerator.h',
5-
'Auth0/A0ChallengeGenerator.m',
6-
'Auth0/A0RSA.h',
7-
'Auth0/A0RSA.m',
8-
'Auth0/A0SHA.h',
9-
'Auth0/A0SHA.m',
4+
'Auth0/ObjectiveC/A0ChallengeGenerator.h',
5+
'Auth0/ObjectiveC/A0ChallengeGenerator.m',
6+
'Auth0/ObjectiveC/A0RSA.h',
7+
'Auth0/ObjectiveC/A0RSA.m',
8+
'Auth0/ObjectiveC/A0SHA.h',
9+
'Auth0/ObjectiveC/A0SHA.m',
1010
'Auth0/A0SimpleKeychain+RSAPublicKey.swift',
1111
'Auth0/Array+Encode.swift',
1212
'Auth0/AuthCancelable.swift',
@@ -75,22 +75,24 @@ Pod::Spec.new do |s|
7575
s.tvos.deployment_target = '9.0'
7676
s.requires_arc = true
7777

78-
s.ios.source_files = 'Auth0/*.{swift,h,m}'
78+
s.ios.source_files = 'Auth0/*.{swift,h,m}', 'Auth0/ObjectiveC/*.{h,m}'
7979
s.ios.frameworks = 'UIKit', 'SafariServices', 'LocalAuthentication'
8080
s.ios.weak_framework = 'AuthenticationServices'
8181
s.ios.dependency 'SimpleKeychain'
8282
s.ios.dependency 'JWTDecode'
8383
s.ios.exclude_files = macos_files
8484
s.ios.pod_target_xcconfig = {
85-
'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'WEB_AUTH_PLATFORM'
85+
'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'WEB_AUTH_PLATFORM',
86+
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) WEB_AUTH_PLATFORM=1'
8687
}
8788

88-
s.osx.source_files = 'Auth0/*.{swift,h,m}'
89+
s.osx.source_files = 'Auth0/*.{swift,h,m}', 'Auth0/ObjectiveC/*.{h,m}'
8990
s.osx.exclude_files = ios_files
9091
s.osx.dependency 'SimpleKeychain'
9192
s.osx.dependency 'JWTDecode'
9293
s.osx.pod_target_xcconfig = {
93-
'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'WEB_AUTH_PLATFORM'
94+
'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => 'WEB_AUTH_PLATFORM',
95+
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) WEB_AUTH_PLATFORM=1'
9496
}
9597

9698
s.watchos.source_files = 'Auth0/*.swift'

Auth0.xcodeproj/project.pbxproj

+44-14
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,11 @@
529529
5C41F6E0244FA62200252548 /* Auth0.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Auth0.plist; path = ../Auth0.plist; sourceTree = "<group>"; };
530530
5C41F6E2244FB15900252548 /* NSApplication+Shared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSApplication+Shared.swift"; sourceTree = "<group>"; };
531531
5C49EB3423EB5A80008D562F /* JWK+RSA.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JWK+RSA.swift"; sourceTree = "<group>"; };
532-
5C4F550223C8FADE00C89615 /* A0SHA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = A0SHA.m; sourceTree = "<group>"; };
533-
5C4F550323C8FADE00C89615 /* A0SHA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = A0SHA.h; sourceTree = "<group>"; };
532+
5C4F550223C8FADE00C89615 /* A0SHA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = A0SHA.m; path = ObjectiveC/A0SHA.m; sourceTree = "<group>"; };
533+
5C4F550323C8FADE00C89615 /* A0SHA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = A0SHA.h; path = ObjectiveC/A0SHA.h; sourceTree = "<group>"; };
534534
5C4F550423C8FADE00C89615 /* JWTAlgorithm.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JWTAlgorithm.swift; sourceTree = "<group>"; };
535-
5C4F550523C8FADF00C89615 /* A0RSA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = A0RSA.m; sourceTree = "<group>"; };
536-
5C4F550623C8FADF00C89615 /* A0RSA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = A0RSA.h; sourceTree = "<group>"; };
535+
5C4F550523C8FADF00C89615 /* A0RSA.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = A0RSA.m; path = ObjectiveC/A0RSA.m; sourceTree = "<group>"; };
536+
5C4F550623C8FADF00C89615 /* A0RSA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = A0RSA.h; path = ObjectiveC/A0RSA.h; sourceTree = "<group>"; };
537537
5C4F551823C8FB8E00C89615 /* String+URLSafe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+URLSafe.swift"; sourceTree = "<group>"; };
538538
5C4F551923C8FB8E00C89615 /* Array+Encode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Array+Encode.swift"; sourceTree = "<group>"; };
539539
5C4F552223C8FBA100C89615 /* JWKS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JWKS.swift; sourceTree = "<group>"; };
@@ -621,14 +621,14 @@
621621
5FBBF0371CC964BC0024D2AF /* Matchers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Matchers.swift; path = Auth0Tests/Matchers.swift; sourceTree = SOURCE_ROOT; };
622622
5FBBF03A1CC96AA70024D2AF /* Responses.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Responses.swift; path = Auth0Tests/Responses.swift; sourceTree = SOURCE_ROOT; };
623623
5FBBF0421CCA90300024D2AF /* AuthenticationSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AuthenticationSpec.swift; path = Auth0Tests/AuthenticationSpec.swift; sourceTree = SOURCE_ROOT; };
624-
5FBEF3DD1D07A4B700D90941 /* A0WebAuthSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = A0WebAuthSpec.m; path = Auth0Tests/A0WebAuthSpec.m; sourceTree = SOURCE_ROOT; };
625-
5FC34AF51D0101BF000F28F5 /* A0ChallengeGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = A0ChallengeGenerator.h; path = Auth0/A0ChallengeGenerator.h; sourceTree = SOURCE_ROOT; };
626-
5FC34AF61D0101BF000F28F5 /* A0ChallengeGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = A0ChallengeGenerator.m; path = Auth0/A0ChallengeGenerator.m; sourceTree = SOURCE_ROOT; };
624+
5FBEF3DD1D07A4B700D90941 /* A0WebAuthSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = A0WebAuthSpec.m; path = Auth0Tests/ObjectiveC/A0WebAuthSpec.m; sourceTree = SOURCE_ROOT; };
625+
5FC34AF51D0101BF000F28F5 /* A0ChallengeGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = A0ChallengeGenerator.h; path = Auth0/ObjectiveC/A0ChallengeGenerator.h; sourceTree = SOURCE_ROOT; };
626+
5FC34AF61D0101BF000F28F5 /* A0ChallengeGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = A0ChallengeGenerator.m; path = Auth0/ObjectiveC/A0ChallengeGenerator.m; sourceTree = SOURCE_ROOT; };
627627
5FCAB1701D09005A00331C84 /* NSURLComponents+OAuth2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSURLComponents+OAuth2.swift"; path = "Auth0/NSURLComponents+OAuth2.swift"; sourceTree = SOURCE_ROOT; };
628628
5FCAB1721D09009600331C84 /* NSData+URLSafe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSData+URLSafe.swift"; path = "Auth0/NSData+URLSafe.swift"; sourceTree = SOURCE_ROOT; };
629629
5FCAB1751D0900CF00331C84 /* TransactionStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TransactionStore.swift; path = Auth0/TransactionStore.swift; sourceTree = SOURCE_ROOT; };
630630
5FCAB1781D09124D00331C84 /* NSURL+Auth0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSURL+Auth0.swift"; path = "Auth0/NSURL+Auth0.swift"; sourceTree = SOURCE_ROOT; };
631-
5FCCC3101CF4D4FF00901E2E /* AuthenticationAPISpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AuthenticationAPISpec.m; path = Auth0Tests/AuthenticationAPISpec.m; sourceTree = SOURCE_ROOT; };
631+
5FCCC3101CF4D4FF00901E2E /* AuthenticationAPISpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AuthenticationAPISpec.m; path = Auth0Tests/ObjectiveC/AuthenticationAPISpec.m; sourceTree = SOURCE_ROOT; };
632632
5FCCC31B1CF51DF300901E2E /* _ObjectiveManagementAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = _ObjectiveManagementAPI.swift; path = Auth0/_ObjectiveManagementAPI.swift; sourceTree = SOURCE_ROOT; };
633633
5FD255B01D14A9E000387ECB /* AuthenticationErrorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AuthenticationErrorSpec.swift; path = Auth0Tests/AuthenticationErrorSpec.swift; sourceTree = SOURCE_ROOT; };
634634
5FD255B31D14DD2600387ECB /* ManagementError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ManagementError.swift; path = Auth0/ManagementError.swift; sourceTree = SOURCE_ROOT; };
@@ -2341,6 +2341,10 @@
23412341
"$(PROJECT_DIR)/Carthage/Build/Mac",
23422342
);
23432343
GCC_C_LANGUAGE_STANDARD = gnu11;
2344+
GCC_PREPROCESSOR_DEFINITIONS = (
2345+
"$(inherited)",
2346+
"WEB_AUTH_PLATFORM=1",
2347+
);
23442348
INFOPLIST_FILE = OAuth2Mac/Info.plist;
23452349
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
23462350
MACOSX_DEPLOYMENT_TARGET = 10.11;
@@ -2375,6 +2379,7 @@
23752379
"$(PROJECT_DIR)/Carthage/Build/Mac",
23762380
);
23772381
GCC_C_LANGUAGE_STANDARD = gnu11;
2382+
GCC_PREPROCESSOR_DEFINITIONS = "WEB_AUTH_PLATFORM=1";
23782383
INFOPLIST_FILE = OAuth2Mac/Info.plist;
23792384
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
23802385
MACOSX_DEPLOYMENT_TARGET = 10.11;
@@ -2518,6 +2523,10 @@
25182523
"$(inherited)",
25192524
"$(PROJECT_DIR)/Carthage/Build/iOS",
25202525
);
2526+
GCC_PREPROCESSOR_DEFINITIONS = (
2527+
"$(inherited)",
2528+
"WEB_AUTH_PLATFORM=1",
2529+
);
25212530
INFOPLIST_FILE = Auth0/Info.plist;
25222531
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
25232532
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@@ -2548,6 +2557,7 @@
25482557
"$(inherited)",
25492558
"$(PROJECT_DIR)/Carthage/Build/iOS",
25502559
);
2560+
GCC_PREPROCESSOR_DEFINITIONS = "WEB_AUTH_PLATFORM=1";
25512561
INFOPLIST_FILE = Auth0/Info.plist;
25522562
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
25532563
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@@ -2579,6 +2589,10 @@
25792589
"$(PROJECT_DIR)/Carthage/Build/Mac",
25802590
);
25812591
FRAMEWORK_VERSION = A;
2592+
GCC_PREPROCESSOR_DEFINITIONS = (
2593+
"$(inherited)",
2594+
"WEB_AUTH_PLATFORM=1",
2595+
);
25822596
INFOPLIST_FILE = Auth0/Info.plist;
25832597
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
25842598
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
@@ -2613,6 +2627,7 @@
26132627
"$(PROJECT_DIR)/Carthage/Build/Mac",
26142628
);
26152629
FRAMEWORK_VERSION = A;
2630+
GCC_PREPROCESSOR_DEFINITIONS = "WEB_AUTH_PLATFORM=1";
26162631
INFOPLIST_FILE = Auth0/Info.plist;
26172632
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
26182633
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
@@ -2639,8 +2654,12 @@
26392654
"$(inherited)",
26402655
"$(PROJECT_DIR)/Carthage/Build/iOS",
26412656
);
2657+
GCC_PREPROCESSOR_DEFINITIONS = (
2658+
"$(inherited)",
2659+
"WEB_AUTH_PLATFORM=1",
2660+
);
26422661
INFOPLIST_FILE = Auth0Tests/Info.plist;
2643-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
2662+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
26442663
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
26452664
OTHER_SWIFT_FLAGS = "";
26462665
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.Auth0Tests;
@@ -2666,8 +2685,9 @@
26662685
"$(inherited)",
26672686
"$(PROJECT_DIR)/Carthage/Build/iOS",
26682687
);
2688+
GCC_PREPROCESSOR_DEFINITIONS = "WEB_AUTH_PLATFORM=1";
26692689
INFOPLIST_FILE = Auth0Tests/Info.plist;
2670-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
2690+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
26712691
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
26722692
OTHER_SWIFT_FLAGS = "";
26732693
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.Auth0Tests;
@@ -2692,9 +2712,13 @@
26922712
"$(inherited)",
26932713
"$(PROJECT_DIR)/Carthage/Build/Mac",
26942714
);
2715+
GCC_PREPROCESSOR_DEFINITIONS = (
2716+
"$(inherited)",
2717+
"WEB_AUTH_PLATFORM=1",
2718+
);
26952719
INFOPLIST_FILE = Auth0Tests/Info.plist;
26962720
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
2697-
MACOSX_DEPLOYMENT_TARGET = 10.12;
2721+
MACOSX_DEPLOYMENT_TARGET = 10.11;
26982722
OTHER_SWIFT_FLAGS = "";
26992723
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.Auth0Tests;
27002724
PRODUCT_NAME = Auth0Tests;
@@ -2720,9 +2744,10 @@
27202744
"$(inherited)",
27212745
"$(PROJECT_DIR)/Carthage/Build/Mac",
27222746
);
2747+
GCC_PREPROCESSOR_DEFINITIONS = "WEB_AUTH_PLATFORM=1";
27232748
INFOPLIST_FILE = Auth0Tests/Info.plist;
27242749
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
2725-
MACOSX_DEPLOYMENT_TARGET = 10.12;
2750+
MACOSX_DEPLOYMENT_TARGET = 10.11;
27262751
OTHER_SWIFT_FLAGS = "";
27272752
PRODUCT_BUNDLE_IDENTIFIER = com.auth0.Auth0Tests;
27282753
PRODUCT_NAME = Auth0Tests;
@@ -2868,7 +2893,7 @@
28682893
SWIFT_VERSION = 5.0;
28692894
TARGETED_DEVICE_FAMILY = "1,2,3";
28702895
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2TV.app/OAuth2TV";
2871-
TVOS_DEPLOYMENT_TARGET = 10.0;
2896+
TVOS_DEPLOYMENT_TARGET = 9.0;
28722897
};
28732898
name = Debug;
28742899
};
@@ -2892,7 +2917,7 @@
28922917
SWIFT_VERSION = 5.0;
28932918
TARGETED_DEVICE_FAMILY = "1,2,3";
28942919
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OAuth2TV.app/OAuth2TV";
2895-
TVOS_DEPLOYMENT_TARGET = 10.0;
2920+
TVOS_DEPLOYMENT_TARGET = 9.0;
28962921
};
28972922
name = Release;
28982923
};
@@ -2910,6 +2935,10 @@
29102935
"$(inherited)",
29112936
"$(PROJECT_DIR)/Carthage/Build/iOS",
29122937
);
2938+
GCC_PREPROCESSOR_DEFINITIONS = (
2939+
"$(inherited)",
2940+
"WEB_AUTH_PLATFORM=1",
2941+
);
29132942
INFOPLIST_FILE = App/Info.plist;
29142943
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
29152944
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -2935,6 +2964,7 @@
29352964
"$(inherited)",
29362965
"$(PROJECT_DIR)/Carthage/Build/iOS",
29372966
);
2967+
GCC_PREPROCESSOR_DEFINITIONS = "WEB_AUTH_PLATFORM=1";
29382968
INFOPLIST_FILE = App/Info.plist;
29392969
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
29402970
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

Auth0/A0SimpleKeychain+RSAPublicKey.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
2324
import Foundation
2425
import SimpleKeychain
2526

@@ -38,3 +39,4 @@ extension A0SimpleKeychain {
3839
return result == errSecSuccess
3940
}
4041
}
42+
#endif

Auth0/Array+Encode.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
2324
import Foundation
2425

2526
extension Array where Element == UInt8 {
@@ -38,3 +39,4 @@ extension Array where Element == UInt8 {
3839
return encodedBytes
3940
}
4041
}
42+
#endif

Auth0/Auth0.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FOUNDATION_EXPORT const unsigned char Auth0VersionString[];
3030

3131
// In this header, you should import all the public headers of your framework using statements like #import <Auth0/PublicHeader.h>
3232

33-
#if TARGET_OS_IOS || TARGET_OS_OSX
33+
#if WEB_AUTH_PLATFORM
3434
#import <Auth0/A0ChallengeGenerator.h>
3535
#import <Auth0/A0SHA.h>
3636
#import <Auth0/A0RSA.h>

Auth0/AuthCancelable.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
2324
/**
2425
Represents a cancelable Auth operation with an Identity Provider (Auth0 or a third party).
2526
*/
@@ -31,3 +32,4 @@ public protocol AuthCancelable {
3132
func cancel()
3233

3334
}
35+
#endif

Auth0/AuthProvider.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
2324
/**
2425
The AuthProvider protocol is adopted by objects that are to be used as Native Authentication
2526
handlers. An object implementing this protocol is intended to supersede the default authentication
@@ -53,3 +54,4 @@ public protocol AuthProvider {
5354
*/
5455
static func isAvailable() -> Bool
5556
}
57+
#endif

Auth0/AuthSession.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
2324
protocol AuthSession {
2425

2526
func start() -> Bool
2627
func cancel()
2728

2829
}
30+
#endif

Auth0/AuthTransaction.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
2324
/**
2425
Represents an ongoing Auth transaction with an Identity Provider (Auth0 or a third party).
2526

@@ -35,3 +36,4 @@ public protocol AuthTransaction: AuthResumable, AuthCancelable {
3536
var state: String? { get }
3637

3738
}
39+
#endif

Auth0/AuthenticationServicesSession.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23-
#if canImport(AuthenticationServices)
23+
#if WEB_AUTH_PLATFORM && canImport(AuthenticationServices)
2424
import AuthenticationServices
2525

2626
@available(iOS 12.0, macOS 10.15, *)

Auth0/AuthenticationServicesSessionCallback.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23-
#if canImport(AuthenticationServices)
23+
#if WEB_AUTH_PLATFORM && canImport(AuthenticationServices)
2424
import AuthenticationServices
2525

2626
@available(iOS 12.0, macOS 10.15, *)

Auth0/BaseAuthTransaction.swift

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
24+
import Foundation
25+
2326
class BaseAuthTransaction: NSObject, AuthTransaction {
2427

2528
typealias FinishTransaction = (Result<Credentials>) -> Void
@@ -69,3 +72,4 @@ class BaseAuthTransaction: NSObject, AuthTransaction {
6972
}
7073

7174
}
75+
#endif

Auth0/BaseWebAuth.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222

23+
#if WEB_AUTH_PLATFORM
2324
#if canImport(AuthenticationServices)
2425
import AuthenticationServices
2526
#endif
@@ -290,3 +291,4 @@ extension Auth0Authentication {
290291
}
291292

292293
}
294+
#endif

0 commit comments

Comments
 (0)