GithubHelp home page GithubHelp logo

isabella232 / trusted-document-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from catalystcode/trusted-document-api

0.0 0.0 0.0 610 KB

License: MIT License

JavaScript 95.84% CSS 0.74% HTML 2.81% Dockerfile 0.62%

trusted-document-api's Introduction

Trusted Document API

This is a proof of concept and is not suitable for production use without additional security and reliability considerations.

The purpose of Trusted Document API is to provide a simple way to manage sensitive documents (e.g wills) with the ability to provide an unmodifiable transaction history.

alt text

Blockchain

In order to have an unmodifiable history of the document we record all transactions to Ethereum blockchain. The document will be stored off-chain (on Azure Blob Storage), but we will keep the document's hash in the blockchain using module ethproof. This creates a permanent record of a document hash at a specific date and time, allowing us to prove when it was originally written and when modifications happaned. We require either private or public blockchain to be setup before using our applicaion and environment variables ETHEREUM_PRIVATE_KEY, WALLET_DESTINATION_ADDRESS and BLOCKCHAIN_RPC_HOST to be set. For test purposes you can use free public blockchain rinkeby.

Authentication

We use Azure Active Directory B2C for identity. Follow these steps to create and configure your Azure AD B2C Directory and set environment variable AAD_TENANT_ID, AAD_B2C_CLIENT_APPLICATION_ID, AAD_B2C_POLICY_NAME.

Storage

For storing revisions of the documents we use Azure Blob Storage. To create Azure Storage account, follow this tutorial, then set environment variable AZURE_STORAGE_CONNECTION_STRING. You can enable encryption for data at rest, following this tutorial. Revisions of the document are stored in one container per user.

Database

We use mongo to store permissions and transaction hash in blockchain. We require envioronment variable MONGODB_URI to be specified (except local deployment). You can use any database service, including Azure Cosmos DB.

Asynchronous jobs

In order to let user manage documents using our API without much waiting, we do Blockchain operations in cron jobs. Every minute (use can change interval by setting cronJobInterval in config/default.js) we find revisions of the documents in database that don't have transation hash and publish these transactions to the Blockchain. After transaction is recorded to Blockchain, we update database with block number and transation hash.

Deployment

Development and deployment of this application is completely dockerized. Just run docker-compose up (usually installed with docker) for local deployment. API and sample web app will be running on port 3000 (unless env variable PORT is set)

Required environment variables (described above): AZURE_STORAGE_CONNECTION_STRING, AAD_TENANT_ID, AAD_B2C_CLIENT_APPLICATION_ID, ETHEREUM_PRIVATE_KEY, WALLET_DESTINATION_ADDRESS

Sample web app that uses API

Source code for sample web app that uses API can be found in /public folder. It provides a simple UI to demostrate besic features of Trusted Document API: upload/update document and get transaction history for document. To be able to use these featues user has to be authenticated with AAD.

alt text

trusted-document-api's People

Contributors

ali92hm avatar anastasiia-zolochevska avatar stefangordon 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.