diff --git a/Sources/XMTP/Codecs/ContentCodec.swift b/Sources/XMTP/Codecs/ContentCodec.swift index 45e3f75c..e715a191 100644 --- a/Sources/XMTP/Codecs/ContentCodec.swift +++ b/Sources/XMTP/Codecs/ContentCodec.swift @@ -72,6 +72,7 @@ public protocol ContentCodec: Hashable, Equatable { func encode(content: T, client: Client) throws -> EncodedContent func decode(content: EncodedContent, client: Client) throws -> T func fallback(content: T) throws -> String? + func shouldPush(content: T) throws -> Bool } public extension ContentCodec { diff --git a/Sources/XMTP/Messages/MessageV2.swift b/Sources/XMTP/Messages/MessageV2.swift index 07ef2061..8176cba2 100644 --- a/Sources/XMTP/Messages/MessageV2.swift +++ b/Sources/XMTP/Messages/MessageV2.swift @@ -16,10 +16,11 @@ enum MessageV2Error: Error { } extension MessageV2 { - init(headerBytes: Data, ciphertext: CipherText) { + init(headerBytes: Data, ciphertext: CipherText, senderHmac: Data) { self.init() self.headerBytes = headerBytes self.ciphertext = ciphertext + self.senderHmac = senderHmac } static func decrypt(_ id: String, _ topic: String, _ message: MessageV2, keyMaterial: Data, client: Client) throws -> DecryptedMessage { @@ -78,7 +79,7 @@ extension MessageV2 { } } - static func encode(client: Client, content encodedContent: EncodedContent, topic: String, keyMaterial: Data) async throws -> MessageV2 { + static func encode(client: Client, content encodedContent: EncodedContent, topic: String, keyMaterial: Data, senderHmac: Data) async throws -> MessageV2 { let payload = try encodedContent.serializedData() let date = Date() @@ -98,7 +99,8 @@ extension MessageV2 { return MessageV2( headerBytes: headerBytes, - ciphertext: ciphertext + ciphertext: ciphertext, + senderHmac: senderHmac ) } }