Skip to content

Commit

Permalink
v0.10.2 (519)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaigner committed Jul 2, 2022
1 parent 57c53e4 commit b0f1911
Show file tree
Hide file tree
Showing 262 changed files with 6,749 additions and 1,645 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [0.10.2 (519)] - 2022-05-01

- Want to see a nice view of all the photos and videos received in a discussion? Try the new gallery, available via the top right button of any discussion screen.
- When replying from a notification to the last received message, the response does not appear as a "reply" anymore.
- Fixes a bug preventing the detection of URLs, phone numbers, etc. within messages.
- Fixes a bug preventing badge to be properly updated when marking a message as read from a notification.
- Fixes a bug preventing read receipts to be sent when marking a message as read from a notification.
- Fixes an issue sometimes preventing read messages to be marked as "read".
- Fixes a bug where sharing an image as a file would not result in a nice preview in the discussion screen.
- Other minor bug fixes.

## [0.10.1 (501)] - 2022-03-24

- It is now possible to reply to a message or to mark it as read right from the notification!
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.fr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [0.10.2 (519)] - 2022-05-01

- Pour profiter d'un aperçu de l'intégralité des photos et des vidéos reçues ou envoyées dans une discussion, rendez-vous dans la nouvelle galerie accessible via le bouton en haut à droite de votre discussion préférée !
- Une réponse effectuée depuis une notification n'apparaît plus comme une réponse dans la discussion si le message concerné était le dernier.
- Corrige un bug empêchant parfois de marquer les messages comme « lus ».
- Corrige un bug empêchant la détection d'URLs, de numéros de téléphone, etc. dans les messages.
- Corrige un bug empêchant la mise à jour du badge de l'app après avoir marqué un message comme « lu » depuis une notification.
- Corrige un bug empêchant l'envoi d'accusé de lecture après avoir marqué un message comme « lu » depuis une notification.
- Corrige un bug qui pouvait empêcher l'affichage d'une jolie vignette dans certains cas de partage de photo.
- Autres corrections mineures

## [0.10.1 (501)] - 2022-03-24

- Il est maintenant possible de répondre à un message, ou de le marquer comme lu, directement depuis la notification !
Expand Down
6 changes: 3 additions & 3 deletions Engine/JWS/JWS/JWSUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public struct ObvJWK: Equatable {
self.jwk = jwk
}

