-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from K-nto/feature/authentication
Feature/authentication
- Loading branch information
Showing
17 changed files
with
234 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ build/ | |
node_modules/ | ||
.env | ||
.vscode/settings.json | ||
org1.example.com | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,136 @@ | ||
# Kinto-storage-service | ||
<div align="center"> | ||
|
||
## Run | ||
<img src="resources/Kintoisologo.png" alt="logo" width="200" height="auto" /> | ||
<h1>Kinto storage service</h1> | ||
|
||
<h5> | ||
UADE Informatics Engineering thesis project - 2022 | ||
</h5> | ||
|
||
`npm run start` | ||
TODO: Add watch mode for dev | ||
<p> | ||
Kinto storage service, handles strorage and authentication operations. | ||
</p> | ||
|
||
<h4> | ||
<a href="https://github.com/K-nto/Kinto-storage-service/">Documentation</a> | ||
<span> · </span> | ||
<a href="https://github.com/K-nto/Kinto-storage-service/issues/">Report Bug</a> | ||
<span> · </span> | ||
<a href="https://github.com/K-nto/Kinto-storage-service/issues/">Request Feature</a> | ||
</h4> | ||
</div> | ||
|
||
### first version of ipfs connection | ||
<br /> | ||
|
||
start ipfs node in your computer with | ||
`jsipfs daemon` | ||
# :notebook_with_decorative_cover: Table of Contents | ||
|
||
make sure it's reachable (`localhost:5001/webui`) and, if not, configure CORS properly (there are instructions there) | ||
- [About the Project](#star2-about-the-project) | ||
- [Tech Stack](#space_invader-tech-stack) | ||
- [Features](#dart-features) | ||
- [Setup](#Setup) | ||
- [Prerequisites](#bangbang-prerequisites) | ||
- [Usage](#eyes-usage) | ||
- [License](#warning-license) | ||
- [Contact](#handshake-contact) | ||
- [Acknowledgements](#gem-acknowledgements) | ||
|
||
have fun | ||
## :star2: About the Project | ||
|
||
## Docs | ||
This service manages storage operatiuons, hyperledger blockchain connection, auuthentication and interactions, and IPFS network operations. | ||
|
||
TODO: Add Swagger support | ||
### :space_invader: Tech Stack | ||
|
||
## Reference | ||
<ul> | ||
<li><a href="https://nodejs.org/">Node</a></li> | ||
<li><a href="https://www.typescriptlang.org/">Typescript</a></li> | ||
<li><a href="https://ipfs.tech/">IPFS</a></li> | ||
<li><a href="https://www.hyperledger.org/use/fabric/">Hyperledger fabric</a></li> | ||
</ul> | ||
|
||
https://www.toptal.com/express-js/nodejs-typescript-rest-api-pt-1 | ||
### :dart: Features | ||
|
||
- Authenticates users with hyperledger blockchain | ||
- Stoores and retreives files from IPFS network | ||
- Submit operations into hyperledger blockchain | ||
|
||
## :toolbox: Setup | ||
|
||
### :bangbang: Prerequisites | ||
|
||
- **Node** This project uses node and npm as package manager, make sure it is installed. | ||
|
||
```bash | ||
node -v | ||
npm -v | ||
``` | ||
|
||
- **ipfs** This project uses IPFS to store files connect to an IPFS network or create your own by running the following command | ||
|
||
```bash | ||
jsipfs daemon | ||
``` | ||
|
||
### :key: Environment Variables | ||
|
||
To run this project, you will need to add the following environment variables to your .env file, here it is an example of a localhost configuiration | ||
|
||
```bash | ||
PORT=8081 | ||
|
||
ENV=localhost | ||
CCP_PATH=./org1.example.com/connection-org1.json | ||
WALLET_PATH=./wallet | ||
ADMIN_WALLET=admin | ||
ADMIN_WALLET_SECRET=adminpw | ||
CA_ORG_ID=ca.org1.example.com | ||
|
||
IPFS_API=http://127.0.0.1:5001/api/v0 | ||
``` | ||
|
||
## :gear: Usage | ||
|
||
Clone the project | ||
|
||
```bash | ||
git clone https://github.com/K-nto/Kinto-network-status-service.git | ||
``` | ||
|
||
Go to the project directory | ||
|
||
```bash | ||
cd Kinto-network-status-service | ||
``` | ||
|
||
Install dependencies. | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
Start the service. | ||
|
||
```bash | ||
npm run start | ||
``` | ||
|
||
## :warning: License | ||
|
||
Distributed under the no License. See LICENSE.txt for more information. | ||
|
||
<!-- Contact --> | ||
|
||
## :handshake: Contact | ||
|
||
Federico Javier Parodi - Fedejp - [Linkedin](https://www.linkedin.com/in/fedejp) - [Github](https://github.com/Fedejp) | ||
|
||
Carlos Santiago Yanzon - Bizk - [Linkedin](https://www.linkedin.com/in/carlos-santiago-yanzon/) - [Github](https://github.com/bizk) | ||
|
||
Project Link: [https://github.com/K-nto](https://github.com/K-nto) | ||
|
||
## :gem: Acknowledgements | ||
|
||
We thank and aknowledge the authors of these resources for their work. | ||
|
||
- [Awesome README](https://github.com/matiassingers/awesome-readme) | ||
- [Emoji Cheat Sheet](https://github.com/ikatyang/emoji-cheat-sheet/blob/master/README.md#travel--places) | ||
- [Readme Template](https://github.com/othneildrew/Best-README-Template) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {testUsers} from '../users/testUsers'; | ||
|
||
/** Returns true if the request is originated by a valid public/private key pair | ||
* Probably better in the HL Authenticator class | ||
*/ | ||
export const authorized = (userId: string, authToken: string = '') => { | ||
// @TODO: authorize for realsies | ||
// call HL authenticator here or sth | ||
return ( | ||
authToken && | ||
testUsers.find(user => user.address === userId) && | ||
userId == authToken | ||
); | ||
}; | ||
|
||
export const getUserInfo = (walletAddress: string) => { | ||
return testUsers.find(user => user.address === walletAddress); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface IEncryptedFile { | ||
name: string; | ||
type: string; | ||
address: string; | ||
fileData: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.