blockades / scuttle-dark-crystal

API for validating, building, publishing and reading Dark Crystal records
http://darkcrystal.pw
MIT License
42 stars 2 forks source link

dark-crystal-secrets HTTP API #45

Closed m4gpi closed 5 years ago

m4gpi commented 5 years ago

I've been corresponding with folk about making our code more interoperable and enabling our secret verification to be accessible by other applications. We could do with a HTTP API for /lib/secrets-wrapper. For the wrapper in its current form, we can open up the following end-points (and there are likely more we could add over time as we extend the functionality of Dark Crystal):

POST /v1/secret/share
POST /v1/secret/combine
POST /v1/shard/verify
POST /v2/secret/share
POST /v2/secret/verify
POST /v2/secret/combine
POST /v2/shard/verify

Here's an example of how one could use this API and what response we'd send back...

// /v1/secret/share

var params = {
  secret: "X marks the spot",
  quorum: 3,
  shards: 5
}

request('http://localhost:8187/v1/secret/share', params, (err, response) => {
  // returns a JSON response object with the shards as the response body
  console.log(response)
  // {
  //   code: 200,
  //   body: [
  //     '8014743d37c565db0dce12e4994ebfe444a',
  //     '8024cf89c0f40debaae0684c5dacf3e581c',
  //     '8030bbb4f7316830a73e7cc8c2124af1c21',
  //     '804b708b9e5172c52624f6ad67d9368d7e5',
  //     '805f04b6a994171e2bfae229f8678f993d8' 
  //   ]
  // 
})

In addition, we could open up verifying secrets (which currently does exist but is closed off within the v2 wrapper (its a local function).

This would be brilliant as it would expose our secrets wrapper to any and all other languages. It can then be deployed as a component of another application (we could package into a container), rather than us having to port into other languages.

m4gpi commented 5 years ago

Core components required to build this:

  1. Extract secrets-wrapper into a new package called dark-crystal-secrets
  2. Require that package into scuttle-dark-crystal
  3. Bump scuttle-dark-crystal version
  4. Create new repository called dark-crystal-secrets-api
  5. Write tests for the API end-points
  6. Create a HTTP server and open up the end-points
  7. Integrate with the relevant functions from dark-crystal-secrets and format JSON responses.
  8. Ensure effective error handling and clear responses
  9. Clear documentation on how and when to use the API

Nice to haves:

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 1000.0 DAI (1000.0 USD @ $1.0/DAI) attached to it as part of the Ethereum Foundation fund.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 3 weeks ago. Please review their action plans below:

1) devonwesley has applied to start work _(Funders only: approve worker | reject worker)_.

  1. Going to submit ./secret-wrapper as an npm package called dark-crystal-secrets
  2. Use the express framework for the API endpoints.
  3. Use 'express-validator' to validate and sanitize endpoint data.
  4. Write Test for endpoints using "supertest"
  5. Create endpoints using dark-crystal-secrets functions with the formatted JSON response.
  6. Use Swagger for the Docs.
  7. Potentially use a node js container from Docker hub.
  8. For the auth endpoints ill use SSL

Learn more on the Gitcoin Issue Details page.

2) hadasz has applied to start work _(Funders only: approve worker | reject worker)_.

The first things I will do to complete this are: -Check out current code -Make a plan for API -Write the API

(I am very familiar with shamirs secret sharing algorithm as I wrote a react-native library for it. https://github.com/ConsenSys/react-native-sssa

Learn more on the Gitcoin Issue Details page.

3) zyfrank has applied to start work _(Funders only: approve worker | reject worker)_.

really a great tool for web3, I'm familiar with some context of your product, want to take this

Learn more on the Gitcoin Issue Details page.

4) siteriaitaliana has applied to start work _(Funders only: approve worker | reject worker)_.

Learn more on the Gitcoin Issue Details page.

5) pierrickgt has applied to start work _(Funders only: approve worker | reject worker)_.

I can setup an express server and build an api to interact with the functions available in the lib.

Learn more on the Gitcoin Issue Details page.

6) kgibb8 has been approved to start work.

Learn more on the Gitcoin Issue Details page.

spm32 commented 5 years ago

Hey @KGibb8 you're good to go :)

m4gpi commented 5 years ago

Great @ceresstation, thanks! Work has begun!

https://github.com/blockades/dark-crystal-secrets https://github.com/blockades/dark-crystal-secrets-api

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

m4gpi commented 5 years ago

Work underway robo @gitcoinbot

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

m4gpi commented 5 years ago

Yes robo...

m4gpi commented 5 years ago

https://github.com/blockades/dark-crystal-secrets-api/

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

m4gpi commented 5 years ago

This issue is completed @gitcoinbot @ceresstation

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

@kgibb8 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 1000.0 DAI (1000.0 USD @ $1.0/DAI) has been submitted by:

  1. @kgibb8
  2. @kgibb8
  3. @kgibb8

@ceresstation please take a look at the submitted work:


gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 1000.0 DAI (1000.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @KGibb8.