bcgov / von-agent-template

Template for a von-x based agent
Apache License 2.0
6 stars 17 forks source link

Can't add multiple proofs in routes.yml #63

Closed CJHunter91 closed 4 years ago

CJHunter91 commented 4 years ago

Hi as stated in the documentation here:

"As the web form loads, any proof_request entries referenced in this file (routes.yml) and defined in services.yml are executed and must be successful for the form to load. If a proof_request is referenced and the proof request fails, the form does not load and an error message is displayed. A referenced proof_request could fail either because no identifier is passed to the form (so no proof request to OrgBook is possible), or if the identified organization does not have the required active credential. Any attribute in the form's credential that has the same name as a claim in a prerequisite proof request is pre-populated with the value of the proven claim."

I don't see a way of configuring multiple proof_request entries and all examples in other issuers don't reference the additional proof_requests defined in the services.yml.

Am I missing something?

ianco commented 4 years ago

I don't recall the details offhand but the greenlight demo has an example where one of the permits requires multiple pre-requisites, I think it's the liquor permit:

https://github.com/bcgov/greenlight/blob/master/config/liquor-control-agent/services.yml

You can try installing greenlight to see how it works.

CJHunter91 commented 4 years ago

I should have made myself clearer.

I am running the greenlight demo and I have analyzed the configuration for all the agents including the liquor-control-agent. Here is a breakdown of why this isn't an issue within that agent. Here is a list of the proof requests in the services.yml for the liquor agent.

`proof_requests: registration: version: '1.0.3' schemas:

Here is a single proof request in the routes.yml file for the same agent.

` proof_request: id: registration connection_id: bctob fields:

The proofs in the services file means there are pre-requisite VC's to obtain before a credential can be created by the liquor agent. However the data from other agents VC's is not being used in the liquor form. 'corp-num' is present from the registration VC and is the only attribute that's attempted to be pre-populated by other agents.

In my example: service.yml `proof_requests: greenlight_registration: version: '1.0.0' schemas:

routes.yml

` proof_request: id: greenlight_registration connection_id: bctob fields:

I would expect to have to specify another proof_request with id: work_safe. This would then reference the work_safe proof request from services.yml. The result would be a pre-populated coverage_description text box from the claim inside the work_safe VC at the point of executing my agents form.

ianco commented 4 years ago

Hi @CJHunter91 , I just took a quick review of the code (it's been awhile since I've looked at greenlight) and I think the demo's are not quite correct. To specify dependencies on multiple credentials you specify a single proof request with multiple schemas, not multiple proof requests. I did a quick example which you can see here:

https://github.com/ianco/von-agent-template/blob/proof_demo/von-x-agent/config/services.yml#L115

You can see that there are dependencies on both the registration and pst credentials, and the 3 attributes (corp_num, legal_name and pst_number) all pre-fill on the html page when you issue the credential.

Note that greenlight was built as a demo, so I expect you will run into other similar inconsistencies in the code.

Greenlight is built on a"pre-aries" agent framework (von-x) and is not currently being maintained. The updated OrgBook is called "Aries-VCR" and the updated issuer is "aries-vcr-issuer-controller", these repo's are available on github under bcgov. Let me know if you need links. (The updated issuer doesn't include the html page issuer nor integration with greenlight.)

Also let me know if you have any general questions about Indy/Aries.

CJHunter91 commented 4 years ago

Hi @ianco,

Thanks very much for you're example and explanation. I'll have a look at the other projects as suggested.