A place for things ❤️🔥
An encrypted chat app, inspired by Signal's implementation of encryption, but much less securely implemented. Don't use this for anything serious unless you have experience with encryption and have a thorough system for vetting your stuff.
But the system is all built purely in Swift. There's a Vapor server that stands up a mongo database, and a good start on a universal Swift chat app that syncs encrypted chats to other devices through CloudKit.
Real-time chat features (including typing indicators and incoming messages when the app is open) are managed through a custom websocket connection.
All in all, it was a big lift, and a fun project to work on!
In order to build and run the server locally you will need to pass in a variety of Arguments and Environment Variables. The Environment Variables are also reccomended on a production server as well, but this repo isn't there yet.
serve --hostname 0.0.0.0 --port 8080
APNS_TEAM_ID
:<Your Team ID>
APNS_KEY
:<Your .pem Private Key (downloaded from developer.apple.com, and configured with APNS permissions)
APNS_KEY_ID
:<Your .pem Key ID (found on the page you downloaded your private key from)>
See the following screenshot for an example of all the required keys and arguments:
Navigate to the Developer
directory and build the docker containers with docker-compose
:
cd Affirmate/AffirmateServer
docker-compose build db
docker-compose up db
Before the database can work the server needs to run a migration, which creates all the tables in the database. Run the following command from Affirmate/AffirmateServer
to start the migration:
vapor run migrate
Before the app will connect to the database, the server needs to be running.
Select the target Run
and click the play button to build and run the server on your Mac.
It will be running at http://0.0.0.0:8080
.
You should see [ NOTICE ] Server starting on http://0.0.0.0:8080 (Vapor/HTTPServer.swift:296)
towards the bottom of the Xcode console.
Now that the database and the server are up and running you can build and run the iOS, watchOS, or macOS apps and they should connect to the same database/server instance running on your Mac.