Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MIRACLTrust.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.name = "MIRACLTrust"
s.summary = "MIRACL Trust SDK for iOS"
s.requires_arc = true
s.version = "1.7.0"
s.version = "1.7.1"
s.license = { :type => "Apache2", :file => "LICENSE" }
s.author = { "MIRACL" => "[email protected]" }
s.homepage = "https://github.com/miracl/trust-sdk-ios"
Expand Down
9 changes: 1 addition & 8 deletions MIRACLTrust/MIRACLTrust-Sources/MIRACLTrust.swift
Original file line number Diff line number Diff line change
Expand Up @@ -844,15 +844,8 @@ import Foundation
completionHandler: @escaping CrossDeviceSigningCompletionHandler
) {
do {
guard let hash = crossDeviceSession.signingHash.data(using: .utf8) else {
DispatchQueue.main.async {
completionHandler(false, SigningError.emptyMessageHash)
}
return
}

let signer = try Signer(
messageHash: hash,
messageHash: Data(hexString: crossDeviceSession.signingHash),
sessionType: .crossDevice(sessionId: crossDeviceSession.sessionId),
user: user,
didRequestSigningPinHandler: didRequestSigningPinHandler
Expand Down
20 changes: 10 additions & 10 deletions MIRACLTrust/MIRACLTrust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
MARKETING_VERSION = "$(MIRACL_SDK_VERSION)";
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1852,7 +1852,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
MARKETING_VERSION = "$(MIRACL_SDK_VERSION)";
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand All @@ -1878,7 +1878,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.miracl.trust.sdk-ios.MIRACLTrustTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -1898,7 +1898,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.miracl.trust.sdk-ios.MIRACLTrustTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -1920,7 +1920,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.6.3;
MIRACL_SDK_VERSION = 1.7.1;
PRODUCT_BUNDLE_IDENTIFIER = com.radoslavpenev.MIRACLTrustIntegrationTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "MIRACLTrustIntegrationTests/Cases/MIRACLTrustIntegrationTests-Bridging-Header.h";
Expand All @@ -1945,7 +1945,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.6.3;
MIRACL_SDK_VERSION = 1.7.1;
PRODUCT_BUNDLE_IDENTIFIER = com.radoslavpenev.MIRACLTrustIntegrationTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "MIRACLTrustIntegrationTests/Cases/MIRACLTrustIntegrationTests-Bridging-Header.h";
Expand All @@ -1968,7 +1968,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.miracl.applclippoc.MIRACLTrust-Test-Host-App";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
Expand All @@ -1990,7 +1990,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.miracl.applclippoc.MIRACLTrust-Test-Host-App";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2031,7 +2031,7 @@
"$(PROJECT_DIR)/MIRACLTrust-Sources/Crypto/src",
);
MARKETING_VERSION = "$(MIRACL_SDK_VERSION)";
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
MODULEMAP_FILE = "$(SRCROOT)/MIRACLTrust-Sources/MIRACLTrust.modulemap";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
Expand Down Expand Up @@ -2080,7 +2080,7 @@
"$(PROJECT_DIR)/MIRACLTrust-Sources/Crypto/src",
);
MARKETING_VERSION = "$(MIRACL_SDK_VERSION)";
MIRACL_SDK_VERSION = 1.7.0;
MIRACL_SDK_VERSION = 1.7.1;
MODULEMAP_FILE = "$(SRCROOT)/MIRACLTrust-Sources/MIRACLTrust.modulemap";
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ @interface MIRACLTrustCompatibilityTests : XCTestCase
@property (nonatomic, strong) CrossDeviceSessionCompatiblityCase *getCrossDeviceSessionCompatibilityCase;

@property (nonatomic,strong) Configuration *configuration;
@property (nonatomic,strong) NSString *accessId;
@property (nonatomic,strong) StartSessionResult *session;
@property (nonatomic,strong) NSString *activationToken;
@property (nonatomic,strong) NSString *randomNumber;

Expand Down Expand Up @@ -115,7 +115,7 @@ - (void)testVerificationConfirmationError

self.userId = @"[email protected]";
self.api = [[PlatformAPIWrapper alloc] init];
self.accessId = [self.api getAccessIdWithProjectId:projectId
self.session = [self.api startSessionWithProjectId:projectId
projectURL:projectURL
userId:nil
hash:nil
Expand All @@ -133,7 +133,7 @@ - (void)testVerificationConfirmationError
projectId:projectId
projectURL:projectURL
userId:self.userId
accessId:self.accessId
accessId:self.session.accessId
expiration:expirationDate];
NSNumber *sleepTime = @(expirationInSeconds.intValue + 1);
sleep(sleepTime.intValue);
Expand All @@ -148,7 +148,7 @@ - (void)testVerificationConfirmationError
XCTAssertEqual(error.code, 3);
XCTAssertEqualObjects(error.domain, @"MIRACLTrust.ActivationTokenError");
XCTAssertNotNil(errorResponse);
XCTAssertEqualObjects(errorResponse.accessId, self.accessId);
XCTAssertEqualObjects(errorResponse.accessId, self.session.accessId);
XCTAssertEqualObjects(errorResponse.userId, self.userId);
XCTAssertEqualObjects(errorResponse.projectId, projectId);

Expand Down Expand Up @@ -202,13 +202,13 @@ - (void)testCompatibility
NSString *clientSecret = NSProcessInfo.processInfo.environment[@"clientSecretCUV"];
self.userId = @"[email protected]";
self.api = [[PlatformAPIWrapper alloc] init];
self.accessId = [self.api getAccessIdWithProjectId:projectId
self.session = [self.api startSessionWithProjectId:projectId
projectURL:projectURL
userId:nil
hash:nil
description:nil];

self.qrCodeURL = [NSString stringWithFormat:@"https://mcl.mpin.io/mobile-login/#%@",self.accessId];
self.qrCodeURL = [NSString stringWithFormat:@"https://mcl.mpin.io/mobile-login/#%@",self.session.accessId];
self.projectId = projectId;


Expand Down Expand Up @@ -237,12 +237,12 @@ - (void)testCompatibility
NSNumber *isAborted = dict[@"isAborted"];
XCTAssertTrue([isAborted boolValue]);

self.accessId = [self.api getAccessIdWithProjectId:projectId
self.session = [self.api startSessionWithProjectId:projectId
projectURL:projectURL
userId:nil
hash:nil
description:nil];
self.qrCodeURL = [NSString stringWithFormat:@"https://mcl.mpin.io/mobile-login/#%@",self.accessId];
self.qrCodeURL = [NSString stringWithFormat:@"https://mcl.mpin.io/mobile-login/#%@",self.session.accessId];

dict = [self.getCrossDeviceSessionCompatibilityCase getCrossDeviceSessionForQRCode:self.qrCodeURL];
XCTAssertTrue([dict[@"error"] isEqual:[NSNull null]]);
Expand All @@ -268,12 +268,12 @@ - (void)testCompatibility
isAborted = dict[@"isAborted"];
XCTAssertTrue([isAborted boolValue]);

self.accessId = [self.api getAccessIdWithProjectId:projectId
self.session = [self.api startSessionWithProjectId:projectId
projectURL:projectURL
userId:nil
hash:nil
description:nil];
self.qrCodeURL = [NSString stringWithFormat:@"https://mcl.mpin.io/mobile-login/#%@",self.accessId];
self.qrCodeURL = [NSString stringWithFormat:@"https://mcl.mpin.io/mobile-login/#%@",self.session.accessId];

dict = [self.getCrossDeviceSessionCompatibilityCase getCrossDeviceSessionForQRCode:self.qrCodeURL];
XCTAssertTrue([dict[@"error"] isEqual:[NSNull null]]);
Expand All @@ -285,7 +285,7 @@ - (void)testCompatibility
projectId:projectId
projectURL:projectURL
userId:self.userId
accessId:self.accessId
accessId:self.session.accessId
expiration:nil];
dict = [self.getActivationTokenCompatiblityCase getActivationTokenFrom:verificationURL];
self.activationToken = dict[@"activationToken"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import XCTest

class AbortSessionIntegrationTests: XCTestCase {
var userId = ""
var accessId = ""

var sessionDetails: AuthenticationSessionDetails?

Expand Down Expand Up @@ -37,15 +36,15 @@ class AbortSessionIntegrationTests: XCTestCase {
.build()
try MIRACLTrust.configure(with: XCTUnwrap(configuration))

accessId = try XCTUnwrap(api.getAccessId(projectId: projectId, projectURL: platformURLCUV))
let session = try XCTUnwrap(api.startSession(projectId: projectId, projectURL: platformURLCUV))

let (response, _) = getActivationToken.getActivationToken(
clientId: clientId,
clientSecret: clientSecret,
projectId: projectId,
projectURL: platformURLCUV,
userId: userId,
accessId: accessId
accessId: session.accessId
)

activationToken = try XCTUnwrap(response?.activationToken)
Expand All @@ -55,7 +54,7 @@ class AbortSessionIntegrationTests: XCTestCase {
activationToken: activationToken
)

let (details, _) = sessionDetailsTestCase.getSessionDetails(qrCode: "https://mcl.mpin.io#\(accessId)")
let (details, _) = sessionDetailsTestCase.getSessionDetails(qrCode: "https://mcl.mpin.io#\(session.accessId)")

sessionDetails = try XCTUnwrap(details)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AuthenticationIntegrationTests: XCTestCase {
var authentication = QRAuthenticationTestCase()
var jwtAuthenticationTestCase = JWTAuthenticationTestCase()
var getActivationToken = GetActivationTokenTestCase()
var accessId = ""
var session: StartSessionResult?
var activationToken = ""
var configuration: Configuration?

Expand All @@ -32,7 +32,7 @@ class AuthenticationIntegrationTests: XCTestCase {
jwtAuthenticationTestCase = JWTAuthenticationTestCase()
jwtAuthenticationTestCase.pinCode = randomPIN

accessId = try XCTUnwrap(api.getAccessId(projectId: projectId, projectURL: projectURL))
session = try XCTUnwrap(api.startSession(projectId: projectId, projectURL: projectURL))

configuration = try Configuration
.Builder(
Expand All @@ -49,7 +49,7 @@ class AuthenticationIntegrationTests: XCTestCase {
projectId: projectId,
projectURL: projectURL,
userId: userId,
accessId: accessId
accessId: session!.accessId
)

activationToken = try XCTUnwrap(response?.activationToken)
Expand Down Expand Up @@ -237,7 +237,8 @@ class AuthenticationIntegrationTests: XCTestCase {
assertError(current: jwtError, expected: AuthenticationError.revoked)

// After three unsuccessful tries, the user is blocked and cannot authenticate anymore.
let qrCode = "https://mcl.mpin.io/mobile-login/#\(accessId)"
let session = try XCTUnwrap(session)
let qrCode = "https://mcl.mpin.io/mobile-login/#\(session.accessId)"
let (authenticationResult, authenticationError) = try authentication.authenticateUser(
user: XCTUnwrap(user),
qrCode: qrCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct CrossDeviceSessionAborterIntegrationTest {
let abortCrossDeviceSessionCase = CrossDeviceSessionAbortCase()
let platformAPI = PlatformAPIWrapper()

var sessionId: String
var session: StartSessionResult
var crossDeviceSession: CrossDeviceSession

init() async throws {
Expand All @@ -19,11 +19,11 @@ struct CrossDeviceSessionAborterIntegrationTest {

try MIRACLTrust.configure(with: configuration)

sessionId = try await platformAPI.getAsyncAccessId(
session = try await platformAPI.getAsyncAccessId(
projectId: projectId,
projectURL: projectURL
)
let qrCode = "https://mcl.mpin.io#\(sessionId)"
let qrCode = "https://mcl.mpin.io#\(session.accessId)"
crossDeviceSession = try await crossDeviceSessionCase.getCrossDeviceSessionForQRCode(qrCode: qrCode)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct CrossDeviceSessionAuthenticationIntegrationTest {
var randomPIN = ""
var user: User
var crossDeviceSession: CrossDeviceSession
var accessId: String
var session: StartSessionResult

init() async throws {
randomPIN = CrossDeviceSessionAuthenticationIntegrationTest.makeRandomPin()
Expand All @@ -32,8 +32,8 @@ struct CrossDeviceSessionAuthenticationIntegrationTest {

try MIRACLTrust.configure(with: configuration)

accessId = try await platformAPI.getAsyncAccessId(projectId: projectId, projectURL: projectURL)
let qrCode = "https://mcl.mpin.io#\(accessId)"
session = try await platformAPI.getAsyncAccessId(projectId: projectId, projectURL: projectURL)
let qrCode = "https://mcl.mpin.io#\(session.accessId)"
crossDeviceSession = try await crossDeviceSessionCase.getCrossDeviceSessionForQRCode(qrCode: qrCode)
let activationToken = try await activationTokenCase.getActivationToken(
clientId: clientId,
Expand All @@ -56,7 +56,7 @@ struct CrossDeviceSessionAuthenticationIntegrationTest {

@Test("Tests successful authentication with cross device session for Universal Link URL", .timeLimit(.minutes(1)))
func authenticationWithUniviversalLinkURLCrossDeviceSession() async throws {
let url = try #require(URL(string: "https://mcl.mpin.io/#\(accessId)"))
let url = try #require(URL(string: "https://mcl.mpin.io/#\(session.accessId)"))
let crossDeviceSession = try await crossDeviceSessionCase
.getCrossDeviceSessionForUniversalLinkURL(universalLinkURL: url)
let isAuthenticated = try await authenticationTestCase.authenticate(
Expand All @@ -69,7 +69,7 @@ struct CrossDeviceSessionAuthenticationIntegrationTest {

@Test("Tests successful authentication with cross device session for Universal Link URL", .timeLimit(.minutes(1)))
func authenticationWithPushNotificationPayloadForCrossDeviceSession() async throws {
let qrCode = "https://mcl.mpin.io#\(accessId)"
let qrCode = "https://mcl.mpin.io#\(session.accessId)"
let payload = [
"qrURL": qrCode
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct CrossDeviceSessionIntegrationTest {
)
.build()

sessionId = try await platformAPI.getAsyncAccessId(projectId: projectId, projectURL: url)
sessionId = try await platformAPI.getAsyncAccessId(projectId: projectId, projectURL: url).accessId

try MIRACLTrust.configure(with: configuration)
}
Expand All @@ -37,7 +37,7 @@ struct CrossDeviceSessionIntegrationTest {
func getCrossDeviceSessionForDifferentProject() async throws {
let hash = UUID().uuidString
let description = UUID().uuidString
let sessionId = try await platformAPI.getAsyncAccessId(projectId: expectedProjectId, projectURL: url, hash: hash, description: description)
let sessionId = try await platformAPI.getAsyncAccessId(projectId: expectedProjectId, projectURL: url, hash: hash, description: description).accessId
let qrCode = "https://mcl.mpin.io#\(sessionId)"
let session = try await crossDeviceSessionCase.getCrossDeviceSessionForQRCode(qrCode: qrCode)
#expect(session.projectId == expectedProjectId)
Expand Down Expand Up @@ -86,7 +86,7 @@ struct CrossDeviceSessionIntegrationTest {
func getCrossDeviceSessionsUniversalLinkURLForDifferentProject() async throws {
let hash = UUID().uuidString
let description = UUID().uuidString
let sessionId = try await platformAPI.getAsyncAccessId(projectId: expectedProjectId, projectURL: url, hash: hash, description: description)
let sessionId = try await platformAPI.getAsyncAccessId(projectId: expectedProjectId, projectURL: url, hash: hash, description: description).accessId
let universalLinkURL = try #require(URL(string: "https://mcl.mpin.io#\(sessionId)"))
let session = try await crossDeviceSessionCase.getCrossDeviceSessionForUniversalLinkURL(universalLinkURL: universalLinkURL)

Expand Down Expand Up @@ -124,7 +124,7 @@ struct CrossDeviceSessionIntegrationTest {
func getCrossDeviceSessionsFromPushNotificationsPayloadDifferent() async throws {
let hash = UUID().uuidString
let description = UUID().uuidString
let sessionId = try await platformAPI.getAsyncAccessId(projectId: expectedProjectId, projectURL: url, hash: hash, description: description)
let sessionId = try await platformAPI.getAsyncAccessId(projectId: expectedProjectId, projectURL: url, hash: hash, description: description).accessId
let qrCode = "https://mcl.mpin.io#\(sessionId)"
let payload = [
"qrURL": qrCode
Expand Down
Loading