Skip to content

Commit

Permalink
SDK Version 2.4.1 (#66)
Browse files Browse the repository at this point in the history
* Post object can now handle different types for original post identifier (#54)

* Added guest consent podspec

* Updated quark to work with scope changes.

* Swapped Brotli for GZIP compression.

* Swapped Brotli for GZIP compression. (#55)

* Version increment to add GZIP support and timing tool support (#56)

* DIGI-13285 load new environments dynamically from the documents folder (#57)

* DIGI-13285 load new environments dynamically from the documents folder

* additional null check to be cconsistent with the other code

* Private CASession header for core.

* Reflected changes for postbox.

* DIGI-13286, DIGI-13289, DIGI-13290 - Filter out specific values into the Session dictionary (#59)

* DIGI-13286, DIGI-13289, DIGI-13290 - Filter out specific values into the Session dictionary

* Remove obsolete vars

* Quick doc fix

* Postbox included in the podspec

* Updated SDK to remove support for CAFileObject. Updated Default p12 + contract combo

* Updated p12 + contract combo in Swift example

* Updated Documentation to clarify change to the delegate pattern. (#64)

* Updated Documentation

* Link fix

* Update copyright date

* Updated podspec
  • Loading branch information
alex-yushchenko authored and hamiltonalex committed Feb 14, 2019
1 parent 567cc71 commit dffcbb3
Show file tree
Hide file tree
Showing 27 changed files with 216 additions and 407 deletions.
8 changes: 5 additions & 3 deletions DigiMeSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Pod::Spec.new do |s|

s.name = "DigiMeSDK"
s.version = "2.4.0"
s.version = "2.4.1"
s.summary = "digi.me iOS Consent Access SDK"
s.homepage = "https://github.com/digime/digime-sdk-ios"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "digi.me Ltd." => "ios@digi.me" }
s.platform = :ios, "10.0"
s.dependency "Brotli"
s.dependency "GZIP"

s.source = {
:git => "https://github.com/digime/digime-sdk-ios.git",
Expand All @@ -25,13 +26,14 @@ Pod::Spec.new do |s|
'DigiMeSDK/Core/Classes/Utility/*.h',
'DigiMeSDK/Core/Classes/Security/DME*.h',
'DigiMeSDK/Core/Classes/DMEAuthorizationManager.h',
'DigiMeSDK/Core/Classes/DMEClient+Private.h'
'DigiMeSDK/Core/Classes/DMEClient+Private.h',
'DigiMeSDK/Core/Classes/CASession+Private.h'
end


s.subspec 'Repository' do |ss|
ss.source_files = "DigiMeSDK/Repository/Classes/**/*.swift"
ss.frameworks = "Foundation"
ss.dependency "DigiMeSDK/Core"
end

end
5 changes: 0 additions & 5 deletions DigiMeSDK/Core/Classes/DMEAppCommunicator.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#import <StoreKit/StoreKit.h>
#import "UIViewController+DMEExtension.h"

static NSString * const kCARequestSessionKey = @"CARequestSessionKey";
static NSString * const kCARequestRegisteredAppID = @"CARequestRegisteredAppID";
static NSString * const kCARequest3dPartyAppName = @"CARequest3dPartyAppName";
static NSString * const kCADigimeResponse = @"CADigimeResponse";
static NSString * const kDMEClientScheme = @"digime-ca-master";
static NSString * const kCASdkVersion = @"CASdkVersion";
static NSInteger const kDMEClientAppstoreID = 1234541790;
Expand Down Expand Up @@ -58,7 +54,6 @@ - (BOOL)canOpenDigiMeApp

- (void)openDigiMeAppWithAction:(DMEOpenAction *)action parameters:(NSDictionary *)parameters
{

self.sentAction = action;
self.sentParameters = parameters;
dispatch_async(dispatch_get_main_queue(), ^{
Expand Down
20 changes: 16 additions & 4 deletions DigiMeSDK/Core/Classes/DMEAuthorizationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "DMEAuthorizationManager.h"
#import "CASessionManager.h"
#import "CASession+Private.h"
#import "DMEClient.h"

#import "NSError+Auth.h"
Expand All @@ -16,10 +17,6 @@
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>

static NSString * const kCARequestSessionKey = @"CARequestSessionKey";
static NSString * const kCADigimeResponse = @"CADigimeResponse";
static NSString * const kCARequestRegisteredAppID = @"CARequestRegisteredAppID";

@interface DMEAuthorizationManager()

@property (nonatomic, strong, readonly) CASession *session;
Expand Down Expand Up @@ -54,6 +51,8 @@ - (void)handleAction:(DMEOpenAction *)action withParameters:(NSDictionary<NSStri
BOOL result = [parameters[kCADigimeResponse] boolValue];
NSString *sessionKey = parameters[kCARequestSessionKey];

[self filterMetadata: parameters];

NSError *err;

if(![self.sessionManager isSessionKeyValid:sessionKey])
Expand Down Expand Up @@ -106,4 +105,17 @@ -(CASessionManager *)sessionManager
return [DMEClient sharedClient].sessionManager;
}

-(void)filterMetadata:(NSDictionary<NSString *,id> *)metadata
{
// default legacy keys
NSMutableArray *allowedKeys = @[kCARequestSessionKey, kCADigimeResponse, kCARequestRegisteredAppID].mutableCopy;
// timing keys
[allowedKeys addObjectsFromArray:@[kTimingDataGetAllFiles, kTimingDataGetFile, kTimingFetchContractPermission, kTimingFetchDataGetAccount, kTimingFetchDataGetFileList, kTimingFetchSessionKey, kDataRequest, kFetchContractDetails, kUpdateContractPermission, kTimingTotal]];
// timing debug keys
[allowedKeys addObjectsFromArray:@[kDebugAppId, kDebugBundleVersion, kDebugPlatform, kContractType, kDeviceId, kDigiMeVersion, kUserId, kLibraryId, kPCloudType]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self IN %@", allowedKeys];
NSDictionary *whiteDictionary = [metadata dictionaryWithValuesForKeys:[metadata.allKeys filteredArrayUsingPredicate:predicate]];
self.session.metadata = whiteDictionary;
}

@end
14 changes: 13 additions & 1 deletion DigiMeSDK/Core/Classes/DMEClientConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "DMEClientConfiguration.h"

NSString * const kDMEClientSchemePrefix = @"digime-ca-";
NSString * const kDMEConfigFileName = @"DMEConfig";

@interface DMEClientConfiguration()

Expand Down Expand Up @@ -41,14 +42,25 @@ - (NSString *)baseUrl
{
if (!_baseUrl)
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"DMEConfig" ofType:@"plist"];
NSDictionary *dict;
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filePath = [[documentsPath stringByAppendingPathComponent:kDMEConfigFileName] stringByAppendingPathExtension:@"plist"];

if (filePath)
{
dict = [[NSDictionary alloc] initWithContentsOfFile:filePath];
}

if (!dict)
{
filePath = [[NSBundle mainBundle] pathForResource:kDMEConfigFileName ofType:@"plist"];

if (filePath)
{
dict = [[NSDictionary alloc] initWithContentsOfFile:filePath];
}
}

NSString *domain = dict[@"DME_DOMAIN"] ?: @"digi.me";
_baseUrl = [NSString stringWithFormat:@"https://api.%@/", domain];
}
Expand Down
10 changes: 10 additions & 0 deletions DigiMeSDK/Core/Classes/DMEDataUnpacker.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ + (nullable NSData *)unpackData:(NSData *)data error:(NSError * _Nullable __auto
return nil;
}
}
else if ([compression isEqualToString:@"gzip"])
{
unpackedData = [DMECompressor decompressData:unpackedData usingAlgorithm:DMECompressionAlgorithmGZIP];
if (!unpackedData)
{
// Decompression failed
[NSError setSDKError:SDKErrorInvalidData toError:error];
return nil;
}
}
else if (compression != nil)
{
// Unknown compression. Return nil.
Expand Down
9 changes: 1 addition & 8 deletions DigiMeSDK/Core/Classes/Entities/CAFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//

#import <Foundation/Foundation.h>
#import "CAFileObject.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -51,12 +50,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nullable, nonatomic, strong, readonly) NSArray *json;


/**
Array of CAFileObjects found in the file.
*/
@property (nullable, nonatomic, strong, readonly) NSArray<CAFileObject *> *objects;
@end

NS_ASSUME_NONNULL_END

@end
12 changes: 1 addition & 11 deletions DigiMeSDK/Core/Classes/Entities/CAFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ -(instancetype)initWithFileId:(NSString *)fileId
- (void)populateWithContent:(NSArray *)content
{
_json = content;

NSMutableArray *objects = [NSMutableArray new];

for (NSDictionary *obj in content)
{
CAFileObject *fileObject = [[CAFileObject alloc] initWithJson:obj];
[objects addObject:fileObject];
}

_objects = objects;
}

#pragma mark - Overrides
Expand All @@ -56,7 +46,7 @@ -(NSString *)description
{
NSString *description = [NSString stringWithFormat:@"FileId: %@,\n", self.fileId];

description = [NSString stringWithFormat:@"%@%i objects", description, (int)self.objects.count];
description = [NSString stringWithFormat:@"%@%i objects", description, (int)self.json.count];

return [NSString stringWithFormat:@"\n<%@: %p,\n%@>",
NSStringFromClass([self class]), self, description];
Expand Down
121 changes: 0 additions & 121 deletions DigiMeSDK/Core/Classes/Entities/CAFileObject.h

This file was deleted.

Loading

0 comments on commit dffcbb3

Please sign in to comment.