|
2 weeks ago | |
---|---|---|
constants | 4 weeks ago | |
experiments/servers | 4 weeks ago | |
features | 4 weeks ago | |
generate | 2 weeks ago | |
templates | 2 weeks ago | |
utils | 2 weeks ago | |
.drone.yml | 2 weeks ago | |
.gitignore | 1 month ago | |
MEMORY.md | 1 month ago | |
Makefile | 2 weeks ago | |
README.md | 2 weeks ago | |
go.mod | 2 weeks ago | |
go.sum | 2 weeks ago | |
quality.sh | 1 month ago | |
spec | 4 weeks ago | |
switch-ffi.sh | 1 month ago | |
switch-gomobile.sh | 1 month ago |
README.md
Cwtch Autobindings
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
Building
go mod download
go run generate/generate_bindings.go
make linux // alternatively windows, android, macos
NOTE: Autobindings currently depends on an unreleased version of Cwtch (cwtch.im/cwtch v0.18.10-0.20230221235514-49e0d849fa3e
).
Experiments
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 globalApplication
profile <Function Name> <Args>
- a profile-level function, takesprofile
as an implicit first argumentjson(profile) <Function Name> <Args>
- a profile-level function, takesprofile
as 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, takesprofile
as an implicit first argument, experiment must implement cwtch Functionality interface@(json)profile-experiment <Function Name> <Experiment> <Args>
- am experimental profile-level function, takesprofile
as 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 identifierconversation
- a cwtch conversation identifiermessage
- a cwtch message identifierint:<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.
Other directives:
import <go pkg>
- includes an additional go importin the compiled lib.go (needed for experiments)- Functions that start with
Enhanced
are automatically stripped of that prefix for their binding names e.g.EnhancedGetMessage
generated a bindingc_GetMessage
- for certain functions Cwtch has two potential calling options<Function>
andEnhanced<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.
Support Cwtch Development
We couldn't do what we do without all the wonderful community support we get, from one-off donations to recurring support via Patreon.
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.