---
tags: Design
---
# Proof templates
Proof templates allow to store and reference templates for proofs/presentation requests.
## Proposed flow for policy builder UI
* Give the proof template a name
* Specify if revocation should be checked
* Select schema
* Auto Complete/Dropdown from configured schemas
* Select trusted issuers OR set allow self-attested
* Auto Complete/Dropdown trusted issuers from trusted issuers configured in schemas
* Select requested attributes from schema
* Allow to optionally set a predicate for a given attribute. This is only allowed if self-attestation is not allowed
* Proceed with next schema until proof template is finished
This builder restricts the expressivness of indy requests in order to simplify the UI.
## Usage of proof templates
- Proof templates can be selected in presentation requests
- Proof templates can be referenced in the rules engine
## API
Proof templates need a CRUD API. At least internally there needs to be an API that transforms our custom data model to an indy proof request.
### Remarks for implementation
- If the predicate is `<`,`<=` ,`>` or `>=` this should be handled as indy `requested_predicates`. If the predicate is `=` this can be handled as a `attr::[attribute name]::value` restriction of the attribute (group).
- If self attestation is allowed, then we would need to remove the schema restriction from the attribute group.
### Data model Example
One possible data model would be the following. However, I think this might be adapted during implementation.
```
{
name: "Bank Account",
id: "Some BPA internal identifier"
check_revocation: true
content: [{
schema: 424524:sdfs:Sdf
attributes: ["iban", "bic"]
restriction: {
issuers: ["ewrqfqr412r"]
}
predicates: [
iban: {
type: ">=",
value: 1000
}
]}
}
```
Corresponding indy proof request:
```
...
name: "Bank Account",
requested_attributes: {
attr_group_1: {
names: ["bic"],
restrictions: [{
schema_id: 424524:sdfs:Sdf
}]
}
},
requested_predicates: {
predicate_1: {
name: "iban",
p_type: ">=",
p_value: 1000,
restrictions: [{schema_id: "424524:sdfs:Sdf"}]
},
},
"non_revoked": {
"to": <seconds from Unix Epoch> now or now - a bit
}
...
```
## Further Remarks
* I'd keep the "Send presentation" as is for now.
## Open Questions
* Do we need a restriction on a particular cred def?
* Do we need to add free-form self-attested attributes?
* Should we define a model that already fits to the DIF Presentation Definition?
* For self-attested attributes, how can we tell the prover which schema, i.e. document type, we mean?