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.6.3"
s.version = "1.7.0"
s.license = { :type => "Apache2", :file => "LICENSE" }
s.author = { "MIRACL" => "[email protected]" }
s.homepage = "https://github.com/miracl/trust-sdk-ios"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import Foundation

public let quickCodeEnabled: Bool

public let limitQuickCodeRegistration: Bool

public let identityType: IdentityType

/// Identifier of the authentication session.
Expand All @@ -41,7 +39,6 @@ import Foundation
verificationCustomText: String,
identityTypeLabel: String,
quickCodeEnabled: Bool,
limitQuickCodeRegistration: Bool,
identityType: IdentityType,
accessId: String
) {
Expand All @@ -55,7 +52,6 @@ import Foundation
self.verificationCustomText = verificationCustomText
self.identityTypeLabel = identityTypeLabel
self.quickCodeEnabled = quickCodeEnabled
self.limitQuickCodeRegistration = limitQuickCodeRegistration
self.identityType = identityType
self.accessId = accessId
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ struct AuthenticationSessionDetailsFetcher: Sendable {
verificationCustomText: sessionDetailsResponse.verificationCustomText,
identityTypeLabel: sessionDetailsResponse.identityTypeLabel,
quickCodeEnabled: sessionDetailsResponse.quickCodeEnabled,
limitQuickCodeRegistration: sessionDetailsResponse.limitQuickCodeRegistration,
identityType: IdentityType.identityTypeFromString(sessionDetailsResponse.identityType),
accessId: accessId
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct AuthenticationSessionsDetailsResponse: Codable {
var identityTypeLabel = ""
var identityType = ""
var quickCodeEnabled = false
var limitQuickCodeRegistration = false

enum CodingKeys: String, CodingKey {
case prerollId
Expand All @@ -24,6 +23,5 @@ struct AuthenticationSessionsDetailsResponse: Codable {
case identityTypeLabel
case identityType
case quickCodeEnabled = "enableRegistrationCode"
case limitQuickCodeRegistration = "limitRegCodeVerified"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ import Foundation
/// Indicates whether [QuickCode](https://miracl.com/resources/docs/guides/built-in-user-verification/quickcode/) is enabled for the project or not.
public let quickCodeEnabled: Bool

/// Indicates whether registration with QuickCode is allowed for identities registered also with QuickCode.
public let limitQuickCodeRegistration: Bool

/// Identity type which will be used for identity verification.
public let identityType: IdentityType

Expand All @@ -59,7 +56,6 @@ import Foundation
verificationCustomText: String,
identityTypeLabel: String,
quickCodeEnabled: Bool,
limitQuickCodeRegistration: Bool,
identityType: IdentityType,
sessionId: String,
sessionDescription: String,
Expand All @@ -75,7 +71,6 @@ import Foundation
self.verificationCustomText = verificationCustomText
self.identityTypeLabel = identityTypeLabel
self.quickCodeEnabled = quickCodeEnabled
self.limitQuickCodeRegistration = limitQuickCodeRegistration
self.identityType = identityType
self.sessionId = sessionId
self.sessionDescription = sessionDescription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ final class CrossDeviceSessionFetcher: Sendable {
verificationCustomText: response.verificationCustomText,
identityTypeLabel: response.identityTypeLabel,
quickCodeEnabled: response.quickCodeEnabled,
limitQuickCodeRegistration: response.limitQuickCodeRegistration,
identityType: IdentityType.identityTypeFromString(response.identityType),
sessionId: self.sessionId,
sessionDescription: response.sessionDescription,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ struct CrossDeviceSessionResponse: Codable {
var identityTypeLabel: String
var identityType: String
var quickCodeEnabled: Bool
var limitQuickCodeRegistration: Bool
var signingHash: String
var sessionDescription: String

Expand All @@ -26,7 +25,6 @@ struct CrossDeviceSessionResponse: Codable {
case identityTypeLabel
case identityType
case quickCodeEnabled = "enableRegistrationCode"
case limitQuickCodeRegistration = "limitRegCodeVerified"
case signingHash = "hash"
case sessionDescription = "description"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ public enum QuickCodeError: Error {
/// Pin code includes invalid symbols or pin length does not match.
case invalidPin

/// Generating QuickCode from this registration is not allowed.
case limitedQuickCodeGeneration

/// QuickCode generation failed.
case generationFail(Error?)
}
Expand All @@ -39,8 +36,6 @@ extension QuickCodeError: LocalizedError {
description = NSLocalizedString("\(QuickCodeError.pinCancelled)", comment: "")
case .invalidPin:
description = NSLocalizedString("\(QuickCodeError.invalidPin)", comment: "")
case .limitedQuickCodeGeneration:
description = NSLocalizedString("\(QuickCodeError.limitedQuickCodeGeneration)", comment: "")
case let .generationFail(error):
description = NSLocalizedString("\(QuickCodeError.generationFail(error))", comment: "")
}
Expand All @@ -59,10 +54,8 @@ extension QuickCodeError: CustomNSError {
3
case .invalidPin:
4
case .limitedQuickCodeGeneration:
5
case .generationFail:
6
5
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import Foundation

let LIMITED_QUICKCODE_GENERATION = "LIMITED_QUICKCODE_GENERATION"

struct QuickCodeGenerator: Sendable {
let user: User
let completionHandler: QuickCodeCompletionHandler
Expand Down Expand Up @@ -65,12 +63,7 @@ struct QuickCodeGenerator: Sendable {

@Sendable func authenticationResult(response: AuthenticateResponse?, error: Error?) {
if let error = error {
if case let AuthenticationError.authenticationFail(authError) = error,
let authError = authError as? APIError,
case let APIError.apiClientError(clientErrorData: clientErrorData, requestId: _, message: _, requestURL: _) = authError,
clientErrorData?.code == LIMITED_QUICKCODE_GENERATION {
callCompletionHandler(with: QuickCodeError.limitedQuickCodeGeneration)
} else if case AuthenticationError.revoked = error {
if case AuthenticationError.revoked = error {
callCompletionHandler(with: QuickCodeError.revoked)
} else if case AuthenticationError.unsuccessfulAuthentication = error {
callCompletionHandler(with: QuickCodeError.unsuccessfulAuthentication)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ import Foundation
/// Whether the QuickCode is enabled for the project or not.
var quickCodeEnabled: Bool { get }

/// Flag indicating whether registration with QuickCode is allowed for identities registered also with QuickCode.
var limitQuickCodeRegistration: Bool { get }

/// Identity type which will be used for identity verification.
var identityType: IdentityType { get }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import Foundation

public let quickCodeEnabled: Bool

public let limitQuickCodeRegistration: Bool

public let identityType: IdentityType

/// Identifier of the signing session.
Expand Down Expand Up @@ -53,7 +51,6 @@ import Foundation
verificationCustomText: String,
identityTypeLabel: String,
quickCodeEnabled: Bool,
limitQuickCodeRegistration: Bool,
identityType: IdentityType,
sessionId: String,
signingHash: String,
Expand All @@ -71,7 +68,6 @@ import Foundation
self.verificationCustomText = verificationCustomText
self.identityTypeLabel = identityTypeLabel
self.quickCodeEnabled = quickCodeEnabled
self.limitQuickCodeRegistration = limitQuickCodeRegistration
self.identityType = identityType
self.sessionId = sessionId
self.signingHash = signingHash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ struct SigningSessionDetailsFetcher: Sendable {
verificationCustomText: response.verificationCustomText,
identityTypeLabel: response.identityTypeLabel,
quickCodeEnabled: response.enableRegistrationCode,
limitQuickCodeRegistration: response.limitRegCodeVerified,
identityType: IdentityType.identityTypeFromString(response.identityType),
sessionId: accessId,
signingHash: response.signingHash,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct SigningSessionDetailsResponse: Codable {
var identityTypeLabel: String
var pinLength: Int
var enableRegistrationCode: Bool
var limitRegCodeVerified: Bool

enum CodingKeys: String, CodingKey {
case userID
Expand All @@ -32,6 +31,5 @@ struct SigningSessionDetailsResponse: Codable {
case identityTypeLabel
case pinLength
case enableRegistrationCode
case limitRegCodeVerified
}
}
14 changes: 8 additions & 6 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.6.3;
MIRACL_SDK_VERSION = 1.7.0;
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.6.3;
MIRACL_SDK_VERSION = 1.7.0;
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.6.3;
MIRACL_SDK_VERSION = 1.7.0;
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.6.3;
MIRACL_SDK_VERSION = 1.7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.miracl.trust.sdk-ios.MIRACLTrustTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -1968,6 +1968,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.miracl.applclippoc.MIRACLTrust-Test-Host-App";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
Expand All @@ -1989,6 +1990,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MIRACL_SDK_VERSION = 1.7.0;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.miracl.applclippoc.MIRACLTrust-Test-Host-App";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2029,7 +2031,7 @@
"$(PROJECT_DIR)/MIRACLTrust-Sources/Crypto/src",
);
MARKETING_VERSION = "$(MIRACL_SDK_VERSION)";
MIRACL_SDK_VERSION = 1.6.3;
MIRACL_SDK_VERSION = 1.7.0;
MODULEMAP_FILE = "$(SRCROOT)/MIRACLTrust-Sources/MIRACLTrust.modulemap";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
Expand Down Expand Up @@ -2078,7 +2080,7 @@
"$(PROJECT_DIR)/MIRACLTrust-Sources/Crypto/src",
);
MARKETING_VERSION = "$(MIRACL_SDK_VERSION)";
MIRACL_SDK_VERSION = 1.6.3;
MIRACL_SDK_VERSION = 1.7.0;
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 @@ -110,7 +110,6 @@ class AbortSessionIntegrationTests: XCTestCase {
verificationCustomText: UUID().uuidString,
identityTypeLabel: UUID().uuidString,
quickCodeEnabled: Bool.random(),
limitQuickCodeRegistration: Bool.random(),
identityType: .alphanumeric,
accessId: accessId
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ final class AbortSigningSessionTest: XCTestCase {
verificationCustomText: UUID().uuidString,
identityTypeLabel: UUID().uuidString,
quickCodeEnabled: Bool.random(),
limitQuickCodeRegistration: Bool.random(),
identityType: .alphanumeric,
sessionId: sessionId,
signingHash: UUID().uuidString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct CrossDeviceSessionAborterIntegrationTest {
verificationCustomText: UUID().uuidString,
identityTypeLabel: UUID().uuidString,
quickCodeEnabled: true,
limitQuickCodeRegistration: false,
identityType: .email,
sessionId: sessionId,
sessionDescription: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ struct CrossDeviceSessionAuthenticationIntegrationTest {
verificationCustomText: UUID().uuidString,
identityTypeLabel: UUID().uuidString,
quickCodeEnabled: true,
limitQuickCodeRegistration: false,
identityType: .email,
sessionId: sessionId,
sessionDescription: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,41 +240,6 @@ class QuickCodeIntegrationTests: XCTestCase {
assertError(current: authenticationError, expected: AuthenticationError.revoked)
}

func testLimitedQuickCodeGeneration() throws {
try MIRACLTrust.configure(with: XCTUnwrap(configuration))

let (user, regError) = registrationTestCase.registerUser(
userId: userId,
activationToken: activationToken
)
XCTAssertNil(regError)
XCTAssertNotNil(user)

// Register user with QuickCode
var (quickCode, quickCodeError) = try quickCodeTestCase.generateQuickCode(user: XCTUnwrap(user))
XCTAssertNil(quickCodeError)
XCTAssertNotNil(quickCode)

let (newActicationTokenResponse, _) = try getActivationToken.getActivationToken(userId: userId, code: XCTUnwrap(quickCode?.code))

let (quickCodeGeneratedUser, quickCodeUserRegError) = try registrationTestCase.registerUser(
userId: userId,
activationToken: XCTUnwrap(newActicationTokenResponse?.activationToken)
)
XCTAssertNil(quickCodeUserRegError)
XCTAssertNotNil(quickCodeGeneratedUser)

// Try to generate QuickCode with user registered with QuickCode and Limit QuickCode Verified
// option enabled for the project.
(quickCode, quickCodeError) = try quickCodeTestCase.generateQuickCode(user: XCTUnwrap(quickCodeGeneratedUser))
XCTExpectFailure("QuickCodeError.limitedQuickCodeGeneration is currently disabled and quick code is generated")
XCTAssertNil(quickCode)
assertError(
current: quickCodeError,
expected: QuickCodeError.limitedQuickCodeGeneration
)
}

func createRandomUser(
mpinId: Data = Data([1, 2, 3]),
token: Data = Data([4, 5, 6]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ class SigningIntegrationTests: XCTestCase {
verificationCustomText: UUID().uuidString,
identityTypeLabel: UUID().uuidString,
quickCodeEnabled: Bool.random(),
limitQuickCodeRegistration: Bool.random(),
identityType: .alphanumeric,
sessionId: sessionId,
signingHash: UUID().uuidString,
Expand Down
6 changes: 0 additions & 6 deletions MIRACLTrust/MIRACLTrustTests/APIRequestExecutorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,6 @@ class APIRequestExecutorTests: XCTestCase {
try testInvalidErrorCodes(code)
}

func testQuickCodeLimited() throws {
let code = "QUICKCODE_LIMITED"

try testInvalidErrorCodes(code)
}

func testMpinIDExpired() throws {
let code = "MPINID_EXPIRED"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ final class CrossDeviceSessionAuthenticatorTest: XCTestCase {
verificationCustomText: randomString,
identityTypeLabel: randomString,
quickCodeEnabled: true,
limitQuickCodeRegistration: true,
identityType: .alphanumeric,
sessionId: randomString,
sessionDescription: "",
Expand Down
Loading