Skip to content

winderica/PreDAuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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