Automatically generate Cwtch C-Bindings from a high-level specification.
Note for the Flutter-based Cwtch UI Application see: https://git.openprivacy.ca/cwtch.im/cwtch-ui
go mod download go run generate/generate_bindings.go make linux // alternatively windows, android, macos
Autobindings allow for comile time selection of experiments. Default selections for each target platform are supplied in Makefile but can be overridden with:
env EXPERIMENTS="serverExperiment otherExperiment" make android
Spec File Format
The current Cwtch Bindings Specification is defined in spec
Supported function prototypes:
app <Function Name> <Args>- an application-level function, called on global
profile <Function Name> <Args>- a profile-level function, takes
profileas an implicit first argument
json(profile) <Function Name> <Args>- a profile-level function, takes
profileas an implicit first argument and returns a json blob that must be freed by the calling library (see MEMORY)
@profile-experiment <Function Name> <Experiment> <Args>- an experimental profile-level function, takes
profileas an implicit first argument, experiment must implement cwtch Functionality interface
@(json)profile-experiment <Function Name> <Experiment> <Args>- am experimental profile-level function, takes
profileas an implicit first argument and returns a json blob that must be freed by the calling (see MEMORY) library, , experiment must implement cwtch Functionality interface
Supported argument prototypes:
profile- a cwtch profile identifier
conversation- a cwtch conversation identifier
message- a cwtch message identifier
int:<name>- a generic integer argument (with optional name)
bool:<name>- a generic boolean argument (with optional name)
string:<name>- a generic string argument (with optional name)
All arguments must be defined in the order they are specified by the underlying Cwtch library function.
import <go pkg>- includes an additional go importin the compiled lib.go (needed for experiments)
- Functions that start with
Enhancedare automatically stripped of that prefix for their binding names e.g.
EnhancedGetMessagegenerated a binding
c_GetMessage- for certain functions Cwtch has two potential calling options
Enhanced<Function>. "Enhanced" in this case means that the response is optimised for calling by a user-facing application by e.g. directly making a number of calls under the hood and returning a json blob of the results.
General Environment Variables
LOG_FILEif defined will mean all go logging will go to a file instead of stdout
LOG_LEVELif set to
debugwill cause debug logging to be included in log output
CWTCH_PROFILEif set to
1will cause a memory profile to be written to
mem.profand all active goroutines written to
CWTCH_TAILSif set to
truewill override the Tor configuration to allow Cwtch to work in a Tail-like environment.
LD_LIBRARY_PATHset to point to
- or drop a symlink into
Cross compile arm 64
sudo apt install gcc-aarch64-linux-gnu
- copy libCwtch.dll into the directory of the
- copy libCwtch.x64.dylib and libCwtch.arm.dylib into the directory you are executing from
Support Cwtch Development
If you want to see us move faster on some of these goals and are in a position to, please donate. If you happen to be at a company that wants to do more for the community and this aligns, please consider donating or sponsoring a developer.
Donations of $5 or more can opt to receive stickers as a thank-you gift!
For more information about donating to Open Privacy and claiming a thank you gift please visit the Open Privacy Donate page.