Skip to content
Open
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
28 changes: 14 additions & 14 deletions RIADigiDoc.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
DF4E43CB2D0BA38600967997 /* FileImportShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = DF4E43C12D0BA38600967997 /* FileImportShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
DF4E6D822D11DE7B00F6111A /* CommonsLib in Frameworks */ = {isa = PBXBuildFile; productRef = DF4E6D812D11DE7B00F6111A /* CommonsLib */; };
DF4E6D842D120CFC00F6111A /* UtilsLib in Frameworks */ = {isa = PBXBuildFile; productRef = DF4E6D832D120CFC00F6111A /* UtilsLib */; };
DF54F82F2D431BD50021D05A /* X509 in Frameworks */ = {isa = PBXBuildFile; productRef = DF54F82E2D431BD50021D05A /* X509 */; };
DF5903762ECCC41F00D1A278 /* MobileIdLibMocks in Frameworks */ = {isa = PBXBuildFile; productRef = DF5903752ECCC41F00D1A278 /* MobileIdLibMocks */; };
DF5903782ECCC42500D1A278 /* SmartIdLibMocks in Frameworks */ = {isa = PBXBuildFile; productRef = DF5903772ECCC42500D1A278 /* SmartIdLibMocks */; };
DF5C54272E82F07A006E2251 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = DFA3EE5C2D14C9B7001D951B /* Alamofire */; };
Expand All @@ -53,7 +54,6 @@
DFB663A22F16917E00804545 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DFB663A12F16917E00804545 /* SwiftUI.framework */; };
DFB663AF2F16918100804545 /* WidgetExtensionExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = DFB6639E2F16917D00804545 /* WidgetExtensionExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
DFBD09F62CE3FBDC006AF9C2 /* LibdigidocLib in Frameworks */ = {isa = PBXBuildFile; productRef = DFBD09F52CE3FBDC006AF9C2 /* LibdigidocLib */; };
DF54F82F2D431BD50021D05A /* X509 in Frameworks */ = {isa = PBXBuildFile; productRef = DF54F82E2D431BD50021D05A /* X509 */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -1704,6 +1704,14 @@
version = 12.12.1;
};
};
DF54F82D2D431BD50021D05A /* XCRemoteSwiftPackageReference "swift-certificates" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-certificates.git";
requirement = {
kind = exactVersion;
version = 1.19.0;
};
};
DF9AFE902E00D30A0062C64D /* XCRemoteSwiftPackageReference "Factory" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/hmlongco/Factory";
Expand All @@ -1728,14 +1736,6 @@
version = 0.63.2;
};
};
DF54F82D2D431BD50021D05A /* XCRemoteSwiftPackageReference "swift-certificates" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-certificates.git";
requirement = {
kind = exactVersion;
version = 1.19.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down Expand Up @@ -1818,6 +1818,11 @@
isa = XCSwiftPackageProductDependency;
productName = UtilsLib;
};
DF54F82E2D431BD50021D05A /* X509 */ = {
isa = XCSwiftPackageProductDependency;
package = DF54F82D2D431BD50021D05A /* XCRemoteSwiftPackageReference "swift-certificates" */;
productName = X509;
};
DF5903752ECCC41F00D1A278 /* MobileIdLibMocks */ = {
isa = XCSwiftPackageProductDependency;
productName = MobileIdLibMocks;
Expand Down Expand Up @@ -1917,11 +1922,6 @@
isa = XCSwiftPackageProductDependency;
productName = LibdigidocLib;
};
DF54F82E2D431BD50021D05A /* X509 */ = {
isa = XCSwiftPackageProductDependency;
package = DF54F82D2D431BD50021D05A /* XCRemoteSwiftPackageReference "swift-certificates" */;
productName = X509;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = DFDB14732CC97B0E00153876 /* Project object */;
Expand Down
6 changes: 6 additions & 0 deletions RIADigiDoc/Domain/Model/IdCard/PinResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ public struct PinResponse: Sendable, Hashable {
let pukRetryCount: UInt8
let pukActive: Bool
}

extension PinResponse {
var isCourierCard: Bool {
!pin1Active
}
}
1 change: 1 addition & 0 deletions RIADigiDoc/Domain/NFC/IdCardError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum IdCardError: Error {
case invalidNewPIN
case sessionError
case pinLocked
case notActivated
}

extension IdCardError {
Expand Down
3 changes: 3 additions & 0 deletions RIADigiDoc/Domain/NFC/IdCardInternalError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public enum IdCardInternalError: Error {
case failedToRemovePadding
case notSupportedAlgorithm
case pinLocked
case notActivated

public func getIdCardError() -> IdCardError {
switch self {
Expand All @@ -60,6 +61,8 @@ public enum IdCardInternalError: Error {
return .wrongPIN(triesLeft: 0)
case .pinLocked:
return .pinLocked
case .notActivated:
return .notActivated
case .cancelledByUser:
return .cancelledByUser
case .invalidNewPin:
Expand Down
5 changes: 4 additions & 1 deletion RIADigiDoc/Domain/NFC/OperationDecrypt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ public class OperationDecrypt: NFCOperationBase, OperationDecryptProtocol {
let cardCommands = try await connection.getCardCommands(session, tag: tag, CAN: canNumber)
updateAlertMessage(step: 3)

let (retryCount, _) = try await cardCommands.readCodeTryCounterRecord(.pin1)
let (retryCount, pin1Active) = try await cardCommands.readCodeTryCounterRecord(.pin1)

if retryCount == 0 {
throw IdCardInternalError.remainingPinRetryCount(Int(retryCount))
}
if pin1Active {
throw IdCardInternalError.notActivated
}

let cert = try await cardCommands.readAuthenticationCertificate()
updateAlertMessage(step: 4)
Expand Down
5 changes: 5 additions & 0 deletions RIADigiDoc/Domain/NFC/OperationReadCertAndSign.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public class OperationReadCertAndSign: NFCOperationBase, OperationReadCertAndSig

updateAlertMessage(step: 3)

let (_, pin1Active) = try await cardCommands.readCodeTryCounterRecord(.pin1)
if pin1Active {
throw IdCardInternalError.notActivated
}

let (retryCount, pinActive) = try await cardCommands.readCodeTryCounterRecord(.pin2)

if retryCount == 0 {
Expand Down
90 changes: 90 additions & 0 deletions RIADigiDoc/Supporting files/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -8219,6 +8219,96 @@
}
}
}
},
"ID card courier activate URL" : {
"comment" : "Courier (unactivated) ID-card activation URL",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://www.politsei.ee/en/self-service-portal/"
}
},
"et" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://www.politsei.ee/et/iseteenindus/"
}
}
}
},
"ID card courier activate button" : {
"comment" : "Courier (unactivated) ID-card activation link text",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Activate ID-card"
}
},
"et" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aktiveeri ID-kaart"
}
}
}
},
"ID card courier must activate to decrypt" : {
"comment" : "Courier (unactivated) ID-card message shown during decryption",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The ID-card must be activated in order to decrypt."
}
},
"et" : {
"stringUnit" : {
"state" : "translated",
"value" : "Dekrüpteerimiseks tuleb ID-kaart aktiveerida."
}
}
}
},
"ID card courier must activate to sign" : {
"comment" : "Courier (unactivated) ID-card message shown during signing",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The ID-card must be activated in order to sign."
}
},
"et" : {
"stringUnit" : {
"state" : "translated",
"value" : "Allkirjastamiseks tuleb ID-kaart aktiveerida."
}
}
}
},
"ID card courier warning message" : {
"comment" : "Courier (unactivated) ID-card warning shown in My eID",
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Authentication and signing with the ID-card isn't possible yet. ID-card must be activated in the Police and Border Guard Board's self-service portal in order to use it."
}
},
"et" : {
"stringUnit" : {
"state" : "translated",
"value" : "ID-kaardiga isikutuvastamine ja allkirjastamine ei ole veel võimalik. ID-kaardi kasutamiseks tuleb see aktiveerida Politsei- ja Piirivalveameti iseteeninduses."
}
}
}
}
},
"version" : "1.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ struct EncryptRecipientView: View {
}
.onChange(of: viewModel.successMessage) { _, message in
guard let message, !message.key.isEmpty else { return }
let localizedMessage = languageSettings.localized(message.key, [message.args.joined(separator: ", ")])
let localizedMessage = languageSettings.localized(
message.key, [message.args.joined(separator: ", ")]
)
Toast.show(localizedMessage, type: .success)

if voiceOverEnabled {
Expand Down
5 changes: 4 additions & 1 deletion RIADigiDoc/UI/Component/CryptoFileOpeningView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ struct CryptoFileOpeningView: View {
}
}
} else {
let localizedMessage = languageSettings.localized(errorMessage?.key ?? "General error", errorMessage?.args ?? [])
let localizedMessage = languageSettings.localized(
errorMessage?.key ?? "General error", errorMessage?.args ?? []
)

Toast.show(localizedMessage)

if voiceOverEnabled {
Expand Down
5 changes: 4 additions & 1 deletion RIADigiDoc/UI/Component/FileOpeningView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ struct FileOpeningView: View {
}
}
} else {
let localizedMessage = languageSettings.localized(errorMessage?.key ?? "General error", errorMessage?.args ?? [])
let localizedMessage = languageSettings.localized(
errorMessage?.key ?? "General error", errorMessage?.args ?? []
)

Toast.show(localizedMessage)

if voiceOverEnabled {
Expand Down
7 changes: 5 additions & 2 deletions RIADigiDoc/UI/Component/My eID/MyEidCertificateCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct MyEidCertificateCardView: View {
let changePinText: String
let isPinBlocked: Bool
let isPukBlocked: Bool
let isNotActivated: Bool
let showForgotPin: Bool
let onForgotPinClick: (() -> Void)?
let onChangePinClick: (() -> Void)?
Expand All @@ -45,6 +46,7 @@ struct MyEidCertificateCardView: View {
changePinText: String = "",
isPinBlocked: Bool = false,
isPukBlocked: Bool = false,
isNotActivated: Bool = false,
showForgotPin: Bool = true,
onForgotPinClick: (() -> Void)? = nil,
onChangePinClick: (() -> Void)? = nil,
Expand All @@ -58,6 +60,7 @@ struct MyEidCertificateCardView: View {
self.changePinText = changePinText
self.isPinBlocked = isPinBlocked
self.isPukBlocked = isPukBlocked
self.isNotActivated = isNotActivated
self.showForgotPin = showForgotPin
self.onForgotPinClick = onForgotPinClick
self.onChangePinClick = onChangePinClick
Expand Down Expand Up @@ -107,7 +110,7 @@ struct MyEidCertificateCardView: View {
PrimaryOutlinedButton(
text: forgotPinText,
assetImageName: nil,
isButtonEnabled: !isPukBlocked,
isButtonEnabled: !isPukBlocked && !isNotActivated,
action: onForgotPinClick ?? {},
focusedField: forgotPinAccessibilityField,
currentFocus: $lastFocused
Expand All @@ -116,7 +119,7 @@ struct MyEidCertificateCardView: View {

PrimaryButton(
text: changePinText,
isButtonEnabled: !isPinBlocked,
isButtonEnabled: !isPinBlocked && !isNotActivated,
action: onChangePinClick ?? {},
focusedField: changePinAccessibilityField,
currentFocus: $lastFocused
Expand Down
Loading
Loading