GoodDollar / GoodServer

Backend to support the GoodDAPP
MIT License
13 stars 14 forks source link

(Feature) [GoodID] location certificate #455

Closed johnsmith-gooddollar closed 8 months ago

johnsmith-gooddollar commented 9 months ago

Description

About #523

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

johnsmith-gooddollar commented 9 months ago

@sirpy here is a most simple veramo setup I was able to run: https://github.com/GoodDollar/veramo-nodejs-simple-setup/blob/master/src/veramo/setup.ts

  1. I used keyDIDprovider so we do not need infer project
  2. But Veramo needs to store some data, at least one DID and some private keys attached to it. This is needed to check certificates issues in future. Otherwise it will create new dids with new keys each server call and of course will fail to verify certificate issues previously.

By default they want to use TypeORM over relational database (mongo won't work with this setup). But they have an beta implementation of JSON storage could store all data required as simple JSON object snapshot. I created own implementation of this interface which will store snapshot to a single document of server_properties collection (like we store database version for migrations)

johnsmith-gooddollar commented 9 months ago

example of the data veramo will store in Mongo:

image

sirpy commented 9 months ago

@johnsmith-gooddollar no need to store credentials.

  1. credentials are signed, so if user shows a credential it is easy to check if it is valid.
  2. private keys should be used from our wallet. no need to store anything else.
sirpy commented 9 months ago

@johnsmith-gooddollar Also plugins are optional https://veramo.io/docs/api/core-types.iagentoptions

So we just need the minimal plugins, for keystore look at https://veramo.io/docs/api/key-manager.memoryprivatekeystore which has the import to import a private key

johnsmith-gooddollar commented 9 months ago

@sirpy Yep I found all 3 memory stores (for keys, private keys and dids). The only 2 questions left

johnsmith-gooddollar commented 9 months ago

@sirpy I finally was able to generate keys & did using admin wallet private keys as seed: https://github.com/GoodDollar/veramo-nodejs-simple-setup/blob/master/src/veramo/setup.ts#L27

now we have the same DID each run, everything kept in-memory. if you're ok with it - I could hook it up to this PR

johnsmith-gooddollar commented 9 months ago

@sirpy wired it up

johnsmith-gooddollar commented 8 months ago

Please undo all line length formatting. it is confusing. make sure you use the prettier settings defined

done