Skip to content

Commit

Permalink
v2.1 (757)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaigner committed Mar 13, 2024
1 parent 1f94bc6 commit 78dae94
Show file tree
Hide file tree
Showing 525 changed files with 28,996 additions and 16,102 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [2.1 (757)] - 2024-03-11

### macOS

- Behold, adventurers of the digital realm! We present to you a long-awaited treasure: Secure video calls now grace the lands of macOS!
- Our call view has undergone a dramatic makeover to accommodate these splendid video calls. Prepare to be dazzled!
- Seeking wisdom within the scrolls of conversation? Fear not! You can now wield the power of search across all messages in a discussion.
- Behold the mighty keyboard shortcuts, wielder of efficiency! With the almighty Cmd+F, you can summon the search within discussions, while Cmd+G guides you to the next hidden gem.
- The legendary Cmd+Home now serves as the vanquisher of stacked discussions. Press it, and watch them scatter like leaves in the wind!
- Time marches on, but fear not, weary travelers! Under each message, you shall find not only the date but also the day of the week (if it be older than a day). Let not the sands of time obscure your path!
- Update your journey and bask in the glory of these newfound features! Adventure awaits!
- We also fixed a few bugs ;-)

### iOS

- Behold, adventurers of the digital realm! We present to you a long-awaited treasure: Secure video calls now grace the lands of iOS and iPadOS!
- Our call view has undergone a dramatic makeover to accommodate these splendid video calls. Prepare to be dazzled!
- Seeking wisdom within the scrolls of conversation? Fear not! You can now wield the power of search across all messages in a discussion.
- Behold the mighty keyboard shortcuts, wielder of efficiency! With the almighty Cmd+F, you can summon the search within discussions, while Cmd+G guides you to the next hidden gem.
- The legendary Cmd+Home now serves as the vanquisher of stacked discussions. Press it, and watch them scatter like leaves in the wind!
- Time marches on, but fear not, weary travelers! Under each message, you shall find not only the date but also the day of the week (if it be older than a day). Let not the sands of time obscure your path!
- Update your journey and bask in the glory of these newfound features! Adventure awaits!
- We also fixed a few bugs ;-)

## [1.3.1 (719)] - 2023-12-11

- Bugfix release
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.fr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## [2.1 (757)] - 2024-03-11

### macOS

- Voici, aventuriers du royaume numérique ! Nous vous présentons un trésor tant attendu : les appels vidéo sécurisés sont désormais disponibles sur macOS !
- Notre vue d'appel a subi une transformation spectaculaire pour accueillir ces splendides appels vidéo. Préparez-vous à être éblouis !
- En quête de sagesse au sein des fils de conversation ? Ne craignez rien ! Vous pouvez désormais utiliser le pouvoir de la recherche à travers tous les messages d'une discussion.
- Voici les puissants raccourcis clavier, maîtres de l'efficacité ! Avec l'invincible Cmd+F, vous pouvez invoquer la recherche au sein des discussions, tandis que Cmd+G vous guide vers le prochain joyau caché.
- Le légendaire Cmd+Home sert désormais de pourfendeur des discussions empilées. Appuyez dessus et regardez-les se disperser comme des feuilles au vent !
- Le temps s'écoule, mais ne vous inquiétez pas, braves voyageurs ! Sous chaque message, vous trouverez non seulement la date mais aussi le jour de la semaine (s'il est plus ancien qu'un jour). Que les sables du temps n'obscurcissent pas votre chemin !
- Mettez à jour votre voyage et savourez la gloire de ces nouvelles fonctionnalités ! L'aventure vous attend !
- Et on a aussi corrigé quelques bogues ;-)

### iOS

- Voici, aventuriers du royaume numérique ! Nous vous présentons un trésor tant attendu : les appels vidéo sécurisés sont désormais disponibles sur iOS et iPadOS !
- Notre vue d'appel a subi une transformation spectaculaire pour accueillir ces splendides appels vidéo. Préparez-vous à être éblouis !
- En quête de sagesse au sein des fils de conversation ? Ne craignez rien ! Vous pouvez désormais utiliser le pouvoir de la recherche à travers tous les messages d'une discussion.
- Voici les puissants raccourcis clavier, maîtres de l'efficacité ! Avec l'invincible Cmd+F, vous pouvez invoquer la recherche au sein des discussions, tandis que Cmd+G vous guide vers le prochain joyau caché.
- Le légendaire Cmd+Home sert désormais de pourfendeur des discussions empilées. Appuyez dessus et regardez-les se disperser comme des feuilles au vent !
- Le temps s'écoule, mais ne vous inquiétez pas, braves voyageurs ! Sous chaque message, vous trouverez non seulement la date mais aussi le jour de la semaine (s'il est plus ancien qu'un jour). Que les sables du temps n'obscurcissent pas votre chemin !
- Mettez à jour votre voyage et savourez la gloire de ces nouvelles fonctionnalités ! L'aventure vous attend !
- Et on a aussi corrigé quelques bogues ;-)

