Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

whisperfish/libsignal-protocol-rs

Repository files navigation

libsignal-protocol-rs

Codacy Badge Build Status FOSSA Status License libsignal-protocol on crates.io Docs for libsignal-protocol

(API Docs for master)

A Rust interface to the Signal Protocol.

DEPRECATED in favour of https://github.com/signalapp/libsignal-client! Signal reimplemented the whole thing in Rust, and libsignal-service-rs is now based on that.

Examples

The simplest thing you can do with this library is generate a private identity key. This is normally only ever done once when you first start (sometimes called install time).

// create our global context (for things like crypto and locking)
let ctx = Context::default();

let identity = libsignal_protocol::generate_identity_key_pair(&ctx)?;

Next, you'll normally want to generate a bunch of unsigned pre-keys which people can use when contacting you, and one signed pre-key.

let ctx = Context::default();

let identity = libsignal_protocol::generate_identity_key_pair(&ctx)?;

let signed_pre_key = libsignal_protocol::generate_signed_pre_key(
    &ctx,
    &identity,
    5,
    SystemTime::now(),
)?;

let start = 123;
let count = 20;

let pre_keys = libsignal_protocol::generate_pre_keys(&ctx, start, count)?
    .collect::<Vec<PreKey>>();

A Registration ID should also be created at install time.

let ctx = Context::default();
let extended_range = 42;

let registration_id = libsignal_protocol::generate_registration_id(&ctx, extended_range)?;

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 2015-2019 Open Whisper Systems

Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html

Additional Permissions For Submission to Apple App Store: Provided that you are otherwise in compliance with the GPLv3 for each covered work you convey (including without limitation making the Corresponding Source available in compliance with Section 6 of the GPLv3), Open Whisper Systems also grants you the additional permission to convey through the Apple App Store non-source executable versions of the Program as incorporated into each applicable covered work as Executable Versions only under the Mozilla Public License version 2.0 (https://www.mozilla.org/en-US/MPL/2.0/).

FOSSA Status

About

A Rust interface to the Signal Protocol. DEPRECATED in favour of https://github.com/signalapp/libsignal-client ! Signal reimplemented the whole thing in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages