Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
This commit is contained in:
Marino Faggiana 2023-09-05 09:09:23 +02:00
Родитель 6fd88c97d1
Коммит 2c024f052e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 2F5F63C3EF460487
8 изменённых файлов: 97 добавлений и 87 удалений

Просмотреть файл

@ -26,4 +26,4 @@ import Foundation
// Database Realm
//
let databaseName = "nextcloud.realm"
let databaseSchemaVersion: UInt64 = 317
let databaseSchemaVersion: UInt64 = 318

Просмотреть файл

@ -4670,7 +4670,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -4735,7 +4735,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;

Просмотреть файл

@ -34,8 +34,8 @@ class tableE2eEncryptionLock: Object {
@Persisted var e2eToken = ""
}
typealias tableE2eEncryption = tableE2eEncryptionV2
class tableE2eEncryptionV2: Object {
typealias tableE2eEncryption = tableE2eEncryptionV3
class tableE2eEncryptionV3: Object {
@Persisted(primaryKey: true) var primaryKey = ""
@Persisted var account = ""
@ -65,7 +65,7 @@ class tableE2eEncryptionV2: Object {
// MARK: -
// MARK: Table V1, V1.2
class tableE2eMetadata: Object {
class tableE2eMetadata12: Object {
@Persisted(primaryKey: true) var serverUrl = ""
@Persisted var account = ""
@ -76,6 +76,7 @@ class tableE2eMetadata: Object {
// MARK: -
// MARK: Table V2
typealias tableE2eMetadata = tableE2eMetadataV2
class tableE2eMetadataV2: Object {
@Persisted(primaryKey: true) var primaryKey = ""
@ -95,7 +96,7 @@ class tableE2eMetadataV2: Object {
}
}
class tableE2eCounterV2: Object {
class tableE2eCounter: Object {
@Persisted(primaryKey: true) var primaryKey: String
@Persisted var account: String
@ -111,7 +112,7 @@ class tableE2eCounterV2: Object {
}
}
class tableE2eUsersV2: Object {
class tableE2eUsers: Object {
@Persisted(primaryKey: true) var primaryKey = ""
@Persisted var account = ""
@ -131,7 +132,7 @@ class tableE2eUsersV2: Object {
}
}
class tableE2eUsersFiledropV2: Object {
class tableE2eUsersFiledrop: Object {
@Persisted(primaryKey: true) var primaryKey = ""
@Persisted var account = ""
@ -288,12 +289,12 @@ extension NCManageDatabase {
// MARK: -
// MARK: V1
func getE2eMetadata(account: String, serverUrl: String) -> tableE2eMetadata? {
func getE2eMetadata(account: String, serverUrl: String) -> tableE2eMetadata12? {
do {
let realm = try Realm()
guard let result = realm.objects(tableE2eMetadata.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).first else { return nil }
return tableE2eMetadata.init(value: result)
guard let result = realm.objects(tableE2eMetadata12.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).first else { return nil }
return tableE2eMetadata12.init(value: result)
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
}
@ -306,7 +307,7 @@ extension NCManageDatabase {
do {
let realm = try Realm()
try realm.write {
let object = tableE2eMetadata()
let object = tableE2eMetadata12()
object.account = account
object.metadataKey = metadataKey
object.serverUrl = serverUrl
@ -321,18 +322,18 @@ extension NCManageDatabase {
// MARK: -
// MARK: V2
func addE2EUsersV2(account: String,
serverUrl: String,
ocIdServerUrl: String,
userId: String,
certificate: String,
encryptedMetadataKey: String?,
metadataKey: Data?) {
func addE2EUsers(account: String,
serverUrl: String,
ocIdServerUrl: String,
userId: String,
certificate: String,
encryptedMetadataKey: String?,
metadataKey: Data?) {
do {
let realm = try Realm()
try realm.write {
let object = tableE2eUsersV2.init(account: account, ocIdServerUrl: ocIdServerUrl, userId: userId)
let object = tableE2eUsers.init(account: account, ocIdServerUrl: ocIdServerUrl, userId: userId)
object.certificate = certificate
object.encryptedMetadataKey = encryptedMetadataKey
object.metadataKey = metadataKey
@ -344,12 +345,12 @@ extension NCManageDatabase {
}
}
func deleteE2EUsersV2(account: String, ocIdServerUrl: String, userId: String) {
func deleteE2EUsers(account: String, ocIdServerUrl: String, userId: String) {
do {
let realm = try Realm()
try realm.write {
if let result = realm.objects(tableE2eUsersV2.self).filter("account == %@ AND ocIdServerUrl == %@ AND userId == %@", account, ocIdServerUrl, userId).first {
if let result = realm.objects(tableE2eUsers.self).filter("account == %@ AND ocIdServerUrl == %@ AND userId == %@", account, ocIdServerUrl, userId).first {
realm.delete(result)
}
}
@ -358,11 +359,11 @@ extension NCManageDatabase {
}
}
func getE2EUsersV2(account: String, ocIdServerUrl: String) -> Results<tableE2eUsersV2>? {
func getE2EUsers(account: String, ocIdServerUrl: String) -> Results<tableE2eUsers>? {
do {
let realm = try Realm()
return realm.objects(tableE2eUsersV2.self).filter("account == %@ AND ocIdServerUrl == %@", account, ocIdServerUrl)
return realm.objects(tableE2eUsers.self).filter("account == %@ AND ocIdServerUrl == %@", account, ocIdServerUrl)
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
}
@ -370,11 +371,11 @@ extension NCManageDatabase {
return nil
}
func getE2EUsersV2(account: String, ocIdServerUrl: String, userId: String) -> tableE2eUsersV2? {
func getE2EUsers(account: String, ocIdServerUrl: String, userId: String) -> tableE2eUsers? {
do {
let realm = try Realm()
return realm.objects(tableE2eUsersV2.self).filter("account == %@ && ocIdServerUrl == %@ AND userId == %@", account, ocIdServerUrl, userId).first
return realm.objects(tableE2eUsers.self).filter("account == %@ && ocIdServerUrl == %@ AND userId == %@", account, ocIdServerUrl, userId).first
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
}
@ -382,11 +383,11 @@ extension NCManageDatabase {
return nil
}
func getE2EUsersFiledropV2(account: String, ocIdServerUrl: String, userId: String) -> tableE2eUsersFiledropV2? {
func getE2EUsersFiledrop(account: String, ocIdServerUrl: String, userId: String) -> tableE2eUsersFiledrop? {
do {
let realm = try Realm()
return realm.objects(tableE2eUsersFiledropV2.self).filter("account == %@ && ocIdServerUrl == %@ AND userId == %@", account, ocIdServerUrl, userId).first
return realm.objects(tableE2eUsersFiledrop.self).filter("account == %@ && ocIdServerUrl == %@ AND userId == %@", account, ocIdServerUrl, userId).first
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
}
@ -394,11 +395,11 @@ extension NCManageDatabase {
return nil
}
func getE2eMetadataV2(account: String, ocIdServerUrl: String) -> tableE2eMetadataV2? {
func getE2eMetadata(account: String, ocIdServerUrl: String) -> tableE2eMetadata? {
do {
let realm = try Realm()
return realm.objects(tableE2eMetadataV2.self).filter("account == %@ && ocIdServerUrl == %@", account, ocIdServerUrl).first
return realm.objects(tableE2eMetadata.self).filter("account == %@ && ocIdServerUrl == %@", account, ocIdServerUrl).first
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
}
@ -406,12 +407,12 @@ extension NCManageDatabase {
return nil
}
func addE2eMetadataV2(account: String, serverUrl: String, ocIdServerUrl: String, keyChecksums: [String]?, deleted: Bool, folders: [String: String]?, version: String) {
func addE2eMetadata(account: String, serverUrl: String, ocIdServerUrl: String, keyChecksums: [String]?, deleted: Bool, folders: [String: String]?, version: String) {
do {
let realm = try Realm()
try realm.write {
let object = tableE2eMetadataV2.init(account: account, ocIdServerUrl: ocIdServerUrl)
let object = tableE2eMetadata.init(account: account, ocIdServerUrl: ocIdServerUrl)
if let keyChecksums {
object.keyChecksums.append(objectsIn: keyChecksums)
}
@ -431,12 +432,12 @@ extension NCManageDatabase {
}
}
func updateCounterE2eMetadataV2(account: String, ocIdServerUrl: String, counter: Int) {
func updateCounterE2eMetadata(account: String, ocIdServerUrl: String, counter: Int) {
do {
let realm = try Realm()
try realm.write {
let object = tableE2eCounterV2.init(account: account, ocIdServerUrl: ocIdServerUrl, counter: counter)
let object = tableE2eCounter.init(account: account, ocIdServerUrl: ocIdServerUrl, counter: counter)
realm.add(object, update: .all)
}
} catch let error {
@ -444,11 +445,11 @@ extension NCManageDatabase {
}
}
func getCounterE2eMetadataV2(account: String, ocIdServerUrl: String) -> Int? {
func getCounterE2eMetadata(account: String, ocIdServerUrl: String) -> Int? {
do {
let realm = try Realm()
return realm.objects(tableE2eCounterV2.self).filter("account == %@ && ocIdServerUrl == %@", account, ocIdServerUrl).first?.counter
return realm.objects(tableE2eCounter.self).filter("account == %@ && ocIdServerUrl == %@", account, ocIdServerUrl).first?.counter
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
}

Просмотреть файл

@ -71,7 +71,26 @@ class NCManageDatabase: NSObject {
let config = Realm.Configuration(
fileURL: dirGroup?.appendingPathComponent(NCGlobal.shared.appDatabaseNextcloud + "/" + databaseName),
schemaVersion: databaseSchemaVersion,
objectTypes: [tableMetadata.self, tableLocalFile.self, tableDirectory.self, tableTag.self, tableAccount.self, tableCapabilities.self, tablePhotoLibrary.self, tableE2eEncryption.self, tableE2eEncryptionLock.self, tableE2eMetadata.self, tableShare.self, tableChunk.self, tableAvatar.self, tableDashboardWidget.self, tableDashboardWidgetButton.self, NCDBLayoutForView.self]
objectTypes: [tableMetadata.self,
tableLocalFile.self,
tableDirectory.self,
tableTag.self,
tableAccount.self,
tableCapabilities.self,
tablePhotoLibrary.self,
tableE2eEncryption.self,
tableE2eEncryptionLock.self,
tableE2eMetadata12.self,
tableE2eMetadata.self,
tableE2eUsers.self,
tableE2eCounter.self,
tableE2eUsersFiledrop.self,
tableShare.self,
tableChunk.self,
tableAvatar.self,
tableDashboardWidget.self,
tableDashboardWidgetButton.self,
NCDBLayoutForView.self]
)
Realm.Configuration.defaultConfiguration = config
@ -104,8 +123,6 @@ class NCManageDatabase: NSObject {
migration.deleteData(forType: tableChunk.className())
migration.deleteData(forType: tableMetadata.className())
migration.deleteData(forType: tableE2eEncryptionLock.className())
migration.deleteData(forType: tableE2eEncryption.className())
migration.deleteData(forType: tableE2eMetadata.className())
}
}, shouldCompactOnLaunch: { totalBytes, usedBytes in
@ -204,12 +221,6 @@ class NCManageDatabase: NSObject {
self.clearTable(tableDirectEditingCreators.self, account: account)
self.clearTable(tableDirectEditingEditors.self, account: account)
self.clearTable(tableDirectory.self, account: account)
self.clearTable(tableE2eEncryption.self, account: account)
self.clearTable(tableE2eEncryptionLock.self, account: account)
self.clearTable(tableE2eMetadata.self, account: account)
self.clearTable(tableE2eMetadataV2.self, account: account)
self.clearTable(tableE2eUsersV2.self, account: account)
self.clearTable(tableE2eCounterV2.self, account: account)
self.clearTable(tableExternalSites.self, account: account)
self.clearTable(tableGPS.self, account: nil)
self.clearTable(TableGroupfolders.self, account: account)
@ -224,12 +235,24 @@ class NCManageDatabase: NSObject {
self.clearTable(tableTrash.self, account: account)
self.clearTable(tableUserStatus.self, account: account)
self.clearTable(tableVideo.self, account: account)
self.clearTablesE2EE(account: account)
if removeAccount {
self.clearTable(tableAccount.self, account: account)
}
}
func clearTablesE2EE(account: String?) {
self.clearTable(tableE2eEncryption.self, account: account)
self.clearTable(tableE2eEncryptionLock.self, account: account)
self.clearTable(tableE2eMetadata12.self, account: account)
self.clearTable(tableE2eMetadata.self, account: account)
self.clearTable(tableE2eUsers.self, account: account)
self.clearTable(tableE2eCounter.self, account: account)
self.clearTable(tableE2eUsersFiledrop.self, account: account)
}
@objc func removeDB() {
let realmURL = Realm.Configuration.defaultConfiguration.fileURL!

Просмотреть файл

@ -121,7 +121,7 @@ extension NCEndToEndMetadata {
if let metadataKeyEncrypted = NCEndToEndEncryption.sharedManager().encryptAsymmetricData(key, certificate: certificate) {
let encryptedMetadataKey = metadataKeyEncrypted.base64EncodedString()
NCManageDatabase.shared.addE2EUsersV2(account: account, serverUrl: serverUrl, ocIdServerUrl: ocIdServerUrl, userId: userId, certificate: certificate, encryptedMetadataKey: encryptedMetadataKey, metadataKey: key)
NCManageDatabase.shared.addE2EUsers(account: account, serverUrl: serverUrl, ocIdServerUrl: ocIdServerUrl, userId: userId, certificate: certificate, encryptedMetadataKey: encryptedMetadataKey, metadataKey: key)
}
}
@ -130,7 +130,7 @@ extension NCEndToEndMetadata {
guard var key = NCEndToEndEncryption.sharedManager()?.generateKey() as? Data else {
return (nil, nil, 0, NKError(errorCode: NCGlobal.shared.errorUnexpectedResponseFromDB, errorDescription: "_e2e_error_"))
}
if let tableUserId = NCManageDatabase.shared.getE2EUsersV2(account: account, ocIdServerUrl: directoryTop.ocId, userId: userId),
if let tableUserId = NCManageDatabase.shared.getE2EUsers(account: account, ocIdServerUrl: directoryTop.ocId, userId: userId),
let metadataKey = tableUserId.metadataKey {
key = metadataKey
} else {
@ -142,10 +142,10 @@ extension NCEndToEndMetadata {
}
// REMOVEUSERID
if let removeUserId {
NCManageDatabase.shared.deleteE2EUsersV2(account: account, ocIdServerUrl: ocIdServerUrl, userId: removeUserId)
NCManageDatabase.shared.deleteE2EUsers(account: account, ocIdServerUrl: ocIdServerUrl, userId: removeUserId)
}
// FOR SECURITY recreate all users with key
if let users = NCManageDatabase.shared.getE2EUsersV2(account: account, ocIdServerUrl: ocIdServerUrl) {
if let users = NCManageDatabase.shared.getE2EUsers(account: account, ocIdServerUrl: ocIdServerUrl) {
for user in users {
addUser(userId: user.userId, certificate: user.certificate, key: key)
}
@ -155,7 +155,7 @@ extension NCEndToEndMetadata {
} else {
guard let tableUserId = NCManageDatabase.shared.getE2EUsersV2(account: account, ocIdServerUrl: directoryTop.ocId, userId: userId), let key = tableUserId.metadataKey else {
guard let tableUserId = NCManageDatabase.shared.getE2EUsers(account: account, ocIdServerUrl: directoryTop.ocId, userId: userId), let key = tableUserId.metadataKey else {
return (nil, nil, 0, NKError(errorCode: NCGlobal.shared.errorUnexpectedResponseFromDB, errorDescription: "_e2e_error_"))
}
@ -165,7 +165,7 @@ extension NCEndToEndMetadata {
// USERS
// CHECKSUM
//
if let users = NCManageDatabase.shared.getE2EUsersV2(account: account, ocIdServerUrl: directoryTop.ocId) {
if let users = NCManageDatabase.shared.getE2EUsers(account: account, ocIdServerUrl: directoryTop.ocId) {
for user in users {
if isDirectoryTop {
usersCodable.append(E2eeV20.Users(userId: user.userId, certificate: user.certificate, encryptedMetadataKey: user.encryptedMetadataKey))
@ -179,7 +179,7 @@ extension NCEndToEndMetadata {
// COUNTER + 1
//
if let resultCounter = NCManageDatabase.shared.getCounterE2eMetadataV2(account: account, ocIdServerUrl: ocIdServerUrl) {
if let resultCounter = NCManageDatabase.shared.getCounterE2eMetadata(account: account, ocIdServerUrl: ocIdServerUrl) {
counter = resultCounter + 1
}
@ -307,22 +307,22 @@ extension NCEndToEndMetadata {
metadataKey = decrypted
}
}
NCManageDatabase.shared.addE2EUsersV2(account: account, serverUrl: serverUrl, ocIdServerUrl: ocIdServerUrl, userId: user.userId, certificate: user.certificate, encryptedMetadataKey: user.encryptedMetadataKey, metadataKey: metadataKey)
NCManageDatabase.shared.addE2EUsers(account: account, serverUrl: serverUrl, ocIdServerUrl: ocIdServerUrl, userId: user.userId, certificate: user.certificate, encryptedMetadataKey: user.encryptedMetadataKey, metadataKey: metadataKey)
}
}
// GET metadataKey, decryptedMetadataKey
//
guard let tableE2eUsersV2 = NCManageDatabase.shared.getE2EUsersV2(account: account, ocIdServerUrl: directoryTop.ocId, userId: userId),
let metadataKey = tableE2eUsersV2.metadataKey?.base64EncodedString(),
let decryptedMetadataKey = tableE2eUsersV2.metadataKey else {
guard let objUsers = NCManageDatabase.shared.getE2EUsers(account: account, ocIdServerUrl: directoryTop.ocId, userId: userId),
let metadataKey = objUsers.metadataKey?.base64EncodedString(),
let decryptedMetadataKey = objUsers.metadataKey else {
return NKError(errorCode: NCGlobal.shared.errorE2EENoUserFound, errorDescription: "_e2e_error_")
}
// SIGNATURE CHECK
//
guard let signature,
verifySignature(account: account, signature: signature, userId: tableE2eUsersV2.userId, metadata: metadata, users: users, version: version, certificate: tableE2eUsersV2.certificate) else {
verifySignature(account: account, signature: signature, userId: objUsers.userId, metadata: metadata, users: users, version: version, certificate: objUsers.certificate) else {
return NKError(errorCode: NCGlobal.shared.errorE2EEKeyVerifySignature, errorDescription: "_e2e_error_")
}
@ -368,18 +368,18 @@ extension NCEndToEndMetadata {
// COUNTER CHECK
//
if let resultCounter = NCManageDatabase.shared.getCounterE2eMetadataV2(account: account, ocIdServerUrl: ocIdServerUrl) {
if let resultCounter = NCManageDatabase.shared.getCounterE2eMetadata(account: account, ocIdServerUrl: ocIdServerUrl) {
print("Counter saved: \(resultCounter)")
if jsonCiphertextMetadata.counter < resultCounter {
// TODO: whats happen with < ?
NCContentPresenter.shared.showError(error: NKError(errorCode: NCGlobal.shared.errorE2EECounter, errorDescription: NSLocalizedString("_e2e_error_", comment: "")))
} else if jsonCiphertextMetadata.counter > resultCounter {
print("Counter UPDATED: \(jsonCiphertextMetadata.counter)")
NCManageDatabase.shared.updateCounterE2eMetadataV2(account: account, ocIdServerUrl: ocIdServerUrl, counter: jsonCiphertextMetadata.counter)
NCManageDatabase.shared.updateCounterE2eMetadata(account: account, ocIdServerUrl: ocIdServerUrl, counter: jsonCiphertextMetadata.counter)
}
} else {
print("Counter RESET: \(jsonCiphertextMetadata.counter)")
NCManageDatabase.shared.updateCounterE2eMetadataV2(account: account, ocIdServerUrl: ocIdServerUrl, counter: jsonCiphertextMetadata.counter)
NCManageDatabase.shared.updateCounterE2eMetadata(account: account, ocIdServerUrl: ocIdServerUrl, counter: jsonCiphertextMetadata.counter)
}
// DELETE CHECK
@ -388,13 +388,13 @@ extension NCEndToEndMetadata {
// TODO: We need to check deleted, id yes ???
}
NCManageDatabase.shared.addE2eMetadataV2(account: account,
serverUrl: serverUrl,
ocIdServerUrl: ocIdServerUrl,
keyChecksums: jsonCiphertextMetadata.keyChecksums,
deleted: jsonCiphertextMetadata.deleted ?? false,
folders: jsonCiphertextMetadata.folders,
version: version)
NCManageDatabase.shared.addE2eMetadata(account: account,
serverUrl: serverUrl,
ocIdServerUrl: ocIdServerUrl,
keyChecksums: jsonCiphertextMetadata.keyChecksums,
deleted: jsonCiphertextMetadata.deleted ?? false,
folders: jsonCiphertextMetadata.folders,
version: version)
if let files = jsonCiphertextMetadata.files {
print("\nFILES ---------------------------------\n")

Просмотреть файл

@ -149,7 +149,7 @@ class NCNetworkingE2EE: NSObject {
// COUNTER
//
if NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV20 {
NCManageDatabase.shared.updateCounterE2eMetadataV2(account: account, ocIdServerUrl: ocIdServerUrl, counter: resultsEncodeMetadata.counter)
NCManageDatabase.shared.updateCounterE2eMetadata(account: account, ocIdServerUrl: ocIdServerUrl, counter: resultsEncodeMetadata.counter)
}
return NKError()
@ -168,7 +168,7 @@ class NCNetworkingE2EE: NSObject {
e2eToken = tableLock.e2eToken
}
if NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV20, var counter = NCManageDatabase.shared.getCounterE2eMetadataV2(account: account, ocIdServerUrl: directory.ocId) {
if NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV20, var counter = NCManageDatabase.shared.getCounterE2eMetadata(account: account, ocIdServerUrl: directory.ocId) {
counter += 1
e2eCounter = "\(counter)"
}

Просмотреть файл

@ -41,7 +41,7 @@ class NCNetworkingE2EEMarkFolder: NSObject {
NCManageDatabase.shared.addDirectory(encrypted: true, favorite: metadata.favorite, ocId: metadata.ocId, fileId: metadata.fileId, etag: nil, permissions: metadata.permissions, serverUrl: serverUrlFileName, account: metadata.account)
NCManageDatabase.shared.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, serverUrlFileName))
if NCGlobal.shared.capabilityE2EEApiVersion == NCGlobal.shared.e2eeVersionV20 {
NCManageDatabase.shared.updateCounterE2eMetadataV2(account: account, ocIdServerUrl: metadata.ocId, counter: 0)
NCManageDatabase.shared.updateCounterE2eMetadata(account: account, ocIdServerUrl: metadata.ocId, counter: 0)
}
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: ["ocId": metadata.ocId, "serverUrl": serverUrl, "account": account, "withPush": true])

Просмотреть файл

@ -174,14 +174,7 @@ class NCEndToEndInitialize: NSObject {
if error == .success && account == self.appDelegate.account {
CCUtility.setEndToEndPublicKey(account, publicKey: publicKey)
// Clear Table
NCManageDatabase.shared.clearTable(tableDirectory.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eEncryption.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eEncryptionLock.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eMetadata.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eMetadataV2.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eUsersV2.self, account: account)
NCManageDatabase.shared.clearTablesE2EE(account: account)
self.delegate?.endToEndInitializeSuccess()
@ -285,14 +278,7 @@ class NCEndToEndInitialize: NSObject {
if error == .success && account == self.appDelegate.account {
CCUtility.setEndToEndPublicKey(account, publicKey: publicKey)
// Clear Table
NCManageDatabase.shared.clearTable(tableDirectory.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eEncryption.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eEncryptionLock.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eMetadata.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eMetadataV2.self, account: account)
NCManageDatabase.shared.clearTable(tableE2eUsersV2.self, account: account)
NCManageDatabase.shared.clearTablesE2EE(account: account)
if copyPassphrase {
UIPasteboard.general.string = e2ePassphrase