• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

flex-dapps/enzypt: A p2p, end to end encrypted file selling platform utilising E ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

flex-dapps/enzypt

开源软件地址:

https://github.com/flex-dapps/enzypt

开源编程语言:

JavaScript 100.0%

开源软件介绍:

Enzypt.io

Contents

Overview

This is the repository for the enzypt.io backend which is hosted at api.enzypt.io. The "official" gateway is hosted by Flex Dapps, however this code can be used to host your own payment verification gateway.

Crucially, regardless of whoever hosts the server, no server (running this code) can see what's in the files that are being sold through enzypt.

However, it should be noted that since the decryption key is passed around in the URL, it is possible for servers to retrieve this key in the event that you are hitting them (for example by navigating to a hosted frontend) instead of using just the API.

Enzypt was made because we thought it was a neat idea, but we don't guarantee anything, this software is provided as-is blah blah blah.

How Does it Work?

Enzypt.io hosts a frontend application, which is responsible for handling file zipping/encrypting/uploading. Once the files are uploaded, the enzypt backend API is responsible for verifying that a payment is correct. ipfs.enzypt.io is a publicly writable IPFS gateway (and we ask you to use it nicely).

In relatively broad strokes:

  • Payload is zipped and encrypted
  • Metadata is encrypted
  • Payload and metadata are uploaded to separate IPFS locations using ipfs.enzypt.io
  • Payload and metadata hashes are posted to the API
  • Unique payment link is returned to the seller
  • Seller shares the link with buyers
  • Buyer loads the metadata file from /:urlSlug
  • Buyer requests a random string to sign from /rand
  • Buyer posts a signed message to /msg
  • Buyer sends the transaction with the data equal to the return from /msg
  • Buyer sends the transaction hash to /buy
  • API returns the IPFS hash of the payload
  • Buyer downloads and decrypts the payload

Make an issue for any questions.

API Specification

All endpoints should be hit with a "Content-Type": "application/json" header.

POST /sell

Hit this when we have encrypted and uploaded both the zip file and the meta file to IPFS, and we're ready to entrust an enzypt gateway to release the IPFS hash when someone pays for it.

Params

{
    zipFileHash: String, // IPFS hash of the zip file
    metaFileHash: String // IPFS hash of the meta file
    // @todo add the meta file format
}

Returns

String // The unique url slug for the file

Buying a File

GET /:urlSlug

Get the metadata IPFS hash of a particular file for sale.

Returns

String // The IPFS hash of the metadata file

POST /rand

Get a random string to sign to prove that you own a public key.

Params

{
    publicKey: String // Public key that we're going to prove we own
}

Returns

String // Random 16 character alphanumeric string

POST /msg

Post a signed message to prove that we own a public key and that we want to purchase a particular file.

Params

{
    signedMessage: String,  // Message signature
    publicKey: String,      // Key which should be recovered from the signature
    urlSlug: String         // URL of the file which we're going to buy
}

Returns

String // Random 32 char hex string to add as data to payment transaction

POST /buy

Post a transaction hash to inform the server of a purchase and receive the IPFS file hash of that purchase.

Params

{
    txHash: String // Transaction hash of the payment transaction
}

Returns

String // IPFS hash of the purchased zip file

Development

To set up Enzypt locally, you will need a MongoDB instance that you can connect to. Clone this repo, then run:

yarn

You'll then need to create a file called .env, inside which you should put the following:

MONGODB_URL=mongodb://localhost/enzypt
MONGODB_TEST_URL=mongodb://localhost/enzypttest # <-- Used for running tests
NETWORK=rinkeby # <-- Can be any key that you add in the `config/index.js` file under ETH_NODE_RPC_URL
PORT=3001 # <-- The port you would like the API to run on

Then you can start the backend with:

yarn start

Configuration

The backend relies on INFURA as the web3 provider to verify purchases (transactions). To enable INFURA, you have to add your project ID to config/index.js. Alternatively, you can provide your own provider URL there.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap