|
@@ -69,12 +69,13 @@ class NCEndToEndInitialize: NSObject {
|
|
|
switch error.errorCode {
|
|
|
|
|
|
case NCGlobal.shared.errorBadRequest:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E get publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E get publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorResourceNotFound:
|
|
|
guard let csr = NCEndToEndEncryption.sharedManager().createCSR(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData()) else {
|
|
|
-
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Csr", description: "Error to create Csr", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "Error to create Csr")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Csr", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
return
|
|
|
}
|
|
@@ -86,8 +87,8 @@ class NCEndToEndInitialize: NSObject {
|
|
|
// TEST publicKey
|
|
|
let extractedPublicKey = NCEndToEndEncryption.sharedManager().extractPublicKey(fromCertificate: certificate)
|
|
|
if extractedPublicKey != NCEndToEndEncryption.sharedManager().generatedPublicKey {
|
|
|
-
|
|
|
- NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: "error: the public key is incorrect", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "error: the public key is incorrect")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -102,22 +103,25 @@ class NCEndToEndInitialize: NSObject {
|
|
|
switch error.errorCode {
|
|
|
|
|
|
case NCGlobal.shared.errorBadRequest:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorConflict:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: "conflict: a public key for the user already exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "conflict: a public key for the user already exists")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
default:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E sign publicKey", description: error.errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E sign publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
case NCGlobal.shared.errorConflict:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E get publicKey", description: "forbidden: the user can't access the public keys", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the public keys")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E get publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
default:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E get publicKey", description: error.errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E get publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -143,8 +147,8 @@ class NCEndToEndInitialize: NSObject {
|
|
|
let publicKey = CCUtility.getEndToEndCertificate(self.appDelegate.account)
|
|
|
|
|
|
guard let privateKey = (NCEndToEndEncryption.sharedManager().decryptPrivateKey(privateKeyChiper, passphrase: passphrase, publicKey: publicKey)) else {
|
|
|
-
|
|
|
- NCContentPresenter.shared.messageNotification("E2E decrypt privateKey", description: "Serious internal error to decrypt Private Key", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, priority: .max)
|
|
|
+ let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "Serious internal error to decrypt Private Key")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E decrypt privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
return
|
|
|
}
|
|
@@ -174,16 +178,19 @@ class NCEndToEndInitialize: NSObject {
|
|
|
switch error.errorCode {
|
|
|
|
|
|
case NCGlobal.shared.errorBadRequest:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorResourceNotFound:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "Server publickey doesn't exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "Server publickey doesn't exists")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorConflict:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "forbidden: the user can't access the Server publickey", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the Server publickey")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
default:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: error.errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -206,7 +213,8 @@ class NCEndToEndInitialize: NSObject {
|
|
|
switch error.errorCode {
|
|
|
|
|
|
case NCGlobal.shared.errorBadRequest:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E get privateKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E get privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorResourceNotFound:
|
|
|
// message
|
|
@@ -220,7 +228,8 @@ class NCEndToEndInitialize: NSObject {
|
|
|
var privateKeyString: NSString?
|
|
|
|
|
|
guard let privateKeyChiper = NCEndToEndEncryption.sharedManager().encryptPrivateKey(self.appDelegate.userId, directory: CCUtility.getDirectoryUserData(), passphrase: e2ePassphrase, privateKey: &privateKeyString) else {
|
|
|
- NCContentPresenter.shared.messageNotification("E2E privateKey", description: "Serious internal error to create PrivateKey chiper", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "Serious internal error to create PrivateKey chiper")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -252,16 +261,19 @@ class NCEndToEndInitialize: NSObject {
|
|
|
switch error.errorCode {
|
|
|
|
|
|
case NCGlobal.shared.errorBadRequest:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorResourceNotFound:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "Server publickey doesn't exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "Server publickey doesn't exists")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorConflict:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: "forbidden: the user can't access the Server publickey", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the Server publickey")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
default:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E Server publicKey", description: error.errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E Server publicKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -271,13 +283,15 @@ class NCEndToEndInitialize: NSObject {
|
|
|
switch error.errorCode {
|
|
|
|
|
|
case NCGlobal.shared.errorBadRequest:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E store privateKey", description: "bad request: unpredictable internal error", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "bad request: unpredictable internal error")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E store privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
case NCGlobal.shared.errorConflict:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E store privateKey", description: "conflict: a private key for the user already exists", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "conflict: a private key for the user already exists")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E store privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
default:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E store privateKey", description: error.errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E store privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -287,10 +301,11 @@ class NCEndToEndInitialize: NSObject {
|
|
|
self.appDelegate.window?.rootViewController?.present(alertController, animated: true)
|
|
|
|
|
|
case NCGlobal.shared.errorConflict:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E get privateKey", description: "forbidden: the user can't access the private key", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ let error = NKError(errorCode: error.errorCode, errorDescription: "forbidden: the user can't access the private key")
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E get privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
|
|
|
default:
|
|
|
- NCContentPresenter.shared.messageNotification("E2E get privateKey", description: error.errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: error.errorCode, priority: .max)
|
|
|
+ NCContentPresenter.shared.messageNotification("E2E get privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
|
|
}
|
|
|
}
|
|
|
}
|