Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[verifiable-credential]: verify credential using an external context #170

Closed
cmcWebCode40 opened this issue Mar 17, 2022 · 8 comments · Fixed by #179
Closed

[verifiable-credential]: verify credential using an external context #170

cmcWebCode40 opened this issue Mar 17, 2022 · 8 comments · Fixed by #179
Assignees

Comments

@cmcWebCode40
Copy link
Contributor

Todo

Users should be able to verify a credential URI from the account explorer demo without having to login in by using an external context .

see @tahpot suggestion to fix this issue :

https://discord.com/channels/664594912460668960/929954765021011978/953902907974107176

cmcWebCode40 added a commit that referenced this issue Mar 18, 2022
- Add static to getResolver and verifyPresentation methods
- Modified share-credential test
#170
@cmcWebCode40
Copy link
Contributor Author

cmcWebCode40 commented Mar 18, 2022

@tahpot ,

I have been able to refactor the Credential class as suggested.

see commit 2442b6c

Here are questions I want to ask

  1. Is there a way we can call the Utils.fetchVeridaUri(data.veridaUri, context) and avoiding to pass the application context?
    because this Utils.fetchVeridaUri(data.veridaUri, context) still requires it.

see test case reference

const jwt = await Utils.fetchVeridaUri(config.EXISTING_CREDENTIAL_URI, context);

  1. Do we have wherein our documentation I can open a context.openExternalDatabase() without connecting to a vault?

cc @nick-verida

@tahpot
Copy link
Member

tahpot commented Mar 20, 2022

@cmcWebCode40

I have been able to refactor the Credential class as suggested. See commit 2442b6c

That looks good, I have added one comment regarding the unit tests.

Is there a way we can call the Utils.fetchVeridaUri(data.veridaUri, context) and avoiding to pass the application context?

I see what you mean. In reality, Utils.fetchVeridaUri() should be modified to pass in a client not a context, and then open an external context and external database (as below).

Can you create an issue for this?

Do we have wherein our documentation I can open a context.openExternalDatabase() without connecting to a vault?

There is some documentation here, however it doesn't mention how to open an external context. Here's an example of that:

Use const context = await client.openExternalContext() then use const db = await context.openExternalDatabase().

Can you add an issue in the documentation for us to improve this?

@cmcWebCode40
Copy link
Contributor Author

@tahpot, I have added the following tickets.

Can you add an issue in the documentation for us to improve this?
verida/archived-documentation#52

Can you create an issue for this?
#172

@cmcWebCode40
Copy link
Contributor Author

Screenshot 2022-03-21 at 07 10 06

@tahpot ,
all test now passed just on error .
i currently getting the above error for this test case here , trying to open external database using the client class with a different contextName

@nick-verida
Copy link
Contributor

@pranavburnwal it'd be worth you getting across this work. Michael is away for a couple more days but even if you could get it to the point you can replicate what he's seeing I think it might be helpful as preparation for taking some of this stuff off @tahpot .

@pranavburnwal
Copy link

pranavburnwal commented Mar 30, 2022

Leaving notes here after talking to @nick-verida. PS: I plan to add things like this in Dev Documentation.

Anatomy of shared credential URL.

Initial URL:

https://verida.network/credential?uri=dmVyaWRhOi8vZGlkOnZkYToweGY3MzkxN2E0MzA4OEUxRDA1ODM3RmZkNTAwMTUwNzIxZWI1QzMxMzIvOENObVI1TDlZZGZBWW1mM2tYL2NyZWRlbnRpYWxfcHVibGljX2VuY3J5cHRlZC84MTQ5MWEzMC1hODA0LTExZWMtYjg5OS1jM2QxZTU0NmQ4ZWY/a2V5PTRkMzI1MjJiMThhOTBhMjliYWY5NzFhYmE5YjQ0YmE3MTFkZDhiNGRlZGNkMGEwYjhkYWM3NTM1MTYzNDJlYmE=

Take out the Token and BASE64 decode

verida://did:vda:0xf73917a43088E1D05837Ffd500150721eb5C3132/8CNmR5L9YdfAYmf3kX/credential_public_encrypted/81491a30-a804-11ec-b899-c3d1e546d8ef?key=4d32522b18a90a29baf971aba9b44ba711dd8b4dedcd0a0b8dac753516342eba

verida://
did:vda:0xf73917a43088E1D05837Ffd500150721eb5C3132/ //Reciepient VDA
8CNmR5L9YdfAYmf3kX/ // Encrypted DB name
credential_public_encrypted/ //Table name
81491a30-a804-11ec-b899-c3d1e546d8ef //Document ID
?
key=4d32522b18a90a29baf971aba9b44ba711dd8b4dedcd0a0b8dac753516342eba
	//Key to decrypt

Also add ref: https://github.com/verida/documentation/blob/develop/docs/tutorial/verifiable_credentials.xxx

@pranavburnwal
Copy link

Screenshot 2022-03-21 at 07 10 06

@tahpot , all test now passed just on error . i currently getting the above error for this test case here , trying to open external database using the client class with a different contextName

After a call with @cmcWebCode40,He is using the context.openData and context.openExternalDatabase interchangeably.
As with my limited understanding I think local DB connection is already decrypted and available to load data from, whereas the externalDB that's not the case. I think we need the "openExternalDatabase" connection to be overloaded to pass ina particular document to be retrieved only. This goes along my previous message "anatomy" of URL. We will pass docuemtn ID which will return the encrypted doc which can be decrypted with the decryption key.

cc @tahpot @nick-verida

@cmcWebCode40
Copy link
Contributor Author

cmcWebCode40 commented Mar 30, 2022

@pranavburnwal,

I have been able to modify the utils function (fetchVeridaUri) by opening the external context using the contextName and did from the VC URI see my commit here eb1749393f
all tests now pass.

cc @tahpot @nick-verida

cmcWebCode40 added a commit that referenced this issue Apr 3, 2022
cmcWebCode40 added a commit that referenced this issue Apr 5, 2022
cmcWebCode40 added a commit that referenced this issue Apr 5, 2022
cmcWebCode40 added a commit that referenced this issue Apr 11, 2022
tahpot pushed a commit that referenced this issue Apr 12, 2022
* feat: refactored Credential Class
- Add static to getResolver and verifyPresentation methods
- Modified share-credential test
#170
* feat: updated all test case credential class methods
#170
* fix: modified parameter of fetchVeridaUri utils functions
#170
* fix:  updated branch #170 changes
#170
* fix: removed hard coded did reg. url and refactored util method fetchVeridaUri
#170
* fix: refactored did-resolver packages to use enviromnent
#170
* fix:moved getClientContext and connectAccount methods
to utils file
#170
* fix:moved getClientContext and connectAccount methods
to utils file
#170
* fix: moved methods in utils to utils file in vc folder
#170
* Don't expose utils
* fix: update utils file path
#170
* Fix did-resolver import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants