--- tags: Design --- # Requesting Presentations ## Status Quo Presentations can be requested by Credential Defintion IDs (CredDefId). The Credential Definitions are hard coded in the frontend with a list for ILL and IDunion network. In addition it is possible to enter a CredDefId manually in "Expert mode". ``` templates: { iil: [ { credentialDefinitionId: "5mwQSWnRePrZ3oF67C4KqD:3:CL:1077:commercial register entry", label: "Commercial Registry Entry", issuer: "Commercial Registry", }, { credentialDefinitionId: "M6Mbe3qx7vB4wpZF4sBRjt:3:CL:571:Bank Account V2", label: "Bank Account", issuer: "Bank", }, ], idu: [ { credentialDefinitionId: "R6WR6n7CQVDjvvmwofHK6S:3:CL:109:Commercial Registry Entry", label: "Commercial Registry Entry", issuer: "Trust Service Provider", }, { credentialDefinitionId: "SCf4pK5PTvc1LnbUAF2aHD:3:CL:104:Bank Account V2", label: "Bank Account", issuer: "Bank", }, { credentialDefinitionId: "3QowxFtwciWceMFr7WbwnM:3:CL:104:Bank Account", label: "Bank Account", issuer: "CommerzBank", }, ], } ``` ## Drawbacks 1. If the wallet db of an issuer gets lost a new credential defintion has to be registered on the ledger. Hence, we would need to update the CredDefId in the code. 2. Users of a BPA can't easily add additional credential definitions 3. Users can't easiliy add credential definitions of a ledger other than IIL and IDunion. 4. It's not possible to ask for a presention of a specified schema without specifying the issuer. 5. It's not possible to ask for/accept a document. ## Features / Requirements / User Stories 1. As a BPA admin I want to use another ledger 2. As a BPA admin I want to configure specific credential definition ids 3. As a user I want to ask for a specific schema and define 1..n accepted issuers 4. As a user I want to ask for a specific schema and I accept self-attested data ("asking for a document") 5. As a BPA admin I want to configure specific presentation definitions that users can select 6. As a BPA user I want to create a custom presentation request 7. As a BPA user I want to create a custom presentation request and store it as a presentation definition ## Solution Concept **1. Configure credential definitions as part of schema configuration.** (Optional) Use ledger explorer to simplify selection of credential definitions in the UI. Each Schema can define 0...n credential definitions with a label. Open Question: How to handle Issuer names? Addresses: D1 by allowing to update the config, D2, D3 Implements US 1,2 **2. Request presentations based on schema and issuer** **(DECISION)** Would allow being independent of a particular credential definition Issuers Addresses: D1, D4 Implements US 3 **3. Disable Auto-respond presentation request and fullfill "document request" in BPA** Addresses: D5 Implements US 4 ## Presentation Request Examples ### Bank Account Credential Schema ID: M6Mbe3qx7vB4wpZF4sBRjt:2:bank_account:1.0 Attributes: iban, bic **THIS IS NOT TESTED!** Ask for the attributes from a schema. Issuer does not matter, but both attributes need to be from the same credential. ``` "name":"proof_req_1", "version":"0.1", "requested_attributes": { "attr1_referent": { "names":["iban", "bic"], "restrictions": [{ "schema_id": "M6Mbe3qx7vB4wpZF4sBRjt:2:bank_account:1.0" }] } } "requested_predicates": {} ``` Ask for the attributes from a schema and issuer1 OR issuer2. Both attributes need to be from the same credentials ``` "name":"proof_req_2", "version":"0.1", "requested_attributes": { "attr1_referent": { "names":["iban", "bic"], "restrictions": [{ "schema_id": "M6Mbe3qx7vB4wpZF4sBRjt:2:bank_account:1.0", "issuer_did": "issuer1" }, { "schema_id": "M6Mbe3qx7vB4wpZF4sBRjt:2:bank_account:1.0", "issuer_did": "issuer2" }] }] } "requested_predicates": {} ``` BPA API: ``` one of { request_by_schema: { schema_id: "", issuer_did: [] }, request_raw: {} } ``` Allow for self-attestation, but communicate intend with schema_id ``` "name":"proof_req_2", "version":"0.1", "requested_attributes": { "attr1_referent": { "name":"iban", "restrictions": [ { "schema_id": "M6Mbe3qx7vB4wpZF4sBRjt:2:bank_account:1.0" }, {}] }, "attr2_referent": { "name":"bic", "restrictions": [ { "schema_id": "M6Mbe3qx7vB4wpZF4sBRjt:2:bank_account:1.0" }, {}] } } "requested_predicates": {} ``` ## Sequence Diagram (US 4) ```plantuml @startuml "BPA Requester"->"ACA-PY Requester": /present-proof/send-request "ACA-PY Requester"->"ACA-PY Prover": DIDcomm: presentation request "ACA-PY Prover"->"BPA Prover": Webhook: Presentation Request opt Ask for permission "BPA Prover"->"BPA Prover": Should presentation request be fullfilled? end "BPA Prover"->"ACA-PY Prover": Look for VC of schema in wallet alt VC with schema NOT found "BPA Prover"->"BPA Prover": Look for Document of schema end "BPA Prover"->"ACA-PY Prover": /present-proof/records/{pres_ex_id}/send-presentation "ACA-PY Prover"->"ACA-PY Requester": DIDcomm: Presentation "ACA-PY Requester"->"ACA-PY Requester": Verify Presentation (automatically due to --auto-verify-presentation) "ACA-PY Requester"->"BPA Requester": "Webhook: Presentation Received & Verified" @enduml ``` If neither a VC nor a Document is found we could send a `problem-report` message (can be added later on)