Coder Social home page Coder Social logo

winderica / predauth Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 2.0 1.98 MB

Decentralized authorization system based on Hyperledger Fabric and Proxy ReEncryption

License: GNU General Public License v3.0

JavaScript 43.30% TypeScript 47.51% HTML 0.24% Shell 8.96%
proxy-re-encryption pairing-cryptography blockchain hyperledger-fabric authorization

predauth's Introduction

PreDAuth

Folder structure

./
├── app/
│   ├── backend/
│   │   ├── src/
│   │   ├── typings/
│   │   └── ...
│   └── frontend/
│       ├── src/
│       ├── typings/
│       └── ...
├── fabric/
│   ├── chaincode/
│   │   ├── src/
│   │   ├── typings/
│   │   └── ...
│   └── frontend/
│       ├── src/
│       ├── typings/
│       └── ...
└── lib/
    ├── mcl
    └── ...

API

  • GET /auth/generators
interface Response {
    ok: true;
    payload: {
        g: string;
        h: string;
    }
}
  • GET /auth/pks
interface Response {
    ok: true;
    payload: {
        pks: string[];
    }
}
  • POST /auth/reEncrypt/:id/:to
interface Body {
    nonce: string;
    signature: string;
    payload: {
        [tag: string]: string;
    };
}
interface Response {
    ok: true;
}
  • POST /user/:id
interface Body {
    nonce: string;
    signature: string;
    payload: {
        publicKey: string;
    };
}
interface Response {
    ok: true;
}
  • POST /user/:id/backup
interface Body {
    nonce: string;
    signature: string;
    payload: {
        [pk: string]: {
            rk: {
                [tag: string]: string;
            };
            email: string;
        };
    };
}
interface Response {
    ok: true;
}
  • POST /user/:id/data
interface Body {
    nonce: string;
    signature: string;
    payload: {
        [tag: string]: {
            key: {
                ca0: string;
                ca1: string;
            };
            data: string;
            iv: string;
        };
    };
}
interface Response {
    ok: true;
}
  • GET /user/:id/data
interface Response {
    ok: true;
    payload: {
        [tag: string]: {
            key: {
                ca0: string;
                ca1: string;
            };
            data: string;
            iv: string;
        };
    };
}
  • GET /user/:id/code/:email
interface Response {
    ok: true;
}
  • POST /user/:id/code
interface Body {
    payload: {
        codes: string[];
    };
}
interface Response {
    ok: true;
    payload: {
        data: string[];    
    }
}

Notes

Start network

cd fabric/network/
./network.sh up

Create channel

./network.sh createChannel

Deploy/Upgrade chaincode

  • prerequisites
cd ../chaincode/
yarn install
cd ../network
  • then
./network.sh deployCC -n PreDAuth

Deploy PreDAuth backend

  • prerequisites
yarn install
  • then
yarn cleanup # only needed after restart fabric network
yarn start

URL: http://127.0.0.1:4000

Deploy PreDAuth frontend

  • prerequisites
yarn install
  • then
yarn start

URL: http://127.0.0.1:3000

Deploy App backend

  • prerequisites
yarn install
  • then
yarn start

URL: http://127.0.0.1:4001

Deploy App frontend

  • prerequisites
yarn install
  • then
yarn start

URL: http://127.0.0.1:3001

predauth's People

Contributors

dependabot[bot] avatar winderica avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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