signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.52k stars 410 forks source link

[Swift][Pod] Add macOS support #512

Open EddieLukeAtmey opened 1 year ago

EddieLukeAtmey commented 1 year ago

Hi, I'm having an iOS SwiftUI chat app that is using LibSignalClient. Everything works fine until I have a request to make this app work on MacOS (to build a desktop app, later implement it on windows).

At first, I tried to set multiple-platform on my current target, which caused a few problems since cocoapods doesn't support multiple-platform on a single target yet. Then I separated the target into new ones, specific to iOS and MacOS. My pod file looks like this (simplified)

def shared
    pod 'LibSignalClient', git: 'https://github.com/signalapp/libsignal.git'
    pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git'
end

target 'MyApp' do
    # Pods for iOS
    platform :ios, '15.0'
    shared
end

target 'MyApp-mac' do
    # Pods for Mac
    platform :osx, '11.0'
    shared
end

Then I run pod install and got this error:

The platform of the target `MyApp-mac` (macOS 11.0) is not compatible with `LibSignalClient (0.21.1)`, which does not support `macOS`.

Does this mean it's impossible to develop this idea using SignalProtocol? Otherwise, what should I do next?

EddieLukeAtmey commented 1 year ago

I closed because I thought this repo might help but after reading for a while, I'm not sure how to integrate the libSignal, so I reopened it again.

jrose-signal commented 1 year ago

I think we can add macOS support to the Podfile. It won't be officially supported because it's not one of Signal's app platforms (our Mac app uses Electron), but it should work. You'll have to build the Rust parts yourself, though (and the simplest way to do that is to check out this repo and use it as a development pod).

I can't promise when I'll get to this, but it shouldn't be too hard. If you want to play with it yourself and send a PR that could speed things along.

TechAssissinDarkness commented 1 year ago

The error message you received is indicating that LibSignalClient does not currently support MacOS, which means that you won't be able to use it for your MacOS target. However, this does not necessarily mean that your idea is impossible to develop using SignalProtocol.

One possible solution is to use a different library that supports both iOS and MacOS. You could consider using the SignalProtocolSwift library, which is the successor to LibSignalClient. SignalProtocolSwift is a native Swift implementation of the Signal Protocol, and it supports both iOS and MacOS platforms.

To use SignalProtocolSwift, you can add the following line to your Podfile:

pod 'SignalProtocolSwift', '~> 3.1.0'

Then run pod install again to install the library.

Keep in mind that SignalProtocolSwift has a different API than LibSignalClient, so you will need to update your code accordingly. But this should allow you to support both iOS and MacOS platforms in your chat app.

Hi, I'm having an iOS SwiftUI chat app that is using LibSignalClient. Everything works fine until I have a request to make this app work on MacOS (to build a desktop app, later implement it on windows).

At first, I tried to set multiple-platform on my current target, which caused a few problems since cocoapods doesn't support multiple-platform on a single target yet. Then I separated the target into new ones, specific to iOS and MacOS. My pod file looks like this (simplified)

def shared
  pod 'LibSignalClient', git: 'https://github.com/signalapp/libsignal.git'
  pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git'
end

target 'MyApp' do
  # Pods for iOS
  platform :ios, '15.0'
  shared
end

target 'MyApp-mac' do
  # Pods for Mac
  platform :osx, '11.0'
  shared
end

Then I run pod install and got this error:

The platform of the target `MyApp-mac` (macOS 11.0) is not compatible with `LibSignalClient (0.21.1)`, which does not support `macOS`.

Does this mean it's impossible to develop this idea using SignalProtocol? Otherwise, what should I do next?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jrose-signal commented 10 months ago

I'm leaving this open but acknowledging that Signal probably won't end up working on it; with the changes in v0.22.0 (which came out just before this issue was filed) you'd still have to build the Rust part yourself rather than using the prebuilds Signal has. (PRs still welcome to enable that, but that's probably less generally useful than what the original filer was hoping.)

The Signal prebuilds do currently include Mac Catalyst slices, but we don't promise to keep those up either; Mac Catalyst is one of the things that ties us to using Rust nightly compilers, and if we solve all the other things keeping us on nightly I don't think we'd keep publishing Mac Catalyst slices.