Coder Social home page Coder Social logo

shamir's Introduction

shamir

License: MIT

Introduction

The shamir is a one-time secret sharing application that allows users to safely share secrets by using unique IDs as references.

Each secret can only be accessed once and has a expiration of 15 minutes.

With this API, you can share sensitive information within teams without directly exposing them in chat applications or other communication channels.

In this application, we provide some shell aliases to facilitate requesting secret creation and secret retrieval. The goal here is to do the minimum effort to share a secret, as such each alias will copy the secret or the ID to the clipboard after the request has been made, which makes it very convenient to use.

Below you can find a guide with step-by-step instructions for deploying the the API on AWS EC2 using Nginx and Gunicorn.

Features

  • Secret sharing: share secrets by using unique IDs as references, ensuring confidentiality.
  • Team collaboration: Enable teams to share sensitive information without exposing it in chat applications or other channels.
  • Easy deployment: Deploy the Shamir API on AWS EC2 with Nginx and Gunicorn, following the instructions in this guide.

Prerequisites

  • AWS EC2 instance with Ubuntu 18.04 or higher as the operating system.
  • Basic knowledge of AWS EC2, SSH, and command line.

Installation

  1. Connect to your AWS EC2 instance via SSH.

  2. Clone the Shamir API repository:

    git clone https://github.com/squerez/shamir.git
  3. Navigate to the project directory:

    cd shamir/
  4. Install required dependencies:

    pip install -r requirements.txt
  5. Install NGINX:

    make install
  6. Replace YOUR_DOMAIN_OR_PUBLIC_IP in the config/nginx.conf with your domain or public ip. and then run:

    make configure-nginx
  7. Start gunicorn:

    make start-gunicorn

    Adjust the gunicorn configuration in config/gunicorn.py according to your preferred settings.

Usage

To access the Shamir API, use the public IP or domain name of your AWS EC2 instance along with the appropriate endpoints.

Follow the guidelines below:

Create a secret:
    Endpoint: http://your-public-ip-or-domain/create
    Method: POST
    Request body: { "secret": "your-secret" }
    Response: { "id": "unique-id" }

Get a secret:
    Endpoint: http://your-public-ip-or-domain/get/<secret-id>
    Method: POST
    Response: { "message": "shared-secret" }

Please note that you need to replace your-public-ip-or-domain with the actual public IP or domain name of your AWS EC2 instance.

Setting aliases

In your .zshrc, add the following aliases:

shamir_create() {
    SHAMIR_RESPONSE=$(
        curl -s -X POST -H "Content-Type: application/json" -d "{\"secret\": \"$1\"}" http://your-public-ip-or-domain/create
    )

    echo $SHAMIR_RESPONSE | jq -r '.id' | xsel -b
    echo "Secret created with ID: $(echo $SHAMIR_RESPONSE | jq -r '.id')"
}

shamir_get() {
    SHAMIR_RESPONSE=$(
        curl -s -X GET http://your-public-ip-or-domain/get/$1
    )

    echo $SHAMIR_RESPONSE | jq -r '.message' | xsel -b
    echo "Secret copied from ID: '$1'"
}

This sets the shamir_create and shamir_get functions, which get and create secrets directly in the API by doing curl requests. Please note that you need to replace your-public-ip-or-domain with the actual public IP or domain name of your AWS EC2 instance.

Once you have done these modifications, save the file and run source ~/.zshrc to apply the aliases.

Additional Information

  • Make sure to open the necessary ports (e.g., port 80) in your AWS EC2 security group settings to allow inbound traffic.
  • Customize the Nginx configuration file (nginx.conf) and the Gunicorn command as per your requirements.

License

This project is licensed under the MIT License.

shamir's People

Contributors

squerez 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.