Skip to content

OmnijarBots/beryllium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Beryllium

macOS Linux Windows License: MIT Twitter: @omnijarstudio

Wire bot SDK in Rust (experimental).

Dependencies

  • libsodium (required for Proteus and Cryptobox)
  • libprotoc - the binary is used only for codegen (i.e., for generating the Rust source for the messages.proto file in root)

Building

Add this git repo to your Cargo.toml, and then you can cargo build the executable.

For musl builds, you need a modified image of the musl builder - the Dockerfile is available in the repo root. Once you have the docker image, you can build the musl version of your bot.

For example, let's build the echo bot in examples

$ cd beryllium
$ docker build -t beryllium-rust-musl-builder .
$ docker run --rm -it -v "$(pwd)":/home/rust/src beryllium-rust-musl-builder sh -c 'cd examples/echo-bot && cargo build --release'

Installation

Private key and self-signed certificate

Currently, rustls only supports x509 v3 certificates with SubjectAltName extension. Make sure that your req.cnf looks something similar to this:

[req]
x509_extensions = v3_req
distinguished_name = req_distinguished_name
prompt = no

[req_distinguished_name]
C = IN
ST = TN
L = Chennai
O = Wire
OU = Bots
CN = waffles.bot

[v3_req]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = waffles.bot
  • Generate the private key, self-signed certificate and your public key.
openssl req -nodes -newkey rsa:4096 -x509 -keyout server.key -new -out server.crt -config req.cnf -sha256 -days 7500
openssl rsa -in server.key -text > server.pem
openssl rsa -in server.key -pubout -out pubkey.pem

Bot setup

  • Go to https://wire.com/b/devbot (not supported on mobile browsers, or Safari yet) - "DevBot" is used to set up your developer account and create your own bots.
  • Register yourself and create a new bot (type help for available commands).
  • Copy and paste the public key from pubkey.pem
  • Get the auth token.

Usage

See examples/echo-bot for a detailed example. In context of the example, AUTH is the auth token, CERT_PATH is the path to server.crt, and KEY_PATH is for server.pem.

Note: If you're planning to launch multiple bots, then make sure that they don't share the same directory for data.

About

High performance SDK for building bots on Wire.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published