telegabber/e2ee/omemo/libsignal/doc.go
2026-07-28 00:38:46 -04:00

29 lines
1.6 KiB
Go

// Package libsignal is a cgo binding around libomemo-c (github.com/dino/libomemo-c),
// a fork of libsignal-protocol-c that implements both legacy "siacs" OMEMO
// (protocol version 3) and modern OMEMO 1/OMEMO 2 (protocol version 4) on a
// shared Double Ratchet / X3DH crypto core.
//
// This package deliberately knows nothing about XMPP or OMEMO's XML wire
// format (device lists, bundles, the <encrypted> stanza shape) - it only
// exposes the underlying session/cipher primitives and a pluggable Store
// interface for persistence. The XEP-0384 specific layer lives above this
// package, in dev.narayana.im/narayana/telegabber/e2ee/omemo.
//
// # Build modes
//
// By default this package links libomemo-c and supports both legacy and
// modern OMEMO. Passing the "signal_legacy" build tag (e.g. `go build
// -tags signal_legacy`) instead links the pre-fork libsignal-protocol-c -
// useful on distros that only package that one (e.g. Debian bullseye ships
// libsignal-protocol-c-dev but not libomemo-c-dev, which arrived in
// bookworm). That build only supports legacy/siacs OMEMO; check
// ModernOMEMOSupported before relying on anything else. See cgo_modern.go/
// cgo_legacy.go and the version_*/deserialize_*/signedprekey_* files for
// the resulting API-surface differences between the two libraries.
//
// Concurrency: neither library is internally thread-safe (this binding
// does not wire up the optional locking-function hook - see Context).
// Callers must serialize all operations against a given Context/
// StoreContext pair themselves, e.g. with a single mutex per bridged chat
// identity.
package libsignal