Updates to the HID Approve SDK for Apple iOS
This page details the design changes made in the new HID® Approve™ SDK for Apple® iOS® .
Please refer to the code examples provided below that illustrate the code changes, as well as Add the SDK to Your App.
What's New in Version 5.7.1 from 5.5
SDK Updates
Migration to 5.7.1 from versions 3.0 and 4.0 is no longer supported.
SDK Additions and New Features
REMOVED deprecated method “retrieveTransaction”
NEW method “retrieveActionInfo”
- (id<HIDServerActionInfo>)retrieveActionInfo:(NSString*)actionId error:(NSError**)error;
REMOVED deprecated method “createContainer” (use createContainer with sessionPassword)
REMOVED deprecated method “reset” (use HIDDeviceFactory reset)
REMOVED deprecated method “getDefaultInitializationPolicy” (use HIDProgressListener)
DEPRECATED method "updateDeviceInfo" (use HIDContainer updateDeviceInfo)
REMOVED deprecated property “initialPassword” (use HIDProgressListener)
NEW enumeration value “HIDUnsupportedVersion” (7)
NEW enumeration value "HIDInvalidContainer" (8)
UPDATE class declaration inherits from class HIDServerAction
REMOVED deprecated method “setStatus” (use setStatus with password)
NEW method "updateDeviceInfo" (moved from HIDDevice)
(BOOL)updateDeviceInfo:(NSString*)propertyId withValue:(NSString*)propertyValue withPassword:(NSString*)sessionPassword withParams:(NSArray*)parameters error:(NSError**)error
DEPRECATED class TransactionInfo (use retrieveActionInfo)
NEW class ServerAction
NEW class ServerActionInfo
In order to support framework target integrations, the XCFramework package now includes a clang modulemap header.
To support Apple optimization technology aimed at reducing the application binary size, the SDK framework fully supports Bitcode. For further information, refer to the Apple documentation.
What's New in Version 5.5 from 5.4
SDK Updates
iOS versions 10.0 and 11.0 are no longer supported.
SDK Additions and New Features
NEW method “newInstance”
-(id<HIDDevice>)newInstance:(HIDConnectionConfiguration*)config error:(NSError**)error;
DEPRECATED method “newInstance”
-(id<HIDDevice>)newInstance:(HIDConnectionConfiguration*)config withSessionPassword:(NSString*)sessionPassword error:(NSError**)error;
NEW HID_PARAM_PASSWORD_PROGRESS_EVENT_TYPE; ///< password event type
NEW HID_PARAM_PASSWORD_PROGRESS_EVENT_KEY_LABEL; ///< password event key label
NEW HID_PARAM_PASSWORD_PROGRESS_EVENT_KEY_USAGE; ///< password event key usage
NEW HID_PARAM_PASSWORD_PROGRESS_EVENT_TYPE_CONTAINER; ///< password event type container
NEW HID_PARAM_PASSWORD_PROGRESS_EVENT_TYPE_KEY; ///< password event type key
Documentation has been updated to specify possible exceptions on some functions and methods.
NEW "HIDInvalidArgument" to replace thrown exception NSInvalidArgumentException in the SDK
SDK Additions and New Features
NEW enumeration value “HIDInvalidArgument" for HIDErrorCode
NEW enumeration value “HIDLockTypeSilent” for HIDLockType
NEW constant "HID_KEY_PROPERTY_USAGE_OPPRO"
What's New in Version 5.1 from 4.0
SDK Updates
HIDTransactionInfo
NEW method “getTransaction”
-(id<HIDTransaction>)getTransaction:(NSString*)sessionPassword withParams:(NSArray*)parameters error:(NSError**)error;
HIDTransaction
UPDATE protocol moved from “HIDDevice.h” header
HIDProgressListener
UPDATE protocol moved from “HIDDevice.h” header
UPDATE method “onEventReceived”
- (HIDEventResult*)onEventReceived:(id<HIDEvent>)event;
HIDProgressEvent
UPDATE protocol moved from “HIDDevice.h” header
NEW enumeration “HIDEventResultCode”
NEW interface “HIDPasswordPromptResult”
NEW protocol “HIDEvent”
HIDContainerInitialization
UPDATE interface moved from “HIDDevice.h” header
DEPRECATED field “initialPassword” (use ProgressListener)
HIDDevice
DEPRECATED method “retrieveTransaction” (use TransactionInfo.getTransaction)
-(id<HIDTransaction>)retrieveTransaction:(NSString*)transactionId withPassword:(NSString*)sessionPassword withParams:(NSArray*)parameters error:(NSError**)error;
DEPRECATED method “createContainer” (use new method)
-(id<HIDContainer>)createContainer:(HIDContainerInitialization*)config withListener:(NSObject<HIDProgressListener>*)listener error:(NSError**)error;
DEPRECATED method “reset” (use new method HIDDeviceFactory.reset)
- (BOOL)reset:(NSArray*)parameters error:(NSError**)error;
DEPRECATED method “getDefaultInitializationPolicy” (use ProgressListener)
- (id<HIDProtectionPolicy>)getDefaultInitializationPolicy:(NSError**)error;
NEW method “createContainer”
-(id<HIDContainer>)createContainer:(HIDContainerInitialization*)config withSessionPassword:(NSString*)sessionPassword withListener:(NSObject<HIDProgressListener>*)listener error:(NSError**)error;
HIDDeviceFactory
DEPRECATED method “newInstance” (use new method)
-(id<HIDDevice>)newInstance:(HIDConnectionConfiguration*)config error:(NSError**)error;
NEW method “newInstance”
-(id<HIDDevice>)newInstance:(HIDConnectionConfiguration*)config withSessionPassword:(NSString*)sessionPassword error:(NSError**)error;
NEW method “reset”
+(void)reset:error:(NSError**)error;
SDK Additions and New Features
NEW interface “HIDContainerRenewal”
HIDContainer
NEW method “getCreationDate”
-(NSDate*)getCreationDate:(NSError**)error;
NEW method “getExpiryDate”
-(NSDate*)getExpiryDate:(NSError**)error;
NEW method “getRenewalDate”
-(NSDate*)getRenewalDate:(NSError**)error;
NEW method “isRenewable”
-(Boolean)isRenewable:(NSString*)sessionPassword error:(NSError**)error;
NEW method “renew”
-(Boolean)renew:(HIDContainerRenewal*)config withSessionPassword:(NSString*) sessionPassword withListener:(NSObject<HIDProgressListener>*)listener error:(NSError**)error;
HIDErrorCode
NEW enumeration value “HIDPasswordCancelled”
NEW enumeration value “HIDServerUnsupportedOperation”
NEW enumeration value “HIDServerOperationFailed”
What's New in Version 4.0 from 3.0
SDK Addition
HIDContainer
NEW method “IsFIPSModeEnabled” – Reserved for Future Use.
Code Examples
Transaction Retrieval
NSError* error;
// get device
HIDConnectionConfiguration* connectionConfig = [[HIDConnectionConfiguration alloc] init];
id<HIDDevice> pDevice = [[HIDDeviceFactory alloc] newInstance:connectionConfig error:&error];
// get transaction
id<HIDTransactionInfo> pTransactionInfo = [pDevice retrieveTransactionInfo:transactionId error:&error];
id<HIDTransaction> pTransaction = [pDevice retrieveTransaction:myTransactionId withPassword:mySessionPwd withParams:nil error:&error];
NSError* error;
// get device
HIDConnectionConfiguration* connectionConfig = [[HIDConnectionConfiguration alloc] init];
id<HIDDevice> pDevice = [[HIDDeviceFactory alloc] newInstance:connectionConfig withSessionPassword:mySessionPwd error:&error];
// get transaction
id<HIDTransactionInfo> pTransactionInfo = [pDevice retrieveTransactionInfo:myTransactionId error:&error];
id<HIDTransaction> pTransaction = [pTransactionInfo getTransaction:mySessionPwd withParams:nil error:&error];
NSError* error;
// get device
HIDConnectionConfiguration* connectionConfig = [[HIDConnectionConfiguration alloc] init];
id<HIDDevice> pDevice = [[HIDDeviceFactory alloc] newInstance:connectionConfig error:&error];
// get transaction
id<HIDTransactionInfo> pTransactionInfo = [pDevice retrieveTransactionInfo:myTransactionId error:&error];
id<HIDTransaction> pTransaction = [pTransactionInfo getTransaction:mySessionPwd withParams:nil error:&error];
Provisioning / Container Creation
// progress listener
-(void)onEventReceived:(id<HIDProgressEvent>)event {
NSArray* params = [event parameters];
NSString* message; NSString* percent;
for (HIDParameter* p in params) {
if ( [[p key] caseInsensitiveCompare:HID_PARAM_PROGRESSEVENT_MESSAGE]==NSOrderedSame)
message = [p value];
if ( [[p key] caseInsensitiveCompare:HID_PARAM_PROGRESSEVENT_PERCENT]==NSOrderedSame)
percent = [p value];
}
NSString* text = [NSString stringWithFormat:@"%@ (%@)", message, percent];
NSLog(@"Event Received: %@", text);
}
// provisioning
-(void)doProvisioning {
NSError* error;
// get device
HIDConnectionConfiguration* connectionConfig = [[HIDConnectionConfiguration alloc] init];
id<HIDDevice> pDevice = [[HIDDeviceFactory alloc] newInstance:connectionConfig error:&error];
// new container
HIDContainerInitialization* config = [[HIDContainerInitialization alloc] init];
config.activationCode = [[NSString alloc] initWithData:myActivationCodeData encoding:NSUTF8StringEncoding];
config.initialPassword = myInitialPassword;
config.pushId = myPushID;
config.containerFriendlyName = myServiceName;
id<HIDContainer> pContainer = [pDevice createContainer:config withListener:self error:&error];
}
// progress listener
-( HIDEventResult*)onEventReceived:(NSObject<HIDEvent>*)event {
if ([event isKindOfClass:[HIDPasswordPromptEvent class]]) {
// password request
HIDPasswordPromptEvent* pPwdEvent = (HIDPasswordPromptEvent*)event;
return [[HIDPasswordPromptResult alloc] initWithCode:Continue andPassword:myInitialPassword];
}
else { // progress message
NSArray* params = [event parameters];
NSString* message; NSString* percent;
for (HIDParameter* p in params) {
if ( [[p key] caseInsensitiveCompare:HID_PARAM_PROGRESSEVENT_MESSAGE]==NSOrderedSame)
message = [p value];
if ( [[p key] caseInsensitiveCompare:HID_PARAM_PROGRESSEVENT_PERCENT]==NSOrderedSame)
percent = [p value];
}
NSString* text = [NSString stringWithFormat:@"%@ (%@)", message, percent];
NSLog(@"Event Received: %@", text);
}
return [[HIDEventResult alloc] initWithCode:(Continue)];
}
// provisioning
-(void)doProvisioning {
NSError* error;
// get device
HIDConnectionConfiguration* connectionConfig = [[HIDConnectionConfiguration alloc] init];
id<HIDDevice> pDevice = [[HIDDeviceFactory alloc] newInstance:connectionConfig withSessionPassword:mySessionPwd error:&error];
// new container
HIDContainerInitialization* config = [[HIDContainerInitialization alloc] init];
config.activationCode = [[NSString alloc] initWithData:myActivationCodeData encoding:NSUTF8StringEncoding];
// NOTE: “config.initialPassword” is not supported; use listener
config.pushId = myPushID;
config.containerFriendlyName = myServiceName;
id<HIDContainer> pContainer = [pDevice createContainer:config withSessionPassword:mySessionPwd withListener:self error:&error];
}
// progress listener
-( HIDEventResult*)onEventReceived:(NSObject<HIDEvent>*)event {
if ([event isKindOfClass:[HIDPasswordPromptEvent class]]) {
// password request
HIDPasswordPromptEvent* pPwdEvent = (HIDPasswordPromptEvent*)event;
return [[HIDPasswordPromptResult alloc] initWithCode:Continue andPassword:myInitialPassword];
}
else { // progress message
NSArray* params = [event parameters];
NSString* message; NSString* percent;
for (HIDParameter* p in params) {
if ( [[p key] caseInsensitiveCompare:HID_PARAM_PROGRESSEVENT_MESSAGE]==NSOrderedSame)
message = [p value];
if ( [[p key] caseInsensitiveCompare:HID_PARAM_PROGRESSEVENT_PERCENT]==NSOrderedSame)
percent = [p value];
}
NSString* text = [NSString stringWithFormat:@"%@ (%@)", message, percent];
NSLog(@"Event Received: %@", text);
}
return [[HIDEventResult alloc] initWithCode:(Continue)];
}
// provisioning
-(void)doProvisioning {
NSError* error;
// get device
HIDConnectionConfiguration* connectionConfig = [[HIDConnectionConfiguration alloc] init];
id<HIDDevice> pDevice = [[HIDDeviceFactory alloc] newInstance:connectionConfig error:&error];
// new container
HIDContainerInitialization* config = [[HIDContainerInitialization alloc] init];
config.activationCode = [[NSString alloc] initWithData:myActivationCodeData encoding:NSUTF8StringEncoding];
// NOTE: “config.initialPassword” is not supported; use listener
config.pushId = myPushID;
config.containerFriendlyName = myServiceName;
id<HIDContainer> pContainer = [pDevice createContainer:config withSessionPassword:mySessionPwd withListener:self error:&error];
}