mv-experiment #1

Merged
fmodf merged 88 commits from mv-experiment into develop 2024-09-03 15:13:59 +00:00
2 changed files with 47 additions and 14 deletions
Showing only changes of commit 79fb5ceb2c - Show all commits

View file

@ -230,8 +230,8 @@ extension ClientMartinOMEMO: SignalPreKeyStoreProtocol {
sql: """
DELETE FROM omemo_pre_keys
WHERE account = :account
AND id IN
(SELECT id
AND id IN (
SELECT id
FROM omemo_pre_keys
WHERE account = :account
AND id NOT IN (
@ -362,7 +362,40 @@ extension ClientMartinOMEMO: SignalSignedPreKeyStoreProtocol {
// MARK: - Identity
extension ClientMartinOMEMO: SignalIdentityKeyStoreProtocol {
// func regenerateKeys(wipe: Bool = false) -> Bool {
// if wipe {
// wipeSignedPreKeys()
// }
// }
// if wipe {
// DBOMEMOStore.instance.wipe(forAccount: context!.sessionObject.userBareJid!)
// }
//
// let hasKeyPair = identityKeyStore.keyPair() != nil
// if wipe || identityKeyStore.localRegistrationId() == 0 || !hasKeyPair {
// let regId: UInt32 = signalContext.generateRegistrationId()
// AccountSettings.omemoRegistrationId(for: context!.sessionObject.userBareJid!, value: regId)
//
// let keyPair = SignalIdentityKeyPair.generateKeyPair(context: signalContext)
// if !identityKeyStore.save(identity: SignalAddress(name: context!.sessionObject.userBareJid!.stringValue, deviceId: Int32(identityKeyStore.localRegistrationId())), key: keyPair) {}
// }
// return true
// }
func keyPair() -> (any MartinOMEMO.SignalIdentityKeyPairProtocol)? {
// guard let deviceId = localRegistrationId(forAccount: account) else {
// return nil
// }
//
// guard
// let data = try! Database.main.reader({ database in
// try database.select(query: .omemoKeyPairForAccount, params: ["account": account, "name": account.stringValue, "deviceId": deviceId]).mapFirst { $0.data(for: "key") }
// })
// else {
// return nil
// }
//
// return SignalIdentityKeyPair(fromKeyPairData: data)
nil
}

View file

@ -93,14 +93,14 @@ extension Database {
table.primaryKey(["account", "id"], onConflict: .replace)
}
try db.alter(table: "chats") { table in
table.add(column: "encryption", .text)
}
try db.alter(table: "chat_history") { table in
table.add(column: "encryption", .integer)
table.add(column: "fingerprint", .text)
}
// try db.alter(table: "chats") { table in
// table.add(column: "encryption", .text)
// }
//
// try db.alter(table: "chat_history") { table in
// table.add(column: "encryption", .integer)
// table.add(column: "fingerprint", .text)
// }
}
// return migrator