threebot

Version, currently master branch1 version
  • master branchlatestJul 19, 2020

github.com/Hamdy/kemal-threebot-oauth

Kemal framework - Threebot login support (Oauth)

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  threebot:
    github: Hamdy/kemal-threebot-oauth
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.35.1
License
MIT
Author
your-name-here <your-email-here>

Dependencies

Runtime Dependencies

  • kemal*git: https://github.com/kemalcr/kemal.git, commit: a8c0f09b858162bd13c96663febef5527b322a32
  • sodium*git: git@github.com:didactic-drunk/sodium.cr.git, commit: c99862505620a3ec135bbe12a2ff63f3c0def3e4
  • spec-kemal*github: kemalcr/spec-kemal
  • kemal-session-bcdb*github: hamdy/kemal-session-bcdb

README

threebot

Threebot login module for kemalcr.com applications and for crystal lang in general

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      threebot:
        github: crystaluniverse/kemal-threebot
  2. Run shards install

How to use

Download, compile & run 0-db (Backend for BCDB)
  • git clone git@github.com:threefoldtech/0-db.git
  • cd 0-db && make
  • ./zdb --mode seq
Download, compile & run BCDB (Backend for BCDB)
  • Install Rust programming language
  • git clone git@github.com:threefoldtech/bcdb.git
  • cd bcdb && make
  • copy bcdb binary anywhere cp bcdb/target/x86_64-unknown-linux-musl/release/bcdb .
  • download tfuser utility from here
  • use tfuser to register your 3bot user to explorer and generate seed file usr.seed using ./tfuser id create --name {3bot_username.3bot} --email {email}
  • run bcdb : ./bcdb --seed-file user.seed
  • now you can talk to bcdb through http via unix socket /tmp/bcdb.sock
Export needed environment vars
export SEED="sY4dAEWZXsPQEMOHzP65hNeDr4+7D0D6fbEm2In22t0="
export OPEN_KYC_URL=https://openkyc.live/verification/verify-sei
export THREEBOT_LOGIN_URL=https://login.threefold.me
Usage (Kemal.rc example)
require "kemal-session"
require "kemal-session-bcdb"
require "kemal"
require "threebot"

include Threebot

def login(context, email, identifier)
  pp! email
  pp! identifier
end
notes
  • You must include Threebot module
  • You must provide def login(context, email, identifier) method with your login logic, including any redirection after successful login
Require and add session settings if not included

require "kemal"
require "kemal-session"
require "kemal-session-bcdb"

Kemal::Session.config do |config|
  config.cookie_name = "redis_test"
  config.secret = "a_secret"
  config.engine = Kemal::Session::BcdbEngine.new(unixsocket= "/tmp/bcdb.sock", namespace = "kemal_sessions", key_prefix = "kemal:session:")
  config.timeout = Time::Span.new hours: 200, minutes: 0, seconds: 0
end
URL to use for 3botligin
  • URL to redirect to 3bot login {domain}/threebot/login