## [1.3.1 (719)] - 2023-12-11

- Bugfix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Olvid for iOS
* Copyright © 2019-2022 Olvid SAS
* Copyright © 2019-2024 Olvid SAS
*
* This file is part of Olvid for iOS.
*
Expand Down Expand Up @@ -59,20 +59,12 @@ final class GateKeeper {

fileprivate final class ObvContextSlotManager {

private static let log = OSLog(subsystem: ObvObliviousChannel.delegateManager.logSubsystem, category: "ObvContextSlotManager")

private let semaphore = DispatchSemaphore(value: 1) // Tested

private let queueForCurrentContextInSlot = DispatchQueue(label: "ObvContextSlotManager queue for context in slot", attributes: [.concurrent])
private var _currentContextInSlot: ObvContext?

private var currentContextInSlot: ObvContext? {
get {
return queueForCurrentContextInSlot.sync { return _currentContextInSlot }
}
set {
queueForCurrentContextInSlot.async(flags: .barrier) { [weak self] in self?._currentContextInSlot = newValue }
}
}

// 2023-01-25: We remove the sync mechanism around this variable, as it is not required
private var currentContextInSlot: ObvContext?

func waitUntilSlotIsAvailableForObvContext(_ obvContext: ObvContext) {

Expand All @@ -82,19 +74,45 @@ fileprivate final class ObvContextSlotManager {
return
}

//assert(Task.currentPriority.rawValue > TaskPriority.medium.rawValue)
os_log("🚪[%{public}@] Context %{public}@ will wait. Current context in slot: %{public}@", log: Self.log, type: .debug, Task.currentPriority.debugDescription, obvContext.debugDescription, currentContextInSlot?.debugDescription ?? "None")

semaphore.wait()

os_log("🚪 Context %{public}@ will take the slot and continue", log: Self.log, type: .debug, obvContext.debugDescription)

assert(currentContextInSlot == nil)

currentContextInSlot = obvContext

let contextDescription = obvContext.debugDescription

obvContext.addEndOfScopeCompletionHandler { [weak self] in
assert(self?.currentContextInSlot == obvContext)
self?.currentContextInSlot = nil
self?.semaphore.signal()
guard let self else { assertionFailure(); return }
currentContextInSlot = nil
os_log("🚪 Context %{public}@ will free the slot", log: Self.log, type: .debug, contextDescription)
semaphore.signal()
os_log("🚪 Context %{public}@ did free the slot", log: Self.log, type: .debug, contextDescription)
}


}

}


private extension TaskPriority {

var debugDescription: String {
switch self {
case .background: return "background"
case .high: return "high"
case .low: return "low"
case .medium: return "medium"
case .userInitiated: return "userInitiated"
case .utility: return "utility"
default:
return "custom<\(self.rawValue)>"
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Olvid for iOS
* Copyright © 2019-2023 Olvid SAS
* Copyright © 2019-2024 Olvid SAS
*
* This file is part of Olvid for iOS.
*
Expand Down Expand Up @@ -69,132 +69,113 @@ extension NetworkReceivedMessageDecryptor {


/// This method is called on each new received message.
func decryptAndProcessNetworkReceivedMessageEncrypted(_ receivedMessage: ObvNetworkReceivedMessageEncrypted, within obvContext: ObvContext) throws {
func decryptAndProcessNetworkReceivedMessageEncrypted(_ receivedMessage: ObvNetworkReceivedMessageEncrypted, within obvContext: ObvContext) throws -> ReceivedEncryptedMessageProcessingResult {

guard let delegateManager = delegateManager else {
let log = OSLog(subsystem: ObvChannelDelegateManager.defaultLogSubsystem, category: NetworkReceivedMessageDecryptor.logCategory)
os_log("The Channel Delegate Manager is not set", log: log, type: .fault)
assertionFailure()
return
throw ReceivedEncryptedMessageProcessingError.delegateManagerIsNil
}

let log = OSLog(subsystem: delegateManager.logSubsystem, category: NetworkReceivedMessageDecryptor.logCategory)

guard let networkFetchDelegate = delegateManager.networkFetchDelegate else {
os_log("The network fetch delegate is not set", log: log, type: .fault)
assertionFailure()
return
}

// We try to decrypt the received message with an Oblivious channel. If it does not work, we try again with an asymmetric channel.

if let (messageKey, channelInfo) = try ObvObliviousChannel.unwrapMessageKey(wrappedKey: receivedMessage.wrappedKey,
toOwnedIdentity: receivedMessage.messageId.ownedCryptoIdentity,
delegateManager: delegateManager,
within: obvContext) {
os_log("🔑 A received wrapped key was decrypted using an Oblivious channel", log: log, type: .debug)
decryptAndProcess(receivedMessage, with: messageKey, channelType: channelInfo, within: obvContext)
return try decryptAndProcess(receivedMessage, with: messageKey, channelType: channelInfo, within: obvContext)
} else if let (messageKey, channelInfo) = ObvAsymmetricChannel.unwrapMessageKey(wrappedKey: receivedMessage.wrappedKey,
toOwnedIdentity: receivedMessage.messageId.ownedCryptoIdentity,
delegateManager: delegateManager,
within: obvContext) {
os_log("🔑 A received wrapped key was decrypted using an Asymmetric Channel", log: log, type: .debug)
decryptAndProcess(receivedMessage, with: messageKey, channelType: channelInfo, within: obvContext)
return try decryptAndProcess(receivedMessage, with: messageKey, channelType: channelInfo, within: obvContext)
} else {
os_log("🔑 The received message %@ could not be decrypted", log: log, type: .fault, receivedMessage.messageId.debugDescription)
networkFetchDelegate.deleteMessageAndAttachments(messageId: receivedMessage.messageId, within: obvContext)
return .noKeyAllowedToDecrypt(messageId: receivedMessage.messageId)
}

}


private func decryptAndProcess(_ receivedMessage: ObvNetworkReceivedMessageEncrypted, with messageKey: AuthenticatedEncryptionKey, channelType: ObvProtocolReceptionChannelInfo, within obvContext: ObvContext) {
private func decryptAndProcess(_ receivedMessage: ObvNetworkReceivedMessageEncrypted, with messageKey: AuthenticatedEncryptionKey, channelType: ObvProtocolReceptionChannelInfo, within obvContext: ObvContext) throws -> ReceivedEncryptedMessageProcessingResult {

guard let delegateManager = delegateManager else {
let log = OSLog(subsystem: ObvChannelDelegateManager.defaultLogSubsystem, category: NetworkReceivedMessageDecryptor.logCategory)
os_log("The Channel Delegate Manager is not set", log: log, type: .error)
return
assertionFailure()
throw ReceivedEncryptedMessageProcessingError.delegateManagerIsNil
}

let log = OSLog(subsystem: delegateManager.logSubsystem, category: NetworkReceivedMessageDecryptor.logCategory)

guard let protocolDelegate = delegateManager.protocolDelegate else {
assertionFailure()
os_log("The protocol delegate is not set", log: log, type: .fault)
return
}

guard let notificationDelegate = delegateManager.notificationDelegate else {
assertionFailure()
os_log("The notification delegate is not set", log: log, type: .fault)
return
}

guard let networkFetchDelegate = delegateManager.networkFetchDelegate else {
assertionFailure()
os_log("The network fetch delegate is not set", log: log, type: .fault)
return
throw ReceivedEncryptedMessageProcessingError.protocolDelegateIsNil
}

guard let obvChannelReceivedMessage = ReceivedMessage(with: receivedMessage, decryptedWith: messageKey, obtainedUsing: channelType) else {
os_log("A received message could not be decrypted or parsed", log: log, type: .error)
networkFetchDelegate.deleteMessageAndAttachments(messageId: receivedMessage.messageId, within: obvContext)
return
assertionFailure()
return .couldNotDecryptOrParse(messageId: receivedMessage.messageId)
}

switch obvChannelReceivedMessage.type {

case .ProtocolMessage:
os_log("🔑 New protocol message with id %{public}@", log: log, type: .info, receivedMessage.messageId.debugDescription)
ObvChannelNotification.protocolMessageDecrypted(protocolMessageId: receivedMessage.messageId, flowId: obvContext.flowId)
.postOnBackgroundQueue(within: notificationDelegate)
if let receivedProtocolMessage = ReceivedProtocolMessage(with: obvChannelReceivedMessage) {
let protocolReceivedMessage = receivedProtocolMessage.protocolReceivedMessage
do {
os_log("Processing a decrypted received protocol message with messageId %{public}@", log: log, type: .info, protocolReceivedMessage.messageId.debugDescription)
try protocolDelegate.processProtocolReceivedMessage(protocolReceivedMessage, within: obvContext)
return .protocolMessageWasProcessed(messageId: receivedMessage.messageId)
} catch {
os_log("A received protocol message could not be processed", log: log, type: .error)
assertionFailure()
return .protocolManagerFailedToProcessMessage(messageId: receivedMessage.messageId)
}
// Whatever happened, we delete the protocol message from the inbox
networkFetchDelegate.deleteMessageAndAttachments(messageId: receivedMessage.messageId, within: obvContext)
} else {
os_log("A received protocol message could not be parsed", log: log, type: .error)
networkFetchDelegate.deleteMessageAndAttachments(messageId: receivedMessage.messageId, within: obvContext)
return .protocolMessageCouldNotBeParsed(messageId: receivedMessage.messageId)
}

case .ApplicationMessage:
os_log("🔑🌊 New application message within flow %{public}@ with id %{public}@", log: log, type: .info, obvContext.flowId.debugDescription, receivedMessage.messageId.debugDescription)
// We do not post an applicationMessageDecrypted notification, this is done by the Network Fetch Manager.
if let receivedApplicationMessage = ReceivedApplicationMessage(with: obvChannelReceivedMessage) {
do {
//do {
// At this point, we expect the `knownAttachmentCount` of the `obvChannelReceivedMessage` to be set and equal to `receivedApplicationMessage.attachmentsInfos`
guard receivedApplicationMessage.attachmentsInfos.count == obvChannelReceivedMessage.knownAttachmentCount else {
os_log("Invalid count of attachment infos", log: log, type: .fault)
throw Self.makeError(message: "Invalid count of attachment infos")
assertionFailure()
return .invalidAttachmentCountOfApplicationMessage(messageId: receivedMessage.messageId)
}
try networkFetchDelegate.setRemoteCryptoIdentity(
receivedApplicationMessage.remoteCryptoIdentity,
os_log("New application message", log: log, type: .debug)
return .remoteIdentityToSetOnReceivedMessage(
messageId: receivedApplicationMessage.messageId,
remoteCryptoIdentity: receivedApplicationMessage.remoteCryptoIdentity,
messagePayload: receivedApplicationMessage.messagePayload,
extendedMessagePayloadKey: receivedApplicationMessage.extendedMessagePayloadKey,
andAttachmentsInfos: receivedApplicationMessage.attachmentsInfos,
forApplicationMessageWithmessageId: receivedApplicationMessage.messageId,
within: obvContext)
} catch {
os_log("Could not set the attachment infos of a received application message (this also happens when the number of attachments info does not match)", log: log, type: .error)
networkFetchDelegate.deleteMessageAndAttachments(messageId: receivedMessage.messageId, within: obvContext)
}
os_log("New application message: the attachment infos were communicated to the attachments", log: log, type: .debug)
attachmentsInfos: receivedApplicationMessage.attachmentsInfos)
} else {
os_log("A received application message could not be parsed", log: log, type: .error)
networkFetchDelegate.deleteMessageAndAttachments(messageId: receivedMessage.messageId, within: obvContext)
return .applicationMessageCouldNotBeParsed(messageId: receivedMessage.messageId)
}

case .DialogMessage,
.DialogResponseMessage,
.ServerQuery,
.ServerResponse:
os_log("Dialog/Response/ServerQuery messages are not intended to be decrypted", log: log, type: .fault)
assertionFailure()
return .unexpectedMessageType(messageId: receivedMessage.messageId)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,10 @@ extension ObvObliviousChannel {
notificationRelatedChanges = [] // Ensure the notifications are set only once
}

if isDeleted {
//assertionFailure("This assertion shall be deleted. We are just trying to understand when a channel can be deleted")
}

let log = OSLog(subsystem: ObvObliviousChannel.delegateManager.logSubsystem, category: ObvObliviousChannel.entityName)

guard let notificationDelegate = ObvObliviousChannel.delegateManager.notificationDelegate else {
Expand Down
Loading

0 comments on commit 78dae94

Please sign in to comment.