Giter VIP home page Giter VIP logo

digital-certificate's Introduction

Digital Certificate Authentication Web-app

This is a centralized certificate authentication web-app. The app provides several functions. It could issue certificates and allows user to authenticate their certificates.

Deployment

config.yml should be included in the root directory. The config.yml file stores the keys of Google reCAPTCHA v3 and it should be like

SITE_KEY: [site key]
SECRET_KEY: [secret key]

The web-app has used Google reCAPTCHA v3 to protect the website. The hash value and tokens are stored in the database.

Before starting the server, it is of importance to setup the config file

Setup the virtual environment

python3 -m venv venv
source venv/bin/activate
python3 -m pip install -r requirements.txt

Initialize Database

flask --app digital-certificate init-db

Start production server

There are indeed several ways to start the server in production mode. Here provides one, gunicorn.

python3 -m pip install gunicorn
python3 -m gunicorn -w [number of processors] --bind [binding address] 'digital-certificate:create_app()'

API docs

The website is built by employing the flask framework. The website serves two things, allowing user to verify their certificates and re-download the certificates.

Authentication

Upload

  • Endpoint: /api/upload
  • Method: POST
  • Response: JSON type data like.
{
    'message' : 'successful' | 'failed'
}

reponse the authentication result

The API only accepts file which could be submited by formData.

Download

Search File

  • Endpoint: /api/search
  • Method: POST
  • Response: JSON type data like
{
    'message' : 'recaptcha failed' | 'id or date note found' | 'file not found' | 'ok',
    'token' : 'sha256 token(if avaliable)'
}

The search file api only accepts form data which contains the following fields id, date, recaptcha response. The date should be the following format: yyyy-mm-dd. The recaptcha response should come from Google reCAPTCHA The API will verify the users are genuine or not and the data they provide is faulty.

If all the checkpoints are passed, the response will contain a token for user to download their file. For further explaination, please refer the next API's description.

Download file

  • Endpoint: /api/download
  • Method: GET
  • Response: pdf file

The token gotten from the API /api/search would be used here to download the file only once. If user want to download a file several times, they have to use the search file to re-obtain the token. The relevant information used to download the file would be embeded in the query string. The qury string would have id, date, and token.

digital-certificate's People

Contributors

yuchun1214 avatar

Watchers

 avatar

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.