Skip to content

Commit

Permalink
Merge pull request #14 from MFB-Technologies-Inc/feature/v20.1.0
Browse files Browse the repository at this point in the history
Feature/v20.1.0
  • Loading branch information
r-jarvis committed Sep 19, 2024
2 parents 100ff16 + 3b706ed commit 96f0a00
Show file tree
Hide file tree
Showing 96 changed files with 1,479 additions and 1,257 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// swift-tools-version:5.5
// swift-tools-version:6.0

import PackageDescription

let package = Package(
name: "intune-ios-sdk",
platforms: [
.iOS(.v15),
.iOS(.v16),
],
products: [
.library(name: "IntuneMAMSwift", targets: ["IntuneMAMSwift"]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if 0
#elif defined(__arm64__) && __arm64__
// Generated by Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
// Generated by Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
#ifndef INTUNEMAMSWIFT_SWIFT_H
#define INTUNEMAMSWIFT_SWIFT_H
#pragma clang diagnostic push
Expand Down Expand Up @@ -42,6 +42,8 @@
#include <string.h>
#endif
#if defined(__cplusplus)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module"
#if defined(__arm64e__) && __has_include(<ptrauth.h>)
# include <ptrauth.h>
#else
Expand All @@ -55,6 +57,7 @@
# endif
#pragma clang diagnostic pop
#endif
#pragma clang diagnostic pop
#endif

#if !defined(SWIFT_TYPEDEFS)
Expand Down Expand Up @@ -288,6 +291,7 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wnullability"
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"

#if __has_attribute(external_source_symbol)
# pragma push_macro("any")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ __attribute__((visibility("default")))

+ (IntuneMAMAppConfigManager*_Nonnull) instance;

// Returns an object that can be used to retrieve Application Configuration
// settings sent from the MAM service/MDM channel for the specified identity.
// Note: For any MDM settings to be returned the given identity must be the identity of the MDM enrolled user
-(id <IntuneMAMAppConfig> _Nonnull) appConfigForIdentity:(NSString*_Nullable)identity DEPRECATED_MSG_ATTRIBUTE("Use appConfigForAccountId: instead.");

// Returns an object that can be used to retrieve Application Configuration
// settings sent from the MAM service/MDM channel for the specified Entra object ID.
// Note: For any MDM settings to be returned the given AccountId (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822) must be the AccountId of the MDM enrolled user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,19 @@ __attribute__((visibility("default")))

+(IntuneMAMCertificatePinningManager* _Nonnull) instance;

// Validates the certificate chain for the specified NSURLAuthenticationChallenge. Returns TRUE if the certificate chain matches the
// expected one for the host and identity or if no pins are provided for the host or identity. If FALSE is returned, the
// certificate chain does not match the expected chain and the application should block the request. If nil is passed in for the
// identity, the current thread identity is used to perform the certificate pinning validation.
- (BOOL) validateChainWithChallenge:(NSURLAuthenticationChallenge* _Nonnull)challenge andIdentity:(NSString* _Nullable)identity error:(NSError* _Nullable* _Nullable)error DEPRECATED_MSG_ATTRIBUTE("Use validateChainWithChallenge:andAccountId:error: instead.");

// Validates the certificate chain for the specified NSURLAuthenticationChallenge. Returns TRUE if the certificate chain matches the
// expected one for the host and Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822) or if no pins are provided for the host or Entra object ID. If FALSE is returned, the
// certificate chain does not match the expected chain and the application should block the request. If nil is passed in for the
// AccountId, the current thread identity is used to perform the certificate pinning validation.
- (BOOL) validateChainWithChallenge:(NSURLAuthenticationChallenge* _Nonnull)challenge andAccountId:(NSString* _Nullable)accountId error:(NSError* _Nullable* _Nullable)error;

// Validates the certificate chain for the specified cert chain and host. Returns TRUE if the certificate chain matches an expected
// one for the host and identity or if no pins are provided for the host or identity. If FALSE is returned, the certificate
// chain does not match the expected chain and the application should block the request. The certificate array should include the server
// certificate (at index 0) followed by intermediate certificates and lastly with the root certificate (at index -1).
// If nil is passed in for the identity, the current thread identity is used to perform the certificate pinning validation.
- (BOOL) validateChainWithCertificates:(NSArray<NSData*>* _Nonnull)certificates andHostname:(NSString* _Nonnull)hostname andIdentity:(NSString* _Nullable)identity error:(NSError* _Nullable* _Nullable)error DEPRECATED_MSG_ATTRIBUTE("Use validateChainWithCertificates:andHostname:andAccountId:error: instead.");

// Validates the certificate chain for the specified cert chain and host. Returns TRUE if the certificate chain matches an expected
// one for the host and Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822) or if no pins are provided for the host or Entra object ID. If FALSE is returned, the certificate
// chain does not match the expected chain and the application should block the request. The certificate array should include the server
// certificate (at index 0) followed by intermediate certificates and lastly with the root certificate (at index -1).
// If nil is passed in for the AccountId, the current thread identity is used to perform the certificate pinning validation.
- (BOOL) validateChainWithCertificates:(NSArray<NSData*>* _Nonnull)certificates andHostname:(NSString* _Nonnull)hostname andAccountId:(NSString* _Nullable)accountId error:(NSError* _Nullable* _Nullable)error;

// Shows an alert displaying an error message to the user for certificate pinning validation, indicating that the requested endpoint was blocked. If nil is passed in for the identity, the current thread identity is used. Call this method instead when the certificate validation APIs return false.
- (void) showErrorMessageForIdentity:(NSString* _Nullable)identity withDismissHanlder:(void(^_Nullable)(void))dismissHandler DEPRECATED_MSG_ATTRIBUTE("Use showErrorMessageForAccountId:withDismissHandler: instead.");

// Shows an alert displaying an error message to the user with Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822) for certificate pinning validation, indicating that the requested endpoint was blocked. If nil is passed in for the AccountId, the current thread identity is used. Call this method instead when the certificate validation APIs return false.
- (void) showErrorMessageForAccountId:(NSString* _Nullable)accountId withDismissHandler:(void(^_Nullable)(void))dismissHandler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@ typedef NS_ENUM(NSUInteger, IntuneMAMComplianceStatus)
__attribute__((visibility("default")))
@protocol IntuneMAMComplianceDelegate <NSObject>

/**
* This method is called when the Intune SDK has completed compliance remediation for an identity.
* If the identity has not been added to the app and is compliant, it should be added at this time.
* All values of IntuneMAMComplianceStatus will populate the error parameter with a localized error string.
* This method is guarenteed to be called after application:willFinishLaunchingWithOptions:
*
* @warning Delegate methods are not guarenteed to be called on the Main thread.
*
* @param identity The UPN of the identity for which compliance remediation was requested
* @param status The compliance status of identity
* @param errMsg A localized string describing the error encountered if the identity is not compliant.
* @param errTitle A localized title string for the error encountered if the identity is not compliant.
*/
- (void) identity:(NSString*_Nonnull) identity hasComplianceStatus:(IntuneMAMComplianceStatus) status withErrorMessage:(NSString*_Nonnull) errMsg andErrorTitle:(NSString*_Nonnull) errTitle DEPRECATED_MSG_ATTRIBUTE("Use accountId:hasComplianceStatus:withErrorMessage:andErrorTitle: instead.");

@optional
/**
* This method is called when the Intune SDK has completed compliance remediation for an identity.
* If the identity has not been added to the app and is compliant, it should be added at this time.
Expand Down Expand Up @@ -77,15 +61,6 @@ __attribute__((visibility("default")))
* In this case, the Intune SDK will take UI control at next application launch and call the delegate method identity:hasComplianceStatus:withErrorString: when finished
* If the app knows this is a first time login for identity, it's recomended to set silent to NO as this will likely cause a restart
*
* @param identity The UPN of the identity sending the request
* @param silent A bool indicating whether or not the Intune SDK will take UI control for the duration of the this method
*/
- (void) remediateComplianceForIdentity:(NSString*_Nonnull) identity silent:(BOOL) silent DEPRECATED_MSG_ATTRIBUTE("Use remediateComplianceForAccountId:silent: instead.");

// Returns TRUE if a compliance remediation is in progress for the specified user.
- (BOOL) remediationInProgressForIdentity:(NSString*_Nonnull) identity DEPRECATED_MSG_ATTRIBUTE("Use remediationInProgressForAccountId: instead.");

/**
* @param accountId The The Entra object ID of the identity sending the request (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
* @param silent A bool indicating whether or not the Intune SDK will take UI control for the duration of the this method
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ __attribute__((visibility("default")))

@required

// UPN of the data's owner (e.g. [email protected])
@property (readonly,nullable) NSString* identity DEPRECATED_MSG_ATTRIBUTE("Use accountId instead.");
// Entra object ID of the data owner (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
@property (readonly,nullable) NSString* accountId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,37 +37,19 @@ __attribute__((visibility("default")))

+ (IntuneMAMDataProtectionManager*_Nonnull) instance;

// Protects the buffer using the policy associated with the specified identity.
// Returns nil if an error occurs.
- (NSData*_Nullable) protect:(NSData*_Nonnull)data identity:(NSString*_Nonnull)identity DEPRECATED_MSG_ATTRIBUTE("Use protect:accountId: instead.");

// Protects the buffer using the policy associated with the specified Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
// Returns nil if an error occurs.
- (NSData*_Nullable) protect:(NSData*_Nonnull)data accountId:(NSString*_Nonnull)accountId;

// Protects the buffer using the policy associated with the specified identity.
// Populates an NSError object and returns nil if an error occurs.
- (NSData*_Nullable) protect:(NSData*_Nonnull)data identity:(NSString*_Nonnull)identity withError:(NSError * _Nullable * _Nullable)error DEPRECATED_MSG_ATTRIBUTE("Use protect:accountId:withError: instead.");

// Protects the buffer using the policy associated with the specified Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
// Populates an NSError object and returns nil if an error occurs.
- (NSData*_Nullable) protect:(NSData*_Nonnull)data accountId:(NSString*_Nonnull)accountId withError:(NSError * _Nullable * _Nullable)error;

// Protects the string using the policy associated with the specified identity.
// Returns a base64 encoded encrypted buffer.
// Returns nil if an error occurs.
- (NSString*_Nullable) protectString:(NSString*_Nonnull)string identity:(NSString*_Nonnull)identity DEPRECATED_MSG_ATTRIBUTE("Use protectString:accountId: instead.");

// Protects the string using the policy associated with the specified Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
// Returns a base64 encoded encrypted buffer.
// Returns nil if an error occurs.
- (NSString*_Nullable) protectString:(NSString*_Nonnull)string accountId:(NSString*_Nonnull)accountId;

// Protects the string using the policy associated with the specified identity.
// Returns a base64 encoded encrypted buffer.
// Populates an NSError object and returns nil if an error occurs.
- (NSString*_Nullable) protectString:(NSString*_Nonnull)string identity:(NSString*_Nonnull)identity withError:(NSError * _Nullable * _Nullable)error DEPRECATED_MSG_ATTRIBUTE("Use protectString:accountId:withError: instead.");

// Protects the string using the policy associated with the specified Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
// Returns a base64 encoded encrypted buffer.
// Populates an NSError object and returns nil if an error occurs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,6 @@ __attribute__((visibility("default")))
*/
- (id _Nonnull) init __attribute__((unavailable("Must use + (IntuneMAMEnrollmentManager*) instance")));

/**
* This method will add the account to the list of registered accounts.
* An enrollment request will immediately be started. If the enrollment
* is not successful, the SDK will periodically re-try the enrollment every
* 24 hours.
* If the application has already registered an account using this API, and calls
* it again, the SDK will ignore the request and output a warning.
* Any SDK API that requires enrollment will not be valid until after
* enrollment succeeds, for example AppConfig policy is not delivered until
* after an enrollment. Use the IntuneMAMEnrollmentDelegate to determine
* if the SDK has successfully enrolled and received policy.
*
* @note Do not use this in an extension. If you do so, we will return
* IntuneMAMEnrollmentStatusUnsupportedAPI in the IntuneMAMEnrollmentDelegate.
*
* @param identity The UPN of the account to be registered with the SDK
*/
- (void)registerAndEnrollAccount:(NSString *_Nonnull)identity DEPRECATED_MSG_ATTRIBUTE("Use registerAndEnrollAccountId: instead.");

/**
* This method will add the account to the list of registered accounts.
* An enrollment request will immediately be started. If the enrollment
Expand Down Expand Up @@ -103,23 +84,6 @@ __attribute__((visibility("default")))
#if TARGET_OS_IPHONE
- (void)loginAndEnrollAccount:(NSString *_Nullable)identity onWindow:(UIWindow *_Nullable)window;
#endif
/**
* This method will remove the provided account from the list of
* registered accounts. Once removed, if the account has enrolled
* the application, the account will be un-enrolled.
*
* @note In the case where an un-enroll is initiated, this method will block
* until the MAM token is acquired, then return. This method must be called before
* the user is removed from the application (so that required AAD tokens are not purged
* before this method is called).
*
* @note Do not use this in an extension. If you do so, we will return
* IntuneMAMEnrollmentStatusUnsupportedAPI in the IntuneMAMEnrollmentDelegate.
*
* @param identity The UPN of the account to be removed.
* @param doWipe If YES, a selective wipe if the account is un-enrolled
*/
- (void)deRegisterAndUnenrollAccount:(NSString *_Nonnull)identity withWipe:(BOOL)doWipe DEPRECATED_MSG_ATTRIBUTE("Use deRegisterAndUnenrollAccountId:withWipe: instead.");

/**
* This method will remove the provided account from the list of
Expand All @@ -139,29 +103,13 @@ __attribute__((visibility("default")))
*/
- (void)deRegisterAndUnenrollAccountId:(NSString *_Nonnull)accountId withWipe:(BOOL)doWipe;

/**
* Returns a list of UPNs of account currently registered with the SDK.
*
* @return Array containing UPNs of registered accounts
*/
- (NSArray *_Nonnull)registeredAccounts DEPRECATED_MSG_ATTRIBUTE("Use registeredAccountIds instead.");

/**
* Returns a list of UPNs of account currently registered with the SDK.
*
* @return Array containing Entra object IDs of registered accounts
*/
- (NSArray *_Nonnull)registeredAccountIds;

/**
* Returns the UPN of the currently enrolled user. Returns
* nil if the application is not currently enrolled.
* Should be called only by applications which don't support multiple managed accounts.
*
* @return UPN of the enrolled account
*/
- (NSString *_Nullable)enrolledAccount DEPRECATED_MSG_ATTRIBUTE("Use enrolledAccountId instead.");

/**
* Returns the Entra object ID of the currently enrolled user. Returns
* nil if the application is not currently enrolled.
Expand Down Expand Up @@ -204,24 +152,6 @@ __attribute__((visibility("default")))
*/
- (NSArray *_Nullable)allowedAccountIds;

/**
* Returns the UPN of the MDM enrolled user. Returns nil if the device is not MDM enrolled.
* For 3rd party applications, the application must also be managed and have IntuneMAMUPN
* set to the MDM enrolled user in managed app config.
*
* @return UPN of the MDM enrolled account
*/
- (NSString *_Nullable)mdmEnrolledAccount __attribute__((deprecated ("Use mdmEnrolledAccountIdWithCompletion instead.")));

/**
* Returns the Entra object ID of the MDM enrolled user. Returns nil if the device is not MDM enrolled.
* For 3rd party applications, the application must also be managed and have IntuneMAMOID
* set to the MDM enrolled user in managed app config.
*
* @return Entra object ID of the MDM enrolled account (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
*/
- (NSString *_Nullable)mdmEnrolledAccountId __attribute__((deprecated ("Use mdmEnrolledAccountIdWithCompletion instead.")));

/**
* Asynchronously returns the Entra object ID of the MDM enrolled user. Returns nil if the device is not MDM enrolled.
* For 3rd party applications, the application must also be managed and have IntuneMAMOID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,11 @@ __attribute__((visibility("default")))
+ (instancetype _Nullable) openFileAtPath:(NSString* _Nonnull)path error:(NSError* _Nullable* _Nullable)error;
+ (instancetype _Nullable) openFileAtPath:(NSString* _Nonnull)path flags:(int)flags error:(NSError* _Nullable* _Nullable)error;

// Creates a new file or truncates an existing file for the specified owner. If encryption is required by policy,
// the file contents will be software encrypted on disk. The flags/mode parameters are the same as the flags passed to POSIX open().
+ (instancetype _Nullable) createFileAtPath:(NSString* _Nonnull)path forIdentity:(NSString* _Nullable)identity error:(NSError* _Nullable* _Nullable)error DEPRECATED_MSG_ATTRIBUTE("Use createFileAtPath:forAccountId:error: instead.");
+ (instancetype _Nullable) createFileAtPath:(NSString* _Nonnull)path flags:(int)flags mode:(mode_t)mode forIdentity:(NSString* _Nullable)identity error:(NSError* _Nullable* _Nullable)error DEPRECATED_MSG_ATTRIBUTE("Use createFileAtPath:flags:mode:forAccountId:error: instead.");

// Creates a new file or truncates an existing file for the specified owner Entra object ID(e.g. 3ec2c00f-b125-4519-acf0-302ac3761822). If encryption is required by policy,
// the file contents will be software encrypted on disk. The flags/mode parameters are the same as the flags passed to POSIX open().
+ (instancetype _Nullable) createFileAtPath:(NSString* _Nonnull)path forAccountId:(NSString* _Nullable)acountId error:(NSError* _Nullable* _Nullable)error;
+ (instancetype _Nullable) createFileAtPath:(NSString* _Nonnull)path flags:(int)flags mode:(mode_t)mode forAccountId:(NSString* _Nullable)acountId error:(NSError* _Nullable* _Nullable)error;

// Protects the file for the specified identity. The file will be software encrypted if required by policy.
// If called on an encrypted file and the policy or identity changes to no longer require software
// encryption, the file will be decrypted.
+ (BOOL) protectFileAtPath:(NSString* _Nonnull)path forIdentity:(NSString* _Nullable)identity error:(NSError* _Nullable* _Nullable)error DEPRECATED_MSG_ATTRIBUTE("Use protectFileAtPath:forAccountId:error: instead.");

// Protects the file for the specified identity. The file will be software encrypted if required by policy.
// If called on an encrypted file and the policy or Entra object ID (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822) changes to no longer require software
// encryption, the file will be decrypted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ __attribute__((visibility("default")))

@required

// The UPN of file's owner (e.g. [email protected])
@property (readonly,nullable) NSString* identity DEPRECATED_MSG_ATTRIBUTE("Use accountId instead.");
// The Entra object ID of the file's owner (e.g. 3ec2c00f-b125-4519-acf0-302ac3761822).
@property (readonly,nullable) NSString* accountId;

Expand Down
Loading

0 comments on commit 96f0a00

Please sign in to comment.