Code Monkey home page Code Monkey logo

beryllium's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.