public func encode() throws -> Data {
public func jsonEncode() throws -> Data {
guard let rawData = jwk.jsonData() else {
throw ObvJWK.makeError(message: "Could not encode ObvJWK", error: nil)
}
return rawData
}

public static func decode(rawObvJWK: Data) throws -> Self {
public static func jsonDecode(rawObvJWK: Data) throws -> Self {
let decoder = JSONDecoder()
if let rsaPublicKey = try? decoder.decode(RSAPublicKey.self, from: rawObvJWK) {
return self.init(jwk: rsaPublicKey)
Expand Down Expand Up @@ -184,7 +184,7 @@ public struct ObvJWKLegacy: Decodable {
}
}

public static func decode(rawObvJWKLegacy: Data) throws -> Self {
public static func jsonDecode(rawObvJWKLegacy: Data) throws -> Self {
let decoder = JSONDecoder()
return try decoder.decode(Self.self, from: rawObvJWKLegacy)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ final class BackupKey: NSManagedObject, ObvManagedObject {
private var encryptionPublicKey: PublicKeyForPublicKeyEncryption {
get {
let encoded = ObvEncoded(withRawData: encryptionPublicKeyRaw)!
return PublicKeyForPublicKeyEncryptionDecoder.decode(encoded)!
return PublicKeyForPublicKeyEncryptionDecoder.obvDecode(encoded)!
}
set {
self.encryptionPublicKeyRaw = newValue.encode().rawData
self.encryptionPublicKeyRaw = newValue.obvEncode().rawData
}
}

Expand All @@ -75,7 +75,7 @@ final class BackupKey: NSManagedObject, ObvManagedObject {
return MACKeyDecoder.decode(encoded)!
}
set {
self.macKeyRaw = newValue.encode().rawData
self.macKeyRaw = newValue.obvEncode().rawData
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class KeyMaterial: NSManagedObject, ObvManagedObject {
return try! AuthenticatedEncryptionKeyDecoder.decode(encodedKey)
}
set {
let encodedKey = newValue.encode()
let encodedKey = newValue.obvEncode()
kvoSafeSetPrimitiveValue(encodedKey.rawData, forKey: KeyMaterial.encodedKeyKey)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ final class ObvObliviousChannel: NSManagedObject, ObvManagedObject, ObvNetworkCh

private static func wrap(_ messageKey: AuthenticatedEncryptionKey, and keyId: CryptoKeyId, with channelKey: AuthenticatedEncryptionKey, randomizedWith prng: PRNGService) -> EncryptedData {
let authEnc = channelKey.algorithmImplementationByteId.algorithmImplementation
let encryptedMessageKey = try! authEnc.encrypt(messageKey.encode().rawData, with: channelKey, and: prng)
let encryptedMessageKey = try! authEnc.encrypt(messageKey.obvEncode().rawData, with: channelKey, and: prng)
let wrappedMessageKey = concat(keyId, with: encryptedMessageKey)
return wrappedMessageKey
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protocol ObvChannelMessageToSendWrapper {
fileprivate extension ObvChannelMessageToSendWrapper {

static func generateContent(type: ObvChannelMessageType, encodedElements: ObvEncoded) -> ObvEncoded {
return [type.encode(), encodedElements].encode()
return [type.obvEncode(), encodedElements].obvEncode()
}

static func encryptContent(messageKey: AuthenticatedEncryptionKey, type: ObvChannelMessageType, encodedElements: ObvEncoded, extendedMessagePayload: Data?, randomizedWith prng: PRNGService) -> (encryptedMessagePayload: EncryptedData, encryptedExtendedMessagePayload: EncryptedData?) {
Expand Down Expand Up @@ -161,8 +161,8 @@ struct ObvChannelApplicationMessageToSendWrapper: ObvChannelMessageToSendWrapper

private static func generateEncodedElements(fromMessagePayload payload: Data, and attachmentsAndKeys: [(attachment: ObvChannelApplicationMessageToSend.Attachment, key: AuthenticatedEncryptionKey)]) -> ObvEncoded {
let listOfEncodedElementsFromAttachments = attachmentsAndKeys.map { $0.attachment.generateEncodedElement(including: $0.key) }
let encodedMessagePayload = [payload.encode()]
let encodedElements = (listOfEncodedElementsFromAttachments + encodedMessagePayload).encode()
let encodedMessagePayload = [payload.obvEncode()]
let encodedElements = (listOfEncodedElementsFromAttachments + encodedMessagePayload).obvEncode()
return encodedElements
}

Expand Down Expand Up @@ -213,7 +213,7 @@ struct ObvChannelApplicationMessageToSendWrapper: ObvChannelMessageToSendWrapper
// MARK: Extensing the standard ObvChannelApplicationMessageToSend's Attachment struct
fileprivate extension ObvChannelApplicationMessageToSend.Attachment {
func generateEncodedElement(including key: AuthenticatedEncryptionKey) -> ObvEncoded {
return [key, metadata].encode()
return [key, metadata].obvEncode()
}

func generateObvNetworkMessageToSendAttachment(including key: AuthenticatedEncryptionKey) -> ObvNetworkMessageToSend.Attachment {
Expand Down
8 changes: 4 additions & 4 deletions Engine/ObvCrypto/ObvCrypto/CryptographicKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ extension CryptographicKey where Self: Equatable {

// Implementing ObvEncodable
extension CryptographicKey {
public func encode() -> ObvEncoded {
public func obvEncode() -> ObvEncoded {
// Concatenate the algoClass byte identifier and the implementation byte identifier, encode the two bytes
let encodedAlgoClassAndImplemByteIds = Data([self.algorithmClass.rawValue,
self.algorithmImplementationByteIdValue]).encode()
self.algorithmImplementationByteIdValue]).obvEncode()
// Encode the ObvDictionary representing the internal elements of the cryptographic key
let encodedObvDic = obvDictionaryOfInternalElements.encode()
let encodedObvDic = obvDictionaryOfInternalElements.obvEncode()
// Create a list containing the previous two ObvEncoded, and return its encoding
let encodedElements = [encodedAlgoClassAndImplemByteIds, encodedObvDic]
return ObvEncoded.pack(encodedElements, usingByteId: correspondingObvEncodedByteId)
}
}

final class CryptographicKeyDecoder: ObvDecoder {
static func decode(_ obvEncoded: ObvEncoded) -> (algorithmClassByteId: CryptographicAlgorithmClassByteId, implementationByteIdValue: UInt8, obvDictionary: ObvDictionary)? {
static func obvDecode(_ obvEncoded: ObvEncoded) -> (algorithmClassByteId: CryptographicAlgorithmClassByteId, implementationByteIdValue: UInt8, obvDictionary: ObvDictionary)? {
guard let unpackedList = ObvEncoded.unpack(obvEncoded) else { return nil }
guard unpackedList.count == 2 else { return nil }
let encodedAlgoClassAndImplemByteIds = unpackedList[0]
Expand Down
4 changes: 2 additions & 2 deletions Engine/ObvCrypto/ObvCrypto/EncryptedData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ extension EncryptedData {
self.init(data: raw)
}

public func encode() -> ObvEncoded {
return self.raw.encode()
public func obvEncode() -> ObvEncoded {
return self.raw.obvEncode()
}

}
Expand Down
4 changes: 2 additions & 2 deletions Engine/ObvCrypto/ObvCrypto/ObvCryptoIdentity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ extension ObvCryptoIdentity {
// MARK: Implementing ObvEncodable
extension ObvCryptoIdentity {

public func encode() -> ObvEncoded {
return self.getIdentity().encode()
public func obvEncode() -> ObvEncoded {
return self.getIdentity().obvEncode()
}

}
Expand Down
36 changes: 18 additions & 18 deletions Engine/ObvCrypto/ObvCrypto/ObvOwnedCryptoIdentity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ extension ObvOwnedCryptoIdentity {

extension ObvOwnedCryptoIdentity: ObvCodable {

public func encode() -> ObvEncoded {
let listOfEncodedValues = [self.serverURL.encode(),
self.publicKeyForAuthentication.encode(),
self.publicKeyForPublicKeyEncryption.encode(),
self.privateKeyForAuthentication.encode(),
self.privateKeyForPublicKeyEncryption.encode(),
self.secretMACKey.encode()]
let obvEncoded = listOfEncodedValues.encode()
public func obvEncode() -> ObvEncoded {
let listOfEncodedValues = [self.serverURL.obvEncode(),
self.publicKeyForAuthentication.obvEncode(),
self.publicKeyForPublicKeyEncryption.obvEncode(),
self.privateKeyForAuthentication.obvEncode(),
self.privateKeyForPublicKeyEncryption.obvEncode(),
self.secretMACKey.obvEncode()]
let obvEncoded = listOfEncodedValues.obvEncode()
return obvEncoded
}

Expand All @@ -133,10 +133,10 @@ extension ObvOwnedCryptoIdentity: ObvCodable {
let encodedsecretMACKey = listOfEncodedValues[5]
// Decode the extracted values
guard let serverURL = URL(encodedServer) else { return nil }
guard let publicKeyForAuthentication = PublicKeyForAuthenticationDecoder.decode(encodedPublicKeyForAuthentication) else { return nil }
guard let publicKeyForPublicKeyEncryption = PublicKeyForPublicKeyEncryptionDecoder.decode(encodedPublicKeyForPublicKeyEncryption) else { return nil }
guard let privateKeyForAuthentication = PrivateKeyForAuthenticationDecoder.decode(encodedPrivateKeyForAuthentication) else { return nil }
guard let privateKeyForPublicKeyEncryption = PrivateKeyForPublicKeyEncryptionDecoder.decode(encodedPrivateKeyForPublicKeyEncryption) else { return nil }
guard let publicKeyForAuthentication = PublicKeyForAuthenticationDecoder.obvDecode(encodedPublicKeyForAuthentication) else { return nil }
guard let publicKeyForPublicKeyEncryption = PublicKeyForPublicKeyEncryptionDecoder.obvDecode(encodedPublicKeyForPublicKeyEncryption) else { return nil }
guard let privateKeyForAuthentication = PrivateKeyForAuthenticationDecoder.obvDecode(encodedPrivateKeyForAuthentication) else { return nil }
guard let privateKeyForPublicKeyEncryption = PrivateKeyForPublicKeyEncryptionDecoder.obvDecode(encodedPrivateKeyForPublicKeyEncryption) else { return nil }
guard let secretMACKey = MACKeyDecoder.decode(encodedsecretMACKey) else { return nil }
// Initialize and return a ObvCryptoIdentityObject
self.init(serverURL: serverURL,
Expand Down Expand Up @@ -164,7 +164,7 @@ public class ObvOwnedCryptoIdentityTransformer: ValueTransformer {
/// Transform an ObvCryptoIdentity into an instance of Data (which actually is the raw representation of an ObvEncoded object)
override public func transformedValue(_ value: Any?) -> Any? {
guard let obvCryptoIdentity = value as? ObvOwnedCryptoIdentity else { return nil }
let obvEncoded = obvCryptoIdentity.encode()
let obvEncoded = obvCryptoIdentity.obvEncode()
return obvEncoded.rawData
}

Expand Down Expand Up @@ -196,9 +196,9 @@ public struct ObvOwnedCryptoIdentityPrivateBackupItem: Codable, Hashable {
private let rawSecretMACKey: Data

fileprivate init(obvOwnedCryptoIdentity: ObvOwnedCryptoIdentity) {
self.rawPrivateKeyForAuthentication = obvOwnedCryptoIdentity.privateKeyForAuthentication.encode().rawData
self.rawPrivateKeyForPublicKeyEncryption = obvOwnedCryptoIdentity.privateKeyForPublicKeyEncryption.encode().rawData
self.rawSecretMACKey = obvOwnedCryptoIdentity.secretMACKey.encode().rawData
self.rawPrivateKeyForAuthentication = obvOwnedCryptoIdentity.privateKeyForAuthentication.obvEncode().rawData
self.rawPrivateKeyForPublicKeyEncryption = obvOwnedCryptoIdentity.privateKeyForPublicKeyEncryption.obvEncode().rawData
self.rawSecretMACKey = obvOwnedCryptoIdentity.secretMACKey.obvEncode().rawData
}

enum CodingKeys: String, CodingKey {
Expand All @@ -209,12 +209,12 @@ public struct ObvOwnedCryptoIdentityPrivateBackupItem: Codable, Hashable {

private var privateKeyForAuthentication: PrivateKeyForAuthentication? {
guard let encoded = ObvEncoded(withRawData: rawPrivateKeyForAuthentication) else { return nil }
return PrivateKeyForAuthenticationDecoder.decode(encoded)
return PrivateKeyForAuthenticationDecoder.obvDecode(encoded)
}

private var privateKeyForPublicKeyEncryption: PrivateKeyForPublicKeyEncryption? {
guard let encoded = ObvEncoded(withRawData: rawPrivateKeyForPublicKeyEncryption) else { return nil }
return PrivateKeyForPublicKeyEncryptionDecoder.decode(encoded)
return PrivateKeyForPublicKeyEncryptionDecoder.obvDecode(encoded)
}

private var secretMACKey: MACKey? {
Expand Down
4 changes: 2 additions & 2 deletions Engine/ObvCrypto/ObvCrypto/PRNG/Seed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ extension Seed {
self.init(with: rawSeed)
}

public func encode() -> ObvEncoded {
return self.raw.encode()
public func obvEncode() -> ObvEncoded {
return self.raw.obvEncode()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ final class ProofOfWorkEngineSyndromeBased: ProofOfWorkEngine {
}

private static func encode(_ indexes: [Int]) -> ObvEncoded? {
let listOfEncodedIndexes = indexes.map() { $0.encode() }
return listOfEncodedIndexes.encode()
let listOfEncodedIndexes = indexes.map() { $0.obvEncode() }
return listOfEncodedIndexes.obvEncode()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ extension PrivateKeyForDH {
}

final class PrivateKeyForDHDecoder: ObvDecoder {
static func decode(_ encodedKey: ObvEncoded) -> PrivateKeyForDH? {
static func obvDecode(_ encodedKey: ObvEncoded) -> PrivateKeyForDH? {
guard encodedKey.byteId == .privateKey else { return nil }
guard let (algorithmClassByteId, implementationByteIdValue, obvDic) = CryptographicKeyDecoder.decode(encodedKey) else { return nil }
guard let (algorithmClassByteId, implementationByteIdValue, obvDic) = CryptographicKeyDecoder.obvDecode(encodedKey) else { return nil }
guard algorithmClassByteId == .DH else { return nil }
guard let implementationByteId = DHImplementationByteId(rawValue: implementationByteIdValue) else { return nil }
switch implementationByteId {
Expand Down Expand Up @@ -73,7 +73,7 @@ struct PrivateKeyForDHOnEdwardsCurve: PrivateKeyForDH, PrivateKeyFromEdwardsCurv
// Implementing ObvCodable
extension PrivateKeyForDHOnEdwardsCurve {
init?(_ obvEncoded: ObvEncoded) {
guard let privateKey = PrivateKeyForDHDecoder.decode(obvEncoded) as? PrivateKeyForDHOnEdwardsCurve else { return nil }
guard let privateKey = PrivateKeyForDHDecoder.obvDecode(obvEncoded) as? PrivateKeyForDHOnEdwardsCurve else { return nil }
self = privateKey
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ extension PublicKeyForDH {
}

final class PublicKeyForDHDecoder: ObvDecoder {
static func decode(_ encodedPublicKey: ObvEncoded) -> PublicKeyForDH? {
static func obvDecode(_ encodedPublicKey: ObvEncoded) -> PublicKeyForDH? {
guard encodedPublicKey.byteId == .publicKey else { return nil }
guard let (algorithmClassByteId, implementationByteIdValue, obvDic) = CryptographicKeyDecoder.decode(encodedPublicKey) else { return nil }
guard let (algorithmClassByteId, implementationByteIdValue, obvDic) = CryptographicKeyDecoder.obvDecode(encodedPublicKey) else { return nil }
guard algorithmClassByteId == .DH else { return nil }
guard let implementationByteId = DHImplementationByteId(rawValue: implementationByteIdValue) else { return nil }
switch implementationByteId {
Expand Down Expand Up @@ -90,7 +90,7 @@ struct PublicKeyForDHOnEdwardsCurve: PublicKeyForDH, PublicKeyFromEdwardsCurvePo
// Implementing ObvCodable
extension PublicKeyForDHOnEdwardsCurve {
init?(_ obvEncoded: ObvEncoded) {
guard let publicKey = PublicKeyForDHDecoder.decode(obvEncoded) as? PublicKeyForDHOnEdwardsCurve else { return nil }
guard let publicKey = PublicKeyForDHDecoder.obvDecode(obvEncoded) as? PublicKeyForDHOnEdwardsCurve else { return nil }
self = publicKey
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ extension PointOnCurve {


func getObvDictionaryOfCoordinates() -> ObvDictionary {
return [ObvDictionaryKey.forXCoordinate.data: self.x.encode(),
ObvDictionaryKey.forYCoordinate.data: self.y.encode()]
return [ObvDictionaryKey.forXCoordinate.data: self.x.obvEncode(),
ObvDictionaryKey.forYCoordinate.data: self.y.obvEncode()]
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ extension PrivateKeyFromEdwardsCurveScalar {

extension PrivateKeyFromEdwardsCurveScalar {
var obvDictionaryOfInternalElements: ObvDictionary {
return [PointOnCurve.ObvDictionaryKey.forScalar.data: self.scalar.encode()]
return [PointOnCurve.ObvDictionaryKey.forScalar.data: self.scalar.obvEncode()]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ extension PrivateKeyForPublicKeyEncryption {
}

final public class PrivateKeyForPublicKeyEncryptionDecoder: ObvDecoder {
public static func decode(_ encodedKey: ObvEncoded) -> PrivateKeyForPublicKeyEncryption? {
public static func obvDecode(_ encodedKey: ObvEncoded) -> PrivateKeyForPublicKeyEncryption? {
guard encodedKey.byteId == .privateKey else { return nil }
guard let (algorithmClassByteId, implementationByteIdValue, obvDic) = CryptographicKeyDecoder.decode(encodedKey) else { return nil }
guard let (algorithmClassByteId, implementationByteIdValue, obvDic) = CryptographicKeyDecoder.obvDecode(encodedKey) else { return nil }
guard algorithmClassByteId == .publicKeyEncryption else { return nil }
guard let implementationByteId = PublicKeyEncryptionImplementationByteId(rawValue: implementationByteIdValue) else { return nil }
switch implementationByteId {
Expand Down Expand Up @@ -73,7 +73,7 @@ struct PrivateKeyForPublicKeyEncryptionOnEdwardsCurve: PrivateKeyForPublicKeyEnc
// Implementing ObvDecodable
extension PrivateKeyForPublicKeyEncryptionOnEdwardsCurve {
init?(_ obvEncoded: ObvEncoded) {
guard let privateKey = PrivateKeyForPublicKeyEncryptionDecoder.decode(obvEncoded) as? PrivateKeyForPublicKeyEncryptionOnEdwardsCurve else { return nil }
guard let privateKey = PrivateKeyForPublicKeyEncryptionDecoder.obvDecode(obvEncoded) as? PrivateKeyForPublicKeyEncryptionOnEdwardsCurve else { return nil }
self = privateKey
}
}
Loading

0 comments on commit b0f1911

Please sign in to comment.