Skip to content

Manage backend accounts authentication and password with Python REST API

License

Notifications You must be signed in to change notification settings

quarkey-net/quarkey-api-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST API Backend for Quarkey Frontend

Quarkey

Deploy Chat

Introduction

"A RESTful api for the Quarkey password manager and its web application made in VueJS. It will eventually support experimental quantum encryption in its stable version"

If you wish to use the API in a public development version you will need to request a development key to activate your account. Please contact us at esteban.ristich@protonmail.com or notify us on our discord server.

Table of contents

Quickstart

The API can be built locally. For a precise configuration of the api when it is launched, please refer to the file utils/configs.py

The API requires a postgresql server. The tables to be loaded are specified in the database/sql folder and must be loaded in this order:

  1. tables.sql
  2. triggers.sql
  3. functions.sql

Linux dependencies (Debian & Ubuntu)

$ sudo apt update && sudo apt install gcc libev-dev libpq-dev postgresql python3 python3-venv

Building

# clone development repository
$ git clone git@github.com:PowerSaucisse/quarkey-api-server.git --branch dev

# Move to project
$ cd quarkey-api-server

# Setup virtual environment and packages
$ python -m venv ./venv             
$ source ./venv/bin/activate        # .\venv\Scripts\Activate.ps1 for Windows
$ pip3 install -r requirements.txt  # win_requirements.txt for Windows

# launch
$ python launch.py

Documentation

There is currently no domain name assigned to the service. However, a Heroku version is hosted in order to perform security tests and audits. If you wish to contribute, you can request key from the following address:

The API currently only supports JSON. So please define in your header the following key and value 'Content-Type': 'application/json' and your token 'Authorization': 'YOUR_TOKEN'. This token will be needed to access all resources, except :

  • http://quarkey.herokuapp.com/api/auth/register
  • http://quarkey.herokuapp.com/api/auth/login

Create account

  • Method : POST

  • Request : http://quarkey.herokuapp.com/api/auth/register

  • Parameter :

    • username : TEXT Username take minimum 3 characters and 24 max with numbers but no special characters execpt underscore
    • firstname : TEXT Firstname take minimum 2 characters and 20 max
    • lastname : TEXT Lastname take minimum 2 characters and 20 max
    • email : TEXTTake email format
    • password : TEXT Password must have at least one capital letter and one special character and one number. He must have also 8 minimum characters
    • key : TEXT 20 characters key
  • Body :

        {
            "username" : "esteban",
            "firstname": "Esteban",
            "lastname" : "Ristich",
            "email"    : "esteban.ristich@protonmail.com",
            "password" : "Motdepasse#38",
            "key"      : "<TESTER KEY>"
        }

Login to account

For security and caching reasons, login requests are made via the POST method.

  • Method : POST

  • Request : http://quarkey.herokuapp.com/api/auth/login

  • Body :

    {
      "username": "esteban",
      "password": "Motdepasse#38"
    }
  • Return :

    {
      "title": "OK",
      "description": "success to login",
      "content": {"token": "<YOUR_TOKEN>"}
    }

Create password item

  • Method : POST

  • Request : http://quarkey.herokuapp.com/api/account/item/password

  • Body :

      {
        "name"       : "Digital Ocean",
        "description": "smart cloud platform",
        "login"      : "random.user@gmail.com",
        "url"        : "https://cloud.digitalocean.com/login",
        "password"   : "motdepasse#38"
      }

Get password item

  • Method : GET

  • Request : http://quarkey.herokuapp.com/api/account/item/password

  • Return :

      {
        "title": "OK",
        "description": "password list getted successful",
        "content": [
          {
            "id": "e882a1fffd624e5baa5b3e0054790af8",
            "type": "basic",
            "name": "Digital Ocean",
            "description": "smart cloud platform",
            "login": "random.user@gmail.com",
            "password": [
              "motdepasse#38",
              null
            ],
            "url": "https://cloud.digitalocean.com/login",
            "tags": [
              {
                "id": "a20cb92d0d9f43d6aef55a39909a0027",
                "name": "global",
                "color": "white"
              }
            ]
          },
          {
            "id": "6b53aaca28a6410bb8f9325acbdc26b2",
            "type": "basic",
            "name": "Steam",
            "description": "Game platform",
            "login": "nicdouille38",
            "password": [
              "motdepasse#38",
              null
            ],
            "url": "https://steampowered.com/login",
            "tags": [
              {
                "id": "acac24dff32d484fad4a65e35b49b657",
                "name": "global",
                "color": "white"
              },
              {
                "id": "5c8b07d3767b4f828701318e35b65550",
                "name": "games",
                "color": "blue"
              }
            ]
          },
          {
            "id": "b8174dd5b93a4a1c86bdb8854709e475",
            "type": "basic",
            "name": "Riot account",
            "description": "To play lol and valorant",
            "login": "nicdouille38",
            "password": [
              "motdepasse#38",
              null
            ],
            "url": "https://riot-games.com/login",
            "tags": [
              {
                "id": "3f083e9efb7a4c639977b1f9432debd7",
                "name": "global",
                "color": "white"
              },
              {
                "id": "5c8b07d3767b4f828701318e35b65550",
                "name": "games",
                "color": "blue"
              }
            ]
          }
        ]
      }

Delete password item

  • Method : DELETE
  • Request : http://quarkey.herokuapp.com/api/account/item/password
  • Parameter :
    • password_id : UUID password id
  • Example : http://quarkey.herokuapp.com/api/account/item/password?password_id=8ef944aa5b7c458d9ef9b60ab90d3e5a

Create tag item

A tag name is unique per account

  • Method : POST

  • Request : http://quarkey.herokuapp.com/api/account/item/tag

  • Body :

    {
      "name"   : "Digital Ocean",
      "color"  : "blue" 
    }

Get tag item

  • Method : GET
  • Request : http://quarkey.herokuapp.com/api/account/item/tag

Delete tag item

  • Method : DELETE
  • Request : http://quarkey.herokuapp.com/api/account/item/tag
  • Parameter :
    • tag_id : UUID
    • tag_name : TEXT

Link password to tag

  • Method : POST

  • Request : http://quarkey.herokuapp.com/api/account/item/password/link/to/tag

  • Parameter :

    • password_id : UUID
    • tag_id : UUID
    • tag_name : TEXT you can specify tag name instead tag id
  • Body :

    {
        "password_id": "b8174dd5-b93a-4a1c-86bd-b8854709e475",
        "tag_id": "5c8b07d3-767b-4f82-8701-318e35b65550"
    }

Unlink password from tag

  • Method : DELETE

  • Request : http://quarkey.herokuapp.com/api/account/item/password/link/to/tag

  • Parameter :

    • password_id : UUID
    • tag_id : UUID
    • tag_name : TEXT you can specify tag name instead tag id
  • Body :

    {
        "password_id": "b8174dd5-b93a-4a1c-86bd-b8854709e475",
        "tag_id": "5c8b07d3-767b-4f82-8701-318e35b65550"
    }

Create tester key

  • Method : POST
  • Request : http://quarkey.herokuapp.com/api/account/tester/key

License

This project is licensed under MIT.

About

Manage backend accounts authentication and password with Python REST API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages