
Signal Protocol तथा अन्य क्रिप्टोग्राफ़िक प्रिमिटिव्स का घर, जो Signal को संभव बनाते हैं।
# अवलोकन
libsignal में प्लेटफ़ॉर्म-अज्ञेय API शामिल हैं जिनका उपयोग आधिकारिक Signal क्लाइंट और सर्वर द्वारा किया जाता है, जो
Java, Swift, या TypeScript लाइब्रेरी के रूप में उपलब्ध हैं। अंतर्निहित कार्यान्वयन Rust में लिखे गए हैं:
- libsignal-protocol: Signal प्रोटोकॉल को लागू करता है, जिसमें [Double Ratchet algorithm][] शामिल है। यह
[libsignal-protocol-java][] और [libsignal-metadata-java][] का प्रतिस्थापन है।
- signal-crypto: AES-GCM जैसे क्रिप्टोग्राफ़िक प्रिमिटिव। जहाँ संभव हो हम [RustCrypto][] का उपयोग करते हैं
लेकिन कभी-कभी हमारी आवश्यकताएँ भिन्न होती हैं।
- device-transfer: Signal की डिवाइस-से-डिवाइस ट्रांसफ़र सुविधा के लिए सहायक लॉजिक।
- attest: [SGX enclaves][] और सर्वर-साइड [HSMs][] के रिमोट अटेस्टेशन के लिए कार्यक्षमता।
- zkgroup: Signal में उपलब्ध [zero-knowledge groups][] और संबंधित सुविधाओं के लिए कार्यक्षमता।
- zkcredential: zkgroup द्वारा उपयोग किए जाने वाले शून्य-ज्ञान क्रेडेंशियल के प्रकार के लिए एक अमूर्तन, जो Chase, Perrin, और Zaverucha के पेपर "[The Signal Private Group System][]" पर आधारित है।
- poksho: शून्य-ज्ञान प्रमाण (जैसे zkgroup द्वारा उपयोग किए जाने वाले) लागू करने के लिए उपयोगिताएँ; इसका अर्थ है "proof-of-knowledge, stateful-hash-object"।
- account-keys: Signal के Secure Value Recovery सिस्टम में [PINs][] को पासवर्ड के रूप में लगातार उपयोग करने के लिए कार्यक्षमता, साथ ही अन्य खाता-व्यापी कुंजी संचालन।
- usernames: उपयोगकर्ता नाम निर्माण, हैशिंग, और प्रमाणों के लिए कार्यक्षमता।
- media: मीडिया में हेरफेर करने के लिए उपयोगिताएँ।
यह रिपॉज़िटरी Signal क्लाइंट ऐप्स ([Android][], [iOS][], और [Desktop][]) के साथ-साथ
सर्वर-साइड द्वारा भी उपयोग की जाती है। Signal के बाहर उपयोग असमर्थित है। विशेष रूप से, इस रिपॉज़िटरी के
उत्पाद वे Java, Swift, और TypeScript लाइब्रेरी हैं जो अंतर्निहित Rust कार्यान्वयन को लपेटती हैं। सभी
API और कार्यान्वयन बिना सूचना के परिवर्तन के अधीन हैं, जैसे कि JNI, C, और Node ऐड-ऑन
"ब्रिज" परतें। हालाँकि, Java, Swift, TypeScript, और
गैर-ब्रिज Rust API में पश्चगामी-असंगत परिवर्तन सर्वोत्तम-प्रयास के आधार पर संस्करण संख्या में प्रतिबिंबित होंगे, जिसमें
न्यूनतम समर्थित टूल संस्करणों में वृद्धि शामिल है।
[Double Ratchet algorithm]: https://signal.org/docs/
[libsignal-protocol-java]: https://github.com/signalapp/libsignal-protocol-java
[libsignal-metadata-java]: https://github.com/signalapp/libsignal-metadata-java
[RustCrypto]: https://github.com/RustCrypto
[Noise protocol]: http://noiseprotocol.org/
[SGX enclaves]: https://www.intel.com/content/www/us/en/architecture-and-technology/software-guard-extensions.html
[HSMs]: https://en.wikipedia.org/wiki/Hardware_security_module
[zero-knowledge groups]: https://signal.org/blog/signal-private-group-system/
[The Signal Private Group System]: https://eprint.iacr.org/2019/1416.pdf
[PINs]: https://signal.org/blog/signal-pins/
[Android]: https://github.com/signalapp/Signal-Android
[iOS]: https://github.com/signalapp/Signal-iOS
[Desktop]: https://github.com/signalapp/Signal-Desktop
# निर्माण
### टूलचेन इंस्टॉलेशन
इस रिपॉज़िटरी में कुछ भी बनाने के लिए आपके पास [Rust](https://rust-lang.org) इंस्टॉल होना चाहिए, साथ ही
Clang, libclang, [CMake](https://cmake.org), Make, protoc, Python (3.11+),
और git के हालिया संस्करण होने चाहिए।
#### Linux/Debian
Debian-जैसे सिस्टम पर, आप इन अतिरिक्त निर्भरताओं को `apt` के माध्यम से प्राप्त कर सकते हैं:
```shell
$ apt-get install clang libclang-dev cmake make protobuf-compiler libprotobuf-dev python3 git
```
#### macOS
macOS पर, हमारे पास Rust टूलचेन सेट करने के लिए एक best-effort maintained स्क्रिप्ट है जिसे आप इस प्रकार चला सकते हैं:
```shell
$ bin/mac_setup.sh
```
## Rust
### पहला बिल्ड और टेस्ट
बिल्ड वर्तमान में Rust स्थिर कंपाइलर के एक विशिष्ट संस्करण का उपयोग करता है, जिसे
cargo द्वारा स्वचालित रूप से डाउनलोड किया जाएगा। बुनियादी प्रोटोकॉल
लाइब्रेरीज़ को बिल्ड और टेस्ट करने के लिए:
```shell
$ cargo build
...
$ cargo test
...
```
### अतिरिक्त Rust उपकरण
ऊपर दिए गए बुनियादी उपकरण आपको अधिकांश libsignal Rust विकास के लिए सेट अप कर देंगे।
समय के साथ, आप पाएंगे कि आपको कुछ अतिरिक्त Rust उपकरणों की आवश्यकता हो सकती है, जैसे कोड फ़ॉर्मेटिंग के लिए `taplo`।
आपको अपने सिस्टम पैकेज मैनेजर (जैसे `apt` या `brew`) के बजाय cargo से हमेशा कोई भी Rust उपकरण इंस्टॉल करना चाहिए जो बिल्ड को प्रभावित कर सकता है। पैकेज मैनेजर में कभी-कभी इन उपकरणों के पुराने संस्करण होते हैं जो असंगतता समस्याओं के कारण बिल्ड को तोड़ सकते हैं।
हमारे द्वारा उपयोग किए जाने वाले संस्करणों से मेल खाने वाले मुख्य Rust अतिरिक्त निर्भरताओं को इंस्टॉल करने के लिए, आप निम्नलिखित कमांड चला सकते हैं:
```shell
$ cargo +stable install --version "$(cat acknowledgments/cargo-about-version)" --locked cargo-about
$ cargo +stable install --version "$(cat .taplo-cli-version)" --locked taplo-cli
$ cargo +stable install cargo-fuzz
```
## Java/Android
### टूलचेन सेटअप / कॉन्फ़िगरेशन
Android के लिए बिल्ड करने के लिए आपको कई अतिरिक्त पैकेज इंस्टॉल करने होंगे, जिनमें एक JDK,
Android NDK/SDK शामिल हैं, और Rust कंपाइलर में Android टारगेट्स जोड़ने होंगे, इसका उपयोग करके
```rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android```
Our officially supported JDK version for Android builds is JDK 21, so be sure to install e.g. OpenJDK 21, and then point JAVA_HOME to it.
You can easily do this on macOS via:
```shell
export JAVA_HOME=$(/usr/libexec/java_home -v 21)
```
On Linux, the way you do this varies by distribution. For Debian based distributions like Ubuntu, you can use:
```shell
sudo update-alternatives --config java
```
We also check-in a `.tools_version` file for use with runtime version managers.
### Building and Testing
To build the Java/Android ``jar`` and ``aar``, and run the tests:
```shell
$ cd java
$ ./gradlew test
$ ./gradlew build # यदि आपको AAR आउटपुट चाहिए
```
You can pass `-P debugLevelLogs` to Gradle to build without filtering out debug- and verbose-level
logs from Rust, and `-P jniTypeTagging` to enable additional checks in the Rust JNI bridging code.
Alternately, a build system using Docker is available:
```shell
$ cd java
$ make
```
When exposing new APIs to Java, you will need to run `cargo run -p libsignal-jni-native_kt` (or
`just generate-jni`) in addition to rebuilding.
### Use as a library
Signal publishes Java packages for its own use, under the names org.signal:libsignal-server,
org.signal:libsignal-client, and org.signal:libsignal-android. libsignal-client and libsignal-server
contain native libraries for Debian-flavored x86_64 Linux as well as Windows (x86_64) and macOS
(x86_64 and arm64). libsignal-android contains native libraries for armeabi-v7a, arm64-v8a, x86, and
x86_64 Android. These are located in a Maven repository at
https://build-artifacts.signal.org/libraries/maven/; for use from Gradle, add the following to your
`repositories` block:
```
maven {
name = "SignalBuildArtifacts"
// "uri()" वाला हिस्सा केवल Kotlin Gradle के लिए आवश्यक है; Groovy Gradle यहाँ सादा स्ट्रिंग स्वीकार करता है।
url = uri("https://build-artifacts.signal.org/libraries/maven/")
}
```
Older builds were published to [Maven Central](https://central.sonatype.org) instead.
When building for Android you need *both* libsignal-android and libsignal-client, but the Windows
and macOS libraries in libsignal-client won't automatically be excluded from your final app. You can
explicitly exclude them using `packaging`:
```
android {
// ...
packaging {
resources {
excludes += setOf("libsignal_jni*.dylib", "signal_jni*.dll")
}
}
// ...
}
```
You can additionally exclude `libsignal_jni_testing.so` if you do not plan to use any of the APIs
intended for client testing.
### Testing a local build with Signal-Android
The Signal-Android gradle.properties file has a commented-out line to include libsignal as part of the build. Uncomment that and adjust the path; optionally, you can restrict the architectures you want to build for by adding `androidArchs=aarch64` to *libsignal's* gradle.properties. (The set of recognized architectures is in java/build_jni.sh.) If you're using an IDE, you'll need to re-import the Gradle structure at this point. When you're done, revert the changes to the Android app's gradle.properties and re-import once more.
Note that this does not import the *Rust* parts of the project into the IDE. Doing that in a multi-language IDE like IDEA is possible, but finicky; as of 2025 the most reliable way to do it is to open the Android project first, add the libsignal repo root directory as a Rust project second (only including the top-level directory), and only then make the changes to gradle.properties.
## Swift
To learn about the Swift build process see [``swift/README.md``](https://github.com/signalapp/libsignal/blob/main/swift)
## Node
You'll need Node installed to build. If you have [nvm][], you can run `nvm use` to select an
appropriate version automatically.
We use `pnpm` as our package manager, and a Python script to control building the Rust library, accessible as `pnpm run build`.
```shell
$ cd node
$ nvm use
$ npm install -g pnpm # या `npx pnpm` का उपयोग करें
$ pnpm install
$ pnpm run build
$ pnpm run tsc
$ pnpm run test
```
When testing changes locally, you can use `pnpm run build` to do an incremental rebuild of the Rust library. Alternately, `pnpm run build-with-debug-level-logs` will rebuild without filtering out debug- and verbose-level logs.
When exposing new APIs to Node, you will need to run `just generate-node` in
addition to rebuilding.
[nvm]: https://github.com/nvm-sh/nvm
### NPM
Signal publishes the NPM package `@signalapp/libsignal-client` for its own use, including native
libraries for Windows, macOS, and Debian-flavored Linux. Both x64 and arm64 builds are included for
all three platforms, but the arm64 builds for Windows and Linux are considered experimental, since
there are no official builds of Signal for those architectures.
### Testing a local build with Signal-Desktop
After running all the build commands above, adjust the `@signalapp/libsignal-client` dependency in the Desktop app's package.json to "link:path/to/libsignal/node" and run `pnpm install`. When you're done, revert the changes to package.json and run `pnpm install` again.
# Contributions
Signal does accept external contributions to this project. However unless the change is
simple and easily understood, for example fixing a bug or portability issue, adding a new
test, or improving performance, first open an issue to discuss your intended change as not
all changes can be accepted.
Contributions that will not be used directly by one of Signal's official client apps may still be
considered, but only if they do not pose an undue maintenance burden or conflict with the goals of
the project.
Signing a [CLA (Contributor License Agreement)](https://signal.org/cla/) is required for all contributions.
## Code Formatting and Acknowledgments
You can run the styler on the entire project by running:
```shell
just format-all
```
You can run more extensive tests as well as linters and clippy by running:
```shell
बस check-pre-commit
```
When making a PR that adjusts dependencies, you'll need to regenerate our acknowledgments files. See [``acknowledgments/README.md``](https://github.com/signalapp/libsignal/blob/main/acknowledgments).
# Legal things
## Cryptography Notice
This distribution includes cryptographic software. The country in which you currently reside may have restrictions on
the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption
software, please check your country's laws, regulations and policies concerning the import, possession, or use, and
re-export of encryption software, to see if this is permitted. See <http://www.wassenaar.org/> for more information.
The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as
Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing
cryptographic functions with asymmetric algorithms. The form and manner of this distribution makes it eligible for
export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export
Administration Regulations, Section 740.13) for both object code and source code.
## License
Copyright 2020-2026 Signal Messenger, LLC
Licensed under the GNU AGPLv3: https://www.gnu.org/licenses/agpl-3.0.html