diff --git a/CHANGELOG.md b/CHANGELOG.md index c13ac0e..9295853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.0.1] - 2020-01 +## [1.1.0] - 2021-01 +### Added +- The compiled framework now includes simulator code for simulators running on Macs with Apple silicon. +- Added a `Package.swift` file for integration with Swift Package Manager. + +### Changed +- The compiled framework is now an XCFramework to allow easy integration with Xcode 12 projects. + +### Fixed +- Fixed an issue that caused two `certificate(request:error:)` calls to be made to the delegate if the SDK could not reach Jamf Pro to request a new AppConfig. + +## [1.0.1] - 2020-02-11 ### Added - This CHANGELOG.md file. diff --git a/Certificate SDK Sample App.xcodeproj/project.pbxproj b/Certificate SDK Sample App.xcodeproj/project.pbxproj index f10a4ca..b553da7 100644 --- a/Certificate SDK Sample App.xcodeproj/project.pbxproj +++ b/Certificate SDK Sample App.xcodeproj/project.pbxproj @@ -3,12 +3,12 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ - 9797329420B37D7000CF87D8 /* CertificateSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9797329320B37D7000CF87D8 /* CertificateSDK.framework */; }; - 9797329520B37D7000CF87D8 /* CertificateSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9797329320B37D7000CF87D8 /* CertificateSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 972DA469258D542E00ABD6A3 /* CertificateSDK.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 972DA467258D53C900ABD6A3 /* CertificateSDK.xcframework */; }; + 972DA46A258D542E00ABD6A3 /* CertificateSDK.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 972DA467258D53C900ABD6A3 /* CertificateSDK.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 97BE793320AB6FF3009579E5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97BE793220AB6FF3009579E5 /* AppDelegate.swift */; }; 97BE793520AB6FF3009579E5 /* SetupTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97BE793420AB6FF3009579E5 /* SetupTestViewController.swift */; }; 97BE793720AB6FF3009579E5 /* ActionLogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97BE793620AB6FF3009579E5 /* ActionLogViewController.swift */; }; @@ -29,7 +29,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 9797329520B37D7000CF87D8 /* CertificateSDK.framework in Embed Frameworks */, + 972DA46A258D542E00ABD6A3 /* CertificateSDK.xcframework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -38,7 +38,7 @@ /* Begin PBXFileReference section */ 9712A85B213EED15003A2789 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = ""; }; - 9797329320B37D7000CF87D8 /* CertificateSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CertificateSDK.framework; sourceTree = ""; }; + 972DA467258D53C900ABD6A3 /* CertificateSDK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = CertificateSDK.xcframework; sourceTree = ""; }; 97BE792F20AB6FF3009579E5 /* Certificate SDK Sample App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Certificate SDK Sample App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 97BE793220AB6FF3009579E5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 97BE793420AB6FF3009579E5 /* SetupTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupTestViewController.swift; sourceTree = ""; }; @@ -59,7 +59,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9797329420B37D7000CF87D8 /* CertificateSDK.framework in Frameworks */, + 972DA469258D542E00ABD6A3 /* CertificateSDK.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -71,7 +71,7 @@ children = ( 9712A85B213EED15003A2789 /* .swiftlint.yml */, 97BE793120AB6FF3009579E5 /* Certificate SDK Sample App */, - 9797329320B37D7000CF87D8 /* CertificateSDK.framework */, + 972DA467258D53C900ABD6A3 /* CertificateSDK.xcframework */, 97BE793020AB6FF3009579E5 /* Products */, ); sourceTree = ""; @@ -132,7 +132,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0930; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1220; ORGANIZATIONNAME = Jamf; TargetAttributes = { 97BE792E20AB6FF3009579E5 = { @@ -191,7 +191,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -258,6 +258,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -318,6 +319,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -351,10 +353,6 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); INFOPLIST_FILE = "Certificate SDK Sample App/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -362,7 +360,6 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.jamf.certificate-sdk.sample"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/CertificateSDK.framework/Headers/CertificateSDK.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -373,10 +370,6 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)", - ); INFOPLIST_FILE = "Certificate SDK Sample App/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -384,7 +377,6 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.jamf.certificate-sdk.sample"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/CertificateSDK.framework/Headers/CertificateSDK.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/Certificate SDK Sample App/CertificateRequestManager.swift b/Certificate SDK Sample App/CertificateRequestManager.swift index 6205353..f73b4a5 100644 --- a/Certificate SDK Sample App/CertificateRequestManager.swift +++ b/Certificate SDK Sample App/CertificateRequestManager.swift @@ -6,6 +6,7 @@ // Copyright © 2019 Jamf. All rights reserved. // +import CertificateSDK import UIKit class CertificateRequestManager: NSObject { diff --git a/CertificateSDK.framework/CertificateSDK b/CertificateSDK.framework/CertificateSDK deleted file mode 100755 index 322be16..0000000 Binary files a/CertificateSDK.framework/CertificateSDK and /dev/null differ diff --git a/CertificateSDK.framework/ios-strip-framework.sh b/CertificateSDK.framework/ios-strip-framework.sh deleted file mode 100644 index 2f03318..0000000 --- a/CertificateSDK.framework/ios-strip-framework.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -FRAMEWORK=$1 -echo "Trimming $FRAMEWORK..." -FRAMEWORK_EXECUTABLE_PATH="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$FRAMEWORK.framework/$FRAMEWORK" -EXTRACTED_ARCHS=() -for ARCH in $ARCHS -do - echo "Extracting $ARCH..." - lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH" - EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH") -done -echo "Merging binaries..." -lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}" -rm "${EXTRACTED_ARCHS[@]}" -rm "$FRAMEWORK_EXECUTABLE_PATH" -mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH" -echo "Done." diff --git a/CertificateSDK.xcframework/Info.plist b/CertificateSDK.xcframework/Info.plist new file mode 100644 index 0000000..df4130e --- /dev/null +++ b/CertificateSDK.xcframework/Info.plist @@ -0,0 +1,42 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64_i386_x86_64-simulator + LibraryPath + CertificateSDK.framework + SupportedArchitectures + + arm64 + i386 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + LibraryIdentifier + ios-arm64_armv7 + LibraryPath + CertificateSDK.framework + SupportedArchitectures + + arm64 + armv7 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/CertificateSDK b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/CertificateSDK new file mode 100755 index 0000000..849b588 Binary files /dev/null and b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/CertificateSDK differ diff --git a/CertificateSDK.framework/Headers/CertificateRequestBase.h b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestBase.h similarity index 100% rename from CertificateSDK.framework/Headers/CertificateRequestBase.h rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestBase.h diff --git a/CertificateSDK.framework/Headers/CertificateRequestDelegate.h b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestDelegate.h similarity index 100% rename from CertificateSDK.framework/Headers/CertificateRequestDelegate.h rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestDelegate.h diff --git a/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h similarity index 100% rename from CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h diff --git a/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h similarity index 100% rename from CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h diff --git a/CertificateSDK.framework/Headers/CertificateRequestProtocol.h b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestProtocol.h similarity index 100% rename from CertificateSDK.framework/Headers/CertificateRequestProtocol.h rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestProtocol.h diff --git a/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h similarity index 100% rename from CertificateSDK.framework/Headers/CertificateRequestWorkflow.h rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h diff --git a/CertificateSDK.framework/Headers/CertificateSDK.h b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateSDK.h similarity index 100% rename from CertificateSDK.framework/Headers/CertificateSDK.h rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Headers/CertificateSDK.h diff --git a/CertificateSDK.framework/Info.plist b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Info.plist similarity index 56% rename from CertificateSDK.framework/Info.plist rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Info.plist index 25e853a..efd54e1 100644 Binary files a/CertificateSDK.framework/Info.plist and b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Info.plist differ diff --git a/CertificateSDK.framework/Modules/module.modulemap b/CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Modules/module.modulemap similarity index 100% rename from CertificateSDK.framework/Modules/module.modulemap rename to CertificateSDK.xcframework/ios-arm64_armv7/CertificateSDK.framework/Modules/module.modulemap diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/CertificateSDK b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/CertificateSDK new file mode 100755 index 0000000..fbb024a Binary files /dev/null and b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/CertificateSDK differ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestBase.h b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestBase.h new file mode 100644 index 0000000..217b488 --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestBase.h @@ -0,0 +1,68 @@ +/* + CertificateRequestBase.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef CertificateRequestBase_h +#define CertificateRequestBase_h + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + This class is the base class for all CertificateRequestProtocol objects. + Subclasses will have a concrete implementation of requesting certificates. + */ +NS_CLASS_AVAILABLE_IOS(10_0) +@interface CertificateRequestBase : NSObject + +/** + The object that will be called back with progress, errors, and completion. + */ +@property (weak, readonly) id delegate; + +/** + This is the maximum number of steps in the progress of a certificate request. + May be approximate until the actual call of -startNewCertificateRequest + */ +@property (assign, readonly) NSUInteger maxNumberOfSteps; + +/** + Create an object. + + @param delegate Your delegate that will be called as the certificate request workflow proceeds + @return An initialized object; may be nil if memory is full + */ +- (nullable instancetype)initWithDelegate:(id)delegate NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* CertificateRequestBase_h */ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestDelegate.h b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestDelegate.h new file mode 100644 index 0000000..620d4dd --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestDelegate.h @@ -0,0 +1,97 @@ +/* + CertificateRequestDelegate.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef CertificateRequestDelegate_h +#define CertificateRequestDelegate_h + +NS_ASSUME_NONNULL_BEGIN + +@protocol CertificateRequestProtocol; + +/** + Third party apps should have a class that implements these methods for notification on progress, errors, and completion. + */ +@protocol CertificateRequestDelegate + +@required +/** + When any kind of error occurs in the process for requesting certificates, this delegate method will be called. + + @param request The object that initiated the request + @param error An error object + */ +- (void)certificateRequest:(id)request errorOccurred:(NSError *)error NS_SWIFT_NAME(certificate(request:error:)); + +@required +/** + When the request to Jamf Pro is completed, this method will be called. If there were errors, the identity will be nil. + + @param request The object that started the request. + @param identity An identity that encapsulates the info from the server. + */ +- (void)certificateRequest:(id)request completedWithIdentity:(nullable SecIdentityRef)identity +NS_SWIFT_NAME(certificate(request:completedWith:)); + +@optional +/** + As the steps are completed during the request to Jamf Pro, this method can be called. The current progress can be checked + against the request.maxNumberOfSteps to show progress percentage. + NOTE: Each step may take a different (unknown) amount of time as the actual request will be using network resources. + + @param request The object that started the request. + @param current The current progress + */ +- (void)certificateRequest:(id)request progress:(NSUInteger)current; + +@optional +/** + When the CertificateRequest SDK begins accessing the network and when it ends accessing the network, this method + is called if implemented. + + @param request The object that started the request. + @param isUsingNetwork Whether or not the request is currently using the network. + */ +- (void)certificateRequest:(id)request isUsingNetwork:(BOOL)isUsingNetwork; + + +@optional +/** + When the CertificateRequest SDK detects no settings in the Managed App Config key, or if the invitation in the + Managed App Config has expired this will be called to let you know that it is waiting for a new MAC to be delivered + from the Jamf Pro server. Will be called again when the MAC comes in; the timing on this can vary greatly. + + @param request The object that started the request. + @param waitingForMAC Whether or not the request is currently waiting for settings in the Managed App Config. + */ +- (void)certificateRequest:(id)request isWaitingForMAC:(BOOL)waitingForMAC; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* CertificateRequestDelegate_h */ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h new file mode 100644 index 0000000..8cdde57 --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h @@ -0,0 +1,67 @@ +/* + CertificateRequestEmbeddedP12.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef CertificateRequestEmbeddedP12_h +#define CertificateRequestEmbeddedP12_h + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + This class reads the certificate from an embedded p12 file, and can force errors for testing. + */ +NS_CLASS_AVAILABLE_IOS(10_0) +@interface CertificateRequestEmbeddedP12 : CertificateRequestBase + +/** + Create an object. + + @param delegate Your delegate that will be called as the certificate request workflow proceeds + @param p12URL A URL to a file with a .p12 certificate that will be returned + @param pwd The password for the .p12 file + @return An initialized object; may be nil if memory is full + */ +- (nullable instancetype)initWithDelegate:(id)delegate + p12File:(NSURL *)p12URL + p12Password:(NSString *)pwd; + +/** + Use this option to artificially delay the completion of each step. Each step up to maxNumberOfSteps will take this many seconds. + This allows you to test things that are hard to test otherwise, such as progress. + Defaults to zero (full speed). + */ +@property (assign) NSUInteger secondsBetweenSteps; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* CertificateRequestEmbeddedP12_h */ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h new file mode 100644 index 0000000..4dc9789 --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h @@ -0,0 +1,56 @@ +/* + CertificateRequestErrorDomain.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef CertificateErrorDomain_h +#define CertificateErrorDomain_h + +/** + The error domain specific to the Jamf Certificate SDK. + */ +extern NSString * const kCertificateRequestErrorDomain; + +/** + Errors specific to the Jamf Certificate SDK + + - kErrorBadInitializationParams: A CertificateRequestEmbeddedP12 object was initialized with bad parameters. + - kErrorCertificateMalformed: Unlikely to happen. The certificate coming from Jamf Pro has been mangled in transit. + - kErrorCertificateWrongAutomaticPassword: Unlikely to happen. Occurs when the .p12 from the server was encrypted with a different password than the SDK has chosen. + - kErrorIncorrectManagedAppConfigData: The Managed App Config info does not contain enough information to contact Jamf Pro. + - kErrorInvalidResponseFromJamfProServer: Unlikely to happen. The Jamf Pro server responded with info that the SDK does not understand. + - kErrorTestingP12LoadFailed: Unlikely to happen. When using the testing class CertificateRequestEmbeddedP12 this is a generic error that the p12 failed to load. + */ +NS_ERROR_ENUM(kCertificateRequestErrorDomain) { + kErrorBadInitializationParams = 1, + kErrorCertificateMalformed = 2, + kErrorCertificateWrongAutomaticPassword = 3, + kErrorIncorrectManagedAppConfigData = 4, + kErrorInvalidResponseFromJamfProServer = 5, + kErrorTestingP12LoadFailed = 6 +}; + +#endif /* CertificateErrorDomain_h */ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestProtocol.h b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestProtocol.h new file mode 100644 index 0000000..d82b998 --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestProtocol.h @@ -0,0 +1,63 @@ +/* + CertificateRequestProtocol.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef CertificateRequestProtocol_h +#define CertificateRequestProtocol_h + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + This is the protocol used for requesting and renewing certificates from Jamf Pro. + */ +@protocol CertificateRequestProtocol + +/** + This is the maximum number of steps in the progress of a certificate request. + May be approximate until the actual call of -startNewCertificateRequest + */ +@property (assign, readonly) NSUInteger maxNumberOfSteps; + +/** + This will start a request to the Jamf Pro server for a new certificate. + The delegate will be called with progress, errors, and the new identity. + NOTE: Only one such request should be in progress at a given time for a single CertificateRequest object. + */ +- (void)startNewCertificateRequest; + +/** + Cancels the current request, if any. The completion handler WILL be called on the delegate. + */ +- (void)cancelRequest; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* CertificateRequestProtocol_h */ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h new file mode 100644 index 0000000..0ca3d0d --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h @@ -0,0 +1,87 @@ +/* + CertificateRequestWorkflow.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifndef CertificateRequestWorkflow_h +#define CertificateRequestWorkflow_h + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + This class is the main class that should be instantiated to make a certificate request. + */ +NS_CLASS_AVAILABLE_IOS(10_0) +@interface CertificateRequestWorkflow : CertificateRequestBase + +/** + Create an object. + + @param delegate Your delegate that will be called as the certificate request workflow proceeds + @return An initialized object; may be nil if memory is full + */ +- (nullable instancetype)initWithDelegate:(id)delegate; + +/** + Create an object with given settings instead of relying on Managed App Config. This is a testing method. + + @param delegate Your delegate that will be called as the certificate request workflow proceeds + @param testSettings The settings that would otherwise be provided by Managed App Config. + @return An initialized object; may be nil if memory is full + */ +- (nullable instancetype)initWithDelegate:(id)delegate testSettings:(NSDictionary *)testSettings; + +/** + Use this option to specify a custom timeout in seconds for individual network requests. + Defaults to 30 seconds. + */ +@property (assign) NSUInteger networkingTimeout; + +/** + Use this option to specify a custom interval in seconds to poll for certificate creation. + The first retrieval will happen after this interval, which means this also specifies the minimum + amount of time required for the certificate request. Minimum value is one second. + Defaults to 5 seconds. + */ +@property (assign) NSUInteger pollingInterval; + +/** + Use this option to specify an overall timeout in seconds to poll for certificate creation. + After this much time, if the server has still not returned a certificate then the certificate request + will fail with a timeout error. + Defaults to 180 seconds. + */ +@property (assign) NSUInteger pollingTimeout; + +@end + +NS_ASSUME_NONNULL_END + +#endif /* CertificateRequestWorkflow_h */ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateSDK.h b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateSDK.h new file mode 100644 index 0000000..06dbb8f --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Headers/CertificateSDK.h @@ -0,0 +1,44 @@ +/* + CertificateSDK.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#import + +//! Project version number for CertificateSDK. +FOUNDATION_EXPORT double CertificateSDKVersionNumber; + +//! Project version string for CertificateSDK. +FOUNDATION_EXPORT const unsigned char CertificateSDKVersionString[]; + + +#import +#import +#import + +#import +#import +#import diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Info.plist b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Info.plist new file mode 100644 index 0000000..fa7ebe5 Binary files /dev/null and b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Info.plist differ diff --git a/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Modules/module.modulemap b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Modules/module.modulemap new file mode 100644 index 0000000..e61c38a --- /dev/null +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module CertificateSDK { + umbrella header "CertificateSDK.h" + + export * + module * { export * } +} diff --git a/CertificateSDK.framework/_CodeSignature/CodeResources b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/_CodeSignature/CodeResources similarity index 92% rename from CertificateSDK.framework/_CodeSignature/CodeResources rename to CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/_CodeSignature/CodeResources index addd299..689c334 100644 --- a/CertificateSDK.framework/_CodeSignature/CodeResources +++ b/CertificateSDK.xcframework/ios-arm64_i386_x86_64-simulator/CertificateSDK.framework/_CodeSignature/CodeResources @@ -34,16 +34,12 @@ Info.plist - gqYqAVcVLDt65oytZWWRd1VSvU4= + x0vydHDHo2HnbzWm6jQ3Y9y6Jjs= Modules/module.modulemap Okt3WKgLOeLqLPPyFALrePQEDQs= - ios-strip-framework.sh - - D/b1s3D5r7ky14btr01FXrFpTTU= - files2 @@ -135,17 +131,6 @@ +w/0sYILFq3Jg+dPEjILJ4+6ryCSvZYk+XFyMbQKzzM= - ios-strip-framework.sh - - hash - - D/b1s3D5r7ky14btr01FXrFpTTU= - - hash2 - - 3rMm1fv/Fls5z7uLWeQqttpRo+vRzRMD3DH2E7Ysxvg= - - rules diff --git a/Integrating the Jamf Certificate SDK into Your iOS App.pdf b/Integrating the Jamf Certificate SDK into Your iOS App.pdf index a88804a..78cb48f 100644 Binary files a/Integrating the Jamf Certificate SDK into Your iOS App.pdf and b/Integrating the Jamf Certificate SDK into Your iOS App.pdf differ diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..9ddf5d5 --- /dev/null +++ b/Package.swift @@ -0,0 +1,20 @@ +// swift-tools-version:5.3 +import PackageDescription + +let package = Package( + name: "CertificateSDK", + platforms: [ + .iOS(.v10) + ], + products: [ + .library( + name: "CertificateSDK", + targets: ["CertificateSDKPackage"]) + ], + targets: [ + .binaryTarget( + name: "CertificateSDKPackage", + path: "CertificateSDK.xcframework" + ) + ] +) diff --git a/README.md b/README.md index f4d7c81..4f9f53e 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,28 @@ ## Jamf Certificate SDK -###### Framework Architectures +-------- -The included framework ships with two simulator architectures (i386 and x86_64) and two device architectures -(armv7 and arm64). This allows third-party app developers to use the framework both in their own simulators -running on their development Macs, and on actual devices. +### Installation + +Jamf Certificate SDK is available through the [Swift Package Manager](https://swift.org/package-manager/). + +To install via the Swift Package Manager add the following line to your `Package.swift` file's `dependencies`: -When building the third-party app, only some of these architectures are going to be useful for an individual build of -the app. The framework includes a bash script that should run within an Xcode "Run Script" build phase to thin out -the framework of unused architectures. Look at the example app's Run Script build phase for a working example of -this. +```swift +.package(url: "https://github.com/jamf/CertificateSDK.git", from: "1.1.0") +``` -`bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/CertificateSDK.framework/ios-strip-framework.sh" CertificateSDK` +-------- + +#### Framework Architectures + +The included XCFramework ships with three simulator architectures (arm64, i386, and x86_64) and two device architectures +(armv7 and arm64). This allows third-party app developers to use the framework both in their own simulators +running on their development Macs (including Apple Silicon), and on actual devices. +-------- -#### Managed App Config Required Settings +### Managed App Config Required Settings To ensure proper use of the SDK, the iOS app is required to be distributed by Jamf Pro. During distribution, an App Configuration can be specified that will let the SDK communicate with Jamf Pro and request the proper certificate. Here is a sample App Configuration