mv-experiment #1

Merged
fmodf merged 88 commits from mv-experiment into develop 2024-09-03 15:13:59 +00:00
3 changed files with 12 additions and 7 deletions
Showing only changes of commit fa0381e238 - Show all commits

View file

@ -24,6 +24,8 @@ final class ClientMartinMessagesManager {
print("---")
#endif
// Try to recognize if message is omemo-encoded and decode it
if let msg = Message.map(message) {
Task {
do {

View file

@ -43,9 +43,12 @@ final class ClientMartinOMEMO {
let regId = context.generateRegistrationId()
let address = SignalAddress(name: credentials.bareJid, deviceId: Int32(regId))
var settings = Settings.getFor(credentials.bareJid)
settings?.omemoRegId = Int(regId)
settings?.save()
if var settings = Settings.getFor(credentials.bareJid) {
settings.omemoRegId = Int(regId)
settings.save()
} else {
Settings(bareJid: credentials.bareJid, omemoRegId: Int(regId)).save()
}
guard let keyPair = SignalIdentityKeyPair.generateKeyPair(context: context), let publicKey = keyPair.publicKey else {
return false

View file

@ -63,15 +63,15 @@ extension Database {
try db.create(table: "omemo_sessions", options: [.ifNotExists]) { table in
table.column("account", .text).notNull()
table.column("name", .text).notNull()
table.column("device_id", .integer).notNull()
table.column("deviceId", .integer).notNull()
table.column("key", .text).notNull()
table.primaryKey(["account", "name", "device_id"], onConflict: .replace)
table.primaryKey(["account", "name", "deviceId"], onConflict: .replace)
}
try db.create(table: "omemo_identities", options: [.ifNotExists]) { table in
table.column("account", .text).notNull()
table.column("name", .text).notNull()
table.column("device_id", .integer).notNull()
table.column("deviceId", .integer).notNull()
table.column("fingerprint", .text).notNull()
table.column("key", .blob).notNull()
table.column("own", .integer).notNull()
@ -98,7 +98,7 @@ extension Database {
// table.add(column: "encryption", .text)
// }
//
// try db.alter(table: "chat_history") { table in
// try db.alter(table: "messages") { table in
// table.add(column: "encryption", .integer)
// table.add(column: "fingerprint", .text)
// }