Skip to content

Commit

Permalink
Improves streaming and fix sqlcipher encryption (#367)
Browse files Browse the repository at this point in the history
* write a test for it

* bump the latest version

* bump to latest libxmtp version

* bump the pod spec
  • Loading branch information
nplasterer authored Jul 19, 2024
1 parent cb65818 commit 9ed0edf
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let package = Package(
.package(url: "https://github.com/1024jp/GzipSwift", from: "5.2.0"),
.package(url: "https://github.com/bufbuild/connect-swift", exact: "0.12.0"),
.package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"),
.package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "0.5.4-beta4"),
.package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "0.5.6-beta0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
41 changes: 41 additions & 0 deletions Tests/XMTPTests/ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,47 @@ class ClientTests: XCTestCase {
)
}

func testEncryptionKeyCanDecryptCorrectly() async throws {
let bo = try PrivateKey.generate()
let alix = try PrivateKey.generate()
let key = try Crypto.secureRandomBytes(count: 32)

let boClient = try await Client.create(
account: bo,
options: .init(
api: .init(env: .local, isSecure: false),
enableV3: true,
encryptionKey: key,
dbDirectory: "xmtp_db"
)
)

let alixClient = try await Client.create(
account: alix,
options: .init(
api: .init(env: .local, isSecure: false),
enableV3: true,
encryptionKey: key,
dbDirectory: "xmtp_db"
)
)

let group = try await boClient.conversations.newGroup(with: [alixClient.address])

let key2 = try Crypto.secureRandomBytes(count: 32)
await assertThrowsAsyncError(
try await Client.create(
account: bo,
options: .init(
api: .init(env: .local, isSecure: false),
enableV3: true,
encryptionKey: key2,
dbDirectory: "xmtp_db"
)
)
)
}

func testCanGetAnInboxIdFromAddress() async throws {
let key = try Crypto.secureRandomBytes(count: 32)
let bo = try PrivateKey.generate()
Expand Down
4 changes: 2 additions & 2 deletions XMTP.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
#

spec.name = "XMTP"
spec.version = "0.13.6"
spec.version = "0.13.7"
spec.summary = "XMTP SDK Cocoapod"

# This description is used to generate tags and improve search results.
Expand Down Expand Up @@ -44,5 +44,5 @@ Pod::Spec.new do |spec|
spec.dependency "web3.swift"
spec.dependency "GzipSwift"
spec.dependency "Connect-Swift", "= 0.12.0"
spec.dependency 'LibXMTP', '= 0.5.4-beta4'
spec.dependency 'LibXMTP', '= 0.5.6-beta0'
end
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/xmtp/libxmtp-swift.git",
"state" : {
"revision" : "c38c7be91f18d2021f66bee9d878ec1dde7b91f5",
"version" : "0.5.4-beta4"
"revision" : "b9012ce7dd2362bc207103a1a2c1cb27a486f0fc",
"version" : "0.5.6-beta0"
}
},
{
Expand Down

0 comments on commit 9ed0edf

Please sign in to comment.