mv-experiment #1
|
@ -230,17 +230,17 @@ extension ClientMartinOMEMO: SignalPreKeyStoreProtocol {
|
|||
sql: """
|
||||
DELETE FROM omemo_pre_keys
|
||||
WHERE account = :account
|
||||
AND id IN
|
||||
(SELECT id
|
||||
FROM omemo_pre_keys
|
||||
WHERE account = :account
|
||||
AND id NOT IN (
|
||||
AND id IN (
|
||||
SELECT id
|
||||
FROM omemo_pre_keys
|
||||
WHERE account = :account
|
||||
AND id NOT IN (
|
||||
SELECT id
|
||||
FROM omemo_pre_keys
|
||||
WHERE account = :account
|
||||
ORDER BY id DESC
|
||||
LIMIT 100)
|
||||
)
|
||||
)
|
||||
""",
|
||||
arguments: ["account": credentials.bareJid]
|
||||
)
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue