Rust SDK for Threema Gateway.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
examples
src
.gitignore
CHANGELOG.md
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
README.md
RELEASING.md

README.md

Rust SDK for Threema Gateway

CircleCI Crates.io Version Crates.io Downloads Rust

This is a work-in-progress implementation of a Threema Gateway client library in Rust.

Not everything is implemented yet, but sending simple and end-to-end encrypted messages works.

This library requires Rust 2018 (1.31+).

Docs

Features

Sending

  • Send simple messages
  • Send end-to-end encrypted messages

Encrypting

  • Encrypt raw bytes
  • Encrypt text messages
  • Encrypt image messages
  • Encrypt file messages
  • Encrypt delivery receipt messages

Lookup

  • Look up ID by phone number
  • Look up ID by e-mail
  • Look up ID by phone number hash
  • Look up ID by e-mail hash
  • Look up capabilities by ID
  • Look up public key by ID
  • Look up remaining credits

Receiving

  • Verify MAC of incoming message
  • Decrypt incoming message

Files

  • Upload files
  • Download files

Usage

Take a look at the examples in the examples/ directory to see how they're implemented.

Lookup public key:

cargo run --example lookup_pubkey -- <our_id> <secret> <their_id>

Send simple transport-encrypted encrypted message:

cargo run --example send_simple -- <from> id <to-id> <secret> <text>...
cargo run --example send_simple -- <from> email <to-email> <secret> <text>...
cargo run --example send_simple -- <from> phone <to-phone> <secret> <text>...

Send e2e encrypted message:

cargo run --example send_e2e_text -- <from> <to> <secret> <private-key> <text>...

Look up Threema ID by phone:

cargo run --example lookup_id -- by_phone <from> <secret> 41791234567

Look up Threema ID by email hash:

cargo run --example lookup_id -- by_email_hash <from> <secret> 1ea093239cc5f0e1b6ec81b866265b921f26dc4033025410063309f4d1a8ee2c

License

Licensed under either of

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.