---
# System prepended metadata

title: 'Governance: Rules and Workflows (draft)'

---

# Governance: Rules and Workflows (draft)

```json=
{
  "@context": ["https://github.com/hyperledger/aries-rfcs/blob/main/concepts/0430-machine-readable-governance-frameworks/context.jsonld"],
  "name": "Aruba COVID Governance",
  "version": "0.1",
  "format": "1.0",
  "id": "<uuid>",
  "description": "This document describes COVID health and travel governance for the nation of Aruba in a machine readable way.",
  "last_updated": "2021-06-10",
  "docs_uri": "need_to_create",
  "data_uri": "need_to_create",
  "topics": [
    "medical, travel"
  ],
  "jurisdictions": [
    "US>NY>New York City",
    "AW"
  ],
  "geos": [
    "USA",
    "Aruba"
  ],
  "schemas": [
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:Email:1.0",
      "name": "Validated Email",
      "verification": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy"
    },
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:SMS:1.0",
      "name": "SMS",
      "verification": "hl:2lksjfdskljdf4432234lsakfHDHd"
    },
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:Medical_Release:1.0",
      "name": "Medical Release",
      "verification": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy"
    },
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:Lab_Order:1.0",
      "name": "Lab Order",
      "verification": "hl:zm9YZpCjPLPJ4Epc:z3TSgaEFFHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPUJFDD"
    },
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:Lab_Result:1.0",
      "name": "Lab Result",
      "verification": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQOPPS"
    },
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:Vaccine:1.0",
      "name": "Vaccine",
      "verification": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQJKDe"
    },
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:Vaccine_Exemption:1.0",
      "name": "Vaccine Exemption",
      "verification": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQMJQd"
    },
    {
      "id": "4CLG5pU5v294VdkMWxSByu:2:Trusted_Traveler:1.0",
      "name": "Trusted Traveler",
      "issuance": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy",
      // Hashlink to presentation definition for prerequisite
      "verification": [
        {
          "travel_verifier": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy"
          // Hashlink to presentation definition for verification
        },
        {
          "hospitality_verifier": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy"
        }
      ]
    }
  ],
  "participants": [
    {
      "name": "Aruba Government",
      "id": "did:example:aruba",
      "describe": {
        "label": "Aruba",
        "sublabel": "Aruba Government",
        "website": "issuinggovernmentsite.org",
        "email": "credential_manager@issuinggovernmentsite.org"
      }
    },
    {
      "name": "General Horacio Oduber Hospital of Aruba",
      "id": "did:example:hospital",
      "describe": {
        "label": "Horacio Oduber Hospital",
        "sublabel": "General Horacio Oduber Hospital of Aruba",
        "website": "issuinglabsite.com",
        "email": "credential_manager@issuinglabsite.com"
      }
    },
    {
      "name": "Hilton Casino",
      "id": "did:example:casino",
      "describe": {
        "label": "Hilton Resort and Casino",
        "sublabel": "Verifying Org",
        "website": "verifyingorgsite.com",
        "email": "verifying_manager@verifyingorgsite.com"
      }
    }
  ],
  "roles": [ 
      "holder",
      "health_issuer",
      "travel_issuer",
      "health_verifier",
      "travel_verifier",
      "hospitality_verifier"
  ],
  "permissions": [ // Roles mapped to participants
    {
      "grant": ["health_issuer"],
      "when": {
        "any": [
          {"id": "did:example:hospital"},
          {"id": "did:example:lab"}
        ]
      }
    },
    {
      "grant": ["travel_issuer"],
      "when": {
        "any": [
          {"id": "did:example:aruba"} // Aruba Ministry of Health
        ]
      }
    },
    {
      "grant": ["health_verifier"],
      "when": {
        "any": [
          {"id": "did:example:aruba"} // Aruba Ministry of Health
        ]
      }
    },
    {
      "grant": ["travel_verifier"],
      "when": {
        "any": [
          {"id": "did:example:airport"} // Aruba Ministry of Health
        ]
      }
    },
    {
      "grant": ["hospitality_verifier"],
      "when": {
        "any": [
          {"id": "did:example:casino"}
        ]
      }
    }
  ],
  "actions": [
  // Actions are a name associated with a protocol (and sometimes a schema)
    {
      "name": "connect",
      "type": "connection",
    },
    {
      "name": "issue_lab_order",
      "type": "issue-credential",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Lab_Order:1.0"
    },
    {
      "name": "issue_lab_result",
      "type": "issue-credential",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Lab_Result:1.0"
    },
    {
      "name": "issue_vaccine",
      "type": "issue-credential",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Vaccine:1.0"
    },
    {
      "name": "issue_exemption"
      "type": "issue-credential",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Vaccine_Exemption:1.0"
    },
    {
      "name": "issue_trusted_traveler"
      "type": "issue-credential",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Trusted_Traveler:1.0"
    },
    {
      "name": "verify_identity",
      "type": "present-proof"
    },
    {
      "name": "verify_lab_order",
      "type": "present-proof",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Lab_Order:1.0"
    },
    {
      "name": "verify_lab_result",
      "type": "present-proof",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Lab_Result:1.0"
    },
    {
      "name": "verify_vaccine",
      "type": "present-proof",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Vaccine:1.0"
    },
    {
      "name": "verify_exemption"
      "type": "present-proof",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Vaccine_Exemption:1.0"
    },
    {
      "name": "verify_trusted_traveler"
      "type": "present-proof",
      "schema": "4CLG5pU5v294VdkMWxSByu:2:Trusted_Traveler:1.0"
    }
  ],
  "privileges": [ // Actions mapped to roles
    {
      "grant": ["issue_lab_order"],
      "when": {
        "any": [
          {"role":"health_issuer"}
        ]
      }
    },
    {
      "grant": ["issue_lab_result"],
      "when": {
        "any": [
          {"role": "health_issuer"}
        ]
      }
    },
    {
      "grant": ["issue_vaccine"],
      "when": {
        "any": [
          {"role": "health_issuer"}
        ]
      }
    },
    {
      "grant": ["issue_vaccine_exemption"],
      "when": {
        "any": [
          {"role":"health_issuer"},
          {"role":"holder"}
        ]
      }
    },
    {
      "grant": ["issue_trusted_traveler"],
      "when": {
        "any": [
          {"role":"travel_issuer"},
        ]
      }
    },
    {
      "grant": ["verify_identity"],
      "when": {
        "any": [
          {"role":"health_issuer"},
          {"role":"travel_issuer"},
          {"role":"health_verifier"},
          {"role":"travel_verifier"},
          {"role":"hospitality_verifier"}
        ]
      }
    },
    {
      "grant": ["verify_lab_order"],
      "when": {
        "any": [
          {"role":"health_verifier"},
        ]
      }
    },
    {
      "grant": ["verify_lab_result"],
      "when": {
        "any": [
          {"role":"health_verifier"},
        ]
      }
    },
    {
      "grant": ["verify_vaccine"],
      "when": {
        "any": [
          {"role":"health_verifier"},
        ]
      }
    },
    {
      "grant": ["verify_vaccine_exemption"],
      "when": {
        "any": [
          {"role":"health_verifier"},
        ]
      }
    },
    {
      "grant": ["verify_trusted_traveler"],
      "when": {
        "any": [
          {"role":"travel_verifier"},
          {"role":"hospitality_verifier"}
        ]
      }
    }
  ],
  "flows": {
  // Most likely a stand-alone document referred to
  // using a hash link, but included here while we're brainstorming 
    "connect-to-health-issuer": {
      "role": "holder",
      "initial": true,
      "actions": [
        {
          "name":"connect",
          "target":"health_issuer"
        }
      ],
      "next": [
        "success": [
          {
            "name":"health-verify-identity", // Happy path
          },
        ]
      ]
    }
    "health-verify-identity": {
      "role": "health_issuer",
      "initial": true,
      "conditions": [
        {
          "type":"connection",
          "target":"holder"
        }
      ],
      "actions": [
        {
          "name":"verify_identity",
        },
      ],
      "next": [
        "success": [
          {
            "name":"health-issue-credential", // Happy path
          },
        ]
      ]
    },
    "health-issue-credential": {
      "role": "health_issuer",
      "actions": [
        "or": [
          {
            "and": [
              { "name":"issue_lab_order" },
              { "name":"issue_lab_result" }
            ]
          }
          { "name":"issue_vaccine" },
          { "name":"issue_vaccine_exemption" },
        ]
      ],
      "next": [
        "success": [
          {
            "name":"connect-to-travel-issuer" // Happy path
          },
        ]
      ]
    },
    "connect-to-travel-issuer": {
      "role": "holder",
      "actions": [
        {
          "name":"connect",
          "target":"travel_issuer"
        }
      ],
      "next": [
        "success": [
          {
            "name":"travel-verify-holder" // Happy path
          }
        ]
      ]             
    },
    "travel-verify-holder": {
      "role": "travel_issuer",
      "actions": [
        {
          "name": "verify_identity",
        },
      ],
      "next": [
        "success": [
          {
            "name":"travel-issue-credential", // Happy path
          },
        ]
      ]
    },
    "travel-issue-credential": {
      "role": "travel_issuer",
      "actions": [
        {
          "name": "issue_trusted_traveler"
        }
      ],
    },
  }
    
    // -------------------------------------
    // Old Flow Below
    // -------------------------------------
    "connect-to-issuer": { // DONE
      "role": "holder",
      "initial": "true", // Initial for the holder?
      "actions": [
        "initiate_connection",
        {
          "present_id_proof": {
            "content": [
              "passport",
              "demographics"
            ]
          }
        }
      ],
      "next": [
        {
          "issuer-validate-proof": { // Happy path
            "when": [
              "connection_success"
            ]             
          }
        },
        {
          "reject-connection": { // Unhappy path
            "when": "connection_error"           
          }
        }
      ]
    },
    
    // Changed flow starts here
    "issuer-validate-proof": { // DONE. Needs to be renamed
    // Do we want to have single elements part of the array for the roles? Makes sense if we ever going to expand functionality.
      "role": ["health_issuer"],
      "initial": "true", // Innitial for the issuer?
      "actions": [
        "identify_holder"
      ],
        "next": [
        {
          "issue-lab-order": {
            "when": [
              [
                "issuer_to_holder_connection", // Do we want to check that and how do we pass that?
                {"request":"get_lab_order"}
              ]
            ]
          }
        },
        {
          "issue-lab-result": {
            "when": [
              [
                "issuer_to_holder_connection", // Do we want to check that and how do we pass that?
                "lab_order_credential",
                {"request": "get_lab_result"}
              ]
            ]
          }
        },
        {
          "issue-exemption": {
            "when": [
              [
                "issuer_to_holder_connection", // Do we want to check that and how do we pass that?
                "exemption_proof", // doctor's form, waiver application (religious (membership proof), philosophical). How and when do we validate exemption proof? Also consider a manual flow.
                {"request":"get_exemption"}
              ]
            ]
          }
        },
        {
          "issue-vaccine": {
            "when": [
              [
                "issuer_to_holder_connection", // Do we want to check that and how do we pass that?
                "lab_order_credential",
                {"request":"get_vaccine"}
              ]
            ]
          }
        },
        {
          "reject-health-credential": { // Unhappy path the naming is confusing?...(
            "when": "proof_error"          
          }
        },
        {
          "contact-support": {
            "when": "unspecified_error"
          }
        }
      ]
    },
    "verifier-validate-proof": { // DONE. Needs to be renamed
      "role": ["health_verifier", "travel_verifier"], // would that be health and travel verifier? What is the difference between them? Isn't it should be just travel verifier?
      "initial": "true", // Is it initial for verifier?
      "actions": [
        "identify_holder"
      ],
      "next": [      
        {
          "issue_trusted_traveler": {
            "when": [
              [
                "proof_success", // Do we really need a "success" flag? What will determine success?
                "vaccine_credential" // Full vacination. Do we handle single single vaccine dose credential?
              ],
              [
                "proof_success",
                "test_result_credential"
              ],
              [
                "proof_success",
                "exemption_credential",
                "test_result_credential"
              ]
            ]
          }
        },
        {
          "reject-health-credential": { // Unhappy path the naming is confusing...(
            "when": "proof_error"          
          }
        },
        {
          "contact-support": {
            "when": "unspecified_error"
          }
        }
      ]
    },
    
    // Changed flow ends here
    
    
    
    "issue-lab-order": { // DONE
      "role": "health_issuer",
      "actions": {
          "issue_lab_order": {
              "content": [
                { "credential": "test_id_credential" },
                { "recipient": "holder" }
              ]
          }
      },      
      "next": [
        {
          "issue-test-result": { // Happy path for PCR
            "when": [
                {"test_type": "PCR"},
                "test_id_success"
            ]              
          }
        },
        {
          "issue-vaccine": { // Happy path for vaccine
            "when": [
                {"test_type": "vaccine"},
                "vaccine_success"
            ]              
          }
        },
        {
          "reject-lab-order": { // Unhappy path
            "when": "lab_order_error" 
          }
        },
        {
          "contact-support": { // Unhappy path
            "when": "unspecified_error"
          }
        }
      ]
    },
    "issue-lab-result": { // DONE
      "role": "health_issuer",
      "actions": {
          "issue_lab_result": {
              "content": [
                  {
                      "credential": "lab_result_credential"
                  }
              ]
          }
      },
      "next": [
        {
          "connect-to-verifier": { // Happy path
            "when": [
                "lab_result_success"
            ]              
          }
        },
        {
          "reject-lab-result": { // Unhappy path
            "when": "lab_result_error"            
          }
        }
      ]
    },
    "issue-exemption": { // DONE
      "role": ["issuer", "holder"],
      "actions": {
          "issue_exemption": {
              "content": [
                { "credential": "exemption_credential" }
              ]
          }
      },
      "next": [
        {
          "connect-to-verifier": { // Happy path
            "when": [
                "exemption_success",
                "lab_order_credential"
            ]              
          }
        },
        {
          "issue-lab-order": { // Happy path. One more step. Get a PCR test to complete medical stack. Do we want to include some sort of message?
            "when": [
                "exemption_credential"
            ],
            "actions": [
                {
                  "name": "Get PCR Test",
                  "type": "message",
                  "content": "One more step. Get a PCR test to complete medical stack. Once you have your lab result you will be eligible to apply for a trusted traveler credential."
                }
            ]
          }
        },
        {
          "reject-exemption": { // Unhappy path
            "when": "exemption_error"
          }
        }
      ]
    },
    "issue-vaccine": { // DONE
      "role": "health_issuer",
      "actions": {
          "issue_vaccine": {
              "content": [
                { "credential": "vaccine_credential" },
              ]
          }
      },
      "next": [
        {
          "connect-to-verifier": { // Happy path
            "when": [
                "lab_result_success"
            ]              
          }
        },
        {
          "reject-vaccine": { // Unhappy path
            "when": "vaccine_error"            
          }
        }
      ]
    },
    "connect-to-verifier": { // DONE
      "role": "holder",
      "initial": "true",
      "actions": [
          "connect",
          {
            "present_id_proof": {
                "content": [
                  "passport",
                  "demographics"
                ]
            }
          }
      ],
      "next": [
        {
          "verifier-validate-proof": { // Happy path
            "when": [
                "connection_success"
            ]              
          }
        },
        {
          "reject-connection": { // Unhappy path
            "when": "connection_error"              
          }
        }
      ]
    },
    "issue-trusted-traveler": {
      "role": "travel_issuer",
      "actions": [
        {
          "name": "issue_trusted_traveler",
          "type": "credential",
          "content": "trusted_traveler_credential"
        }
      ]
    },
    // Unhappy path messages (sent as problem reports)
    "reject-trusted-traveler": { // DONE
      "role": "travel_issuer",
      "actions": [
        {
          "name": "reject_trusted_traveler",
          "type": "problem_report",
          "content": "Sorry, your trusted traveler credential request was rejected"
        }
      ],
      "next": "next-step" // I don't know where to go next
    },
    "reject-connection": { // DONE
      "role": ["health_issuer", "health_verifier", "travel_verifier", "hospitality_verifier"],
      "actions": [
        {
          "name": "reject_connection",
          "type": "problem_report",
          "content": "Sorry, connection with the $destination_name can't be established"
        }
      ],
      "next": "connect-to-issuer" // Try to connect again
    },
    "reject-health-credential": { // DONE
      "role": ["health_issuer", "health_verifier", "travel_verifier", "hospitality_verifier"],
      "actions": [
        {
          "name": "reject_health_credential",
          "type": "problem_report",
          "content": "Sorry, identification proof verification failed, try again"
        }
      ],
      "next": "issuer-validate-proof" // Try to get proof validated again
    },
    "reject-lab-order": { // DONE 
      "role": ["health_issuer"],
      "actions": [
        {
          "name": "reject_lab_oder",
          "type": "problem_report",
          "content": "Sorry, lab result failed to issue, contact your health issuer"
        }
      ]
    },
    "reject-lab-result": { // DONE
      "role": ["health_issuer"],
      "actions": [
        {
          "name": "reject_lab_result",
          "type": "problem_report",
          "content": "Sorry, lab result failed to issue, contact your health issuer"
        }
      ]
    },
    "reject-exemption": { // DONE
      "role": ["health_issuer"],
      "actions": [
        {
          "name": "reject_exemption",
          "type": "problem_report",
          "content": "Sorry, exemption failed to issue, try again"
        }
      ],
      "next": "issue-exemption" // Try again
    },
    "reject-vaccine": { // DONE
      "role": ["health_issuer"],
      "actions": [
        {
          "name": "reject_vaccine",
          "type": "problem_report",
          "content": "Sorry, vaccine credential issuance failed, try again"
        }
      ],
      "next": "issue-vaccine" // Try again
    },
    "contact-support": { // DONE
      "role": ["health_issuer"],
      "actions": [
        {
          "name": "contact_support",
          "type": "problem_report",
          "content": "Sorry, fatal error occured. Please, contact technical suport at support@indicio.tech"
        }
      ]
    }
  }
}
```

// List of possible errors to handle:
       /////////////////////////////////////////////////////////////// "lab_result_out_of_date"
      /////////////////////////////////////////////////////////////// "lab_order_out_of_date" 

# Beutified code (outdated)
```
{
  "@context": [
    "https://github.com/hyperledger/aries-rfcs/blob/main/concepts/0430-machine-readable-governance-frameworks/context.jsonld"
  ],
  "name": "Aruba COVID Governance",
  "version": "0.1",
  "format": "1.0",
  "id": "<uuid>",
  "description": "This document describes COVID health and travel governance for the nation of Aruba in a machine readable way.",
  "last_updated": "2021-06-10",
  "docs_uri": "need_to_create",
  "data_uri": "need_to_create",
  "topics": [
    "medical"
  ],
  "jurisdictions": [
    "US>NY>New York City",
    "AW"
  ],
  "geos": [
    "USA",
    "Aruba"
  ],
  "schemas": [
    {
      "4CLG5pU5v294VdkMWxSByu:2:Email:1.0": {
        "name": "Validated Email",
        "issuance": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy",
        "verification": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy"
      }
    },
    "4CLG5pU5v294VdkMWxSByu:2:SMS:1.0",
    "4CLG5pU5v294VdkMWxSByu:2:Medical_Release:1.0",
    "4CLG5pU5v294VdkMWxSByu:2:Lab_Order:1.0",
    "4CLG5pU5v294VdkMWxSByu:2:Lab_Result:1.0",
    "4CLG5pU5v294VdkMWxSByu:2:Vaccine:1.0",
    "4CLG5pU5v294VdkMWxSByu:2:Vaccine_Exemption:1.0",
    {
      "4CLG5pU5v294VdkMWxSByu:2:Trusted_Traveler:1.0": {
        "name": "Trusted Traveler",
        "issuance": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy",
        "verification": [
          {
            "travel_verifier": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy"
          },
          {
            "hospitality_verifier": "hl:zm9YZpCjPLPJ4Epc:z3TSgXTuaHxY2tsArhUreJ4ixgw9NW7DYuQ9QTPQyLHy"
          }
        ]
      }
    }
  ],
  "participants": [
    {
      "name": "Aruba Government",
      "id": "did:example:aruba",
      "describe": {
        "label": "Aruba",
        "sublabel": "Aruba Government",
        "website": "issuinggovernmentsite.org",
        "email": "credential_manager@issuinggovernmentsite.org"
      }
    },
    {
      "name": "General Obeorthot Hospital of Aruba",
      "id": "did:example:hospital",
      "describe": {
        "label": "Obeorthot Hospital",
        "sublabel": "General Obeorthot Hospital of Aruba",
        "website": "issuinglabsite.com",
        "email": "credential_manager@issuinglabsite.com"
      }
    },
    {
      "name": "Hilton Casino",
      "id": "did:example:casino",
      "describe": {
        "label": "Hilton Resort and Casino",
        "sublabel": "Verifying Org",
        "website": "verifyingorgsite.com",
        "email": "verifying_manager@verifyingorgsite.com"
      }
    }
  ],
  "roles": [
    {
      "health_issuer": {
        "label": "Health Issuer",
        "description": "Issues health credentials"
      }
    },
    {
      "travel_issuer": {
        "label": "Travel Issuer",
        "description": "Issues credentials for travel, e.g. the Happy Travel Pass"
      }
    },
    {
      "health_verifier": {
        "label": "Health Verifier",
        "description": "Verifies the presentation and validity of health credentials"
      }
    },
    {
      "travel_verifier": {
        "label": "Travel Verifier",
        "description": "Verifies the presentation and validity of travel credentials"
      }
    },
    {
      "hospitality_verifier": {
        "label": "Hospitality Verifier",
        "description": "Verifies the presentation and validity of a limited set of information from travel credentials"
      }
    },
    {
      "holder": {
        "label": "App Holder",
        "description": "Initiates connections with issuers and verifiers to present proof with desire to receive credentials"
      }
    }
  ],
  "permissions": [
    {
      "grant": [
        "health_verifier",
        "travel_issuer",
        "travel_verifier"
      ],
      "when": {
        "id": "did:example:aruba"
      }
    },
    {
      "grant": [
        "health_issuer"
      ],
      "when": {
        "id": "did:example:hospital"
      }
    },
    {
      "grant": [
        "hospitality_verifier"
      ],
      "when": {
        "id": "did:example:casino"
      }
    }
  ],
  "actions": [
    {
      "initiate_connection": {
        "label": "Initiate Connection",
        "type": "connection"
      }
    },
    {
      "request_proof": {
        "label": "Request Proof",
        "type": "presentation"
      }
    },
    {
      "present_id_proof": {
        "label": "Present Proof",
        "type": "presentation"
      }
    },
    {
      "identify_holder": {
        "label": "Verify Holder ID Proof",
        "type": "proof"
      }
    },
    {
      "issue_lab_order": {
        "label": "Issue Lab Order",
        "type": "credential",
        "schema": "4CLG5pU5v294VdkMWxSByu:2:Lab_Order:1.0"
      }
    },
    {
      "issue_lab_result": {
        "label": "Issue Test Result",
        "type": "credential",
        "schema": "4CLG5pU5v294VdkMWxSByu:2:Lab_Result:1.0"
      }
    },
    {
      "issue_vaccine": {
        "label": "Issue vaccine",
        "type": "credential",
        "schema": "4CLG5pU5v294VdkMWxSByu:2:Vaccine:1.0"
      }
    },
    {
      "issue_exemption": {
        "label": "Issue vaccine exemption",
        "type": "credential",
        "schema": "4CLG5pU5v294VdkMWxSByu:2:Vaccine_Exemption:1.0"
      }
    },
    {
      "verify_trusted_traveler": {
        "label": "Verify Trusted Traveler",
        "type": "verification",
        "schema": "4CLG5pU5v294VdkMWxSByu:2:Trusted_Traveler:1.0"
      }
    }
  ],
  "privileges": [
    {
      "grant": "verify_id",
      "when": {
        "roles": [
          "health_issuer",
          "travel_issuer",
          "health_verifier",
          "travel_verifier",
          "hospitality_verifier"
        ]
      }
    },
    {
      "grant": "issue_lab_order",
      "when": {
        "roles": [
          "health_issuer"
        ]
      }
    },
    {
      "grant": "issue_test_result",
      "when": {
        "roles": [
          "health_issuer"
        ]
      }
    },
    {
      "grant": "issue_vaccine",
      "when": {
        "roles": [
          "health_issuer"
        ]
      }
    },
    {
      "grant": "issue_exemption",
      "when": {
        "roles": [
          "health-issuer",
          "holder"
        ]
      }
    },
    {
      "grant": "verify_trusted_traveler",
      "when": {
        "roles": [
          "travel_verifier",
          "hospitality_verifier"
        ]
      }
    }
  ],
  "flows": {
    "connect-to-issuer": {
      "role": "holder",
      "initial": "true",
      "actions": [
        "initiate_connection",
        {
          "present_id_proof": {
            "content": [
              "passport",
              "demographics"
            ]
          }
        }
      ],
      "next": [
        {
          "validate-proof": {
            "when": [
              "connection_success"
            ]
          }
        },
        {
          "reject-connection": {
            "when": "connection_error"
          }
        }
      ]
    },
    "validate-proof": {
      "role": [
        "health_issuer",
        "health_verifier",
        "travel_verifier"
      ],
      "initial": "true",
      "actions": [
        "identify_holder"
      ],
      "next": [
        {
          "issue-health-credential": {
            "when": [
              "proof_success",
              "issuer_to_holder_connection"
            ]
          }
        },
        {
          "issue-trusted-traveler": {
            "when": [
              "proof_success",
              "verifer_to_holder_connection"
            ]
          }
        },
        {
          "reject-health-credential": {
            "when": "proof_error"
          }
        }
      ]
    },
    "issue-health-credential": {
      "role": [
        "health_issuer",
        "health_verifier"
      ],
      "actions": [],
      "next": [
        {
          "lab-order": {
            "when": [
              [
                "issuer_to_holder_connection",
                {
                  "request": "get_lab_order"
                }
              ]
            ]
          }
        },
        {
          "lab-result": {
            "when": [
              [
                "issuer_to_holder_connection",
                "test_id_credential",
                {
                  "request": "get_lab_result"
                }
              ]
            ]
          }
        },
        {
          "exemption": {
            "when": [
              [
                "issuer_to_holder_connection",
                "exemption_proof",
                {
                  "request": "get_exemption"
                }
              ]
            ]
          }
        },
        {
          "vaccine": {
            "when": [
              [
                "issuer_to_holder_connection",
                "test_id_credential",
                {
                  "request": "get_vaccine"
                }
              ]
            ]
          }
        },
        {
          "issue_trusted_traveler": {
            "when": [
              [
                "success",
                "vaccine_credential"
              ],
              [
                "test_result_credential"
              ],
              [
                "exemption_credential",
                "test_result_credential"
              ]
            ]
          }
        },
        {
          "contact-support": {
            "when": "unspecified_error"
          }
        }
      ]
    },
    "lab-order": {
      "role": "health_issuer",
      "actions": {
        "issue_lab_order": {
          "content": [
            {
              "credential": "test_id_credential"
            },
            {
              "recipient": "holder"
            }
          ]
        }
      },
      "next": [
        {
          "test-result": {
            "when": [
              {
                "test_type": "PCR"
              },
              "test_id_success"
            ]
          }
        },
        {
          "connect-to-issuer": {
            "when": [
              {
                "test_type": "vaccine"
              },
              {
                "vaccine_type": [
                  "Moderna",
                  "Pfizer"
                ]
              },
              {
                "count": "1"
              },
              "test_id_success"
            ]
          }
        },
        {
          "vaccine": {
            "when": [
              {
                "test_type": "vaccine"
              },
              {
                "option": [
                  {
                    "type": "Moderna",
                    "doze_count": "2"
                  },
                  {
                    "type": "Pfizer",
                    "doze_count": "2"
                  },
                  {
                    "type": "Johnson and Johnson",
                    "doze_count": "1"
                  }
                ]
              },
              "test_id_success"
            ]
          }
        },
        {
          "reject-test-id": {
            "when": "test_id_error"
          }
        },
        {
          "contact-support": {
            "when": "unspecified_error"
          }
        }
      ]
    },
    "lab-result": {
      "role": "health_issuer",
      "actions": {
        "issue_lab_result": {
          "content": [
            {
              "credential": "test_result_credential"
            },
            {
              "recipient": "holder"
            }
          ]
        }
      },
      "next": [
        {
          "connect-to-verifier": {
            "when": [
              "lab_result_success"
            ]
          }
        },
        {
          "reject-lab-result": {
            "when": "lab_result_error"
          }
        }
      ]
    },
    "exemption": {
      "role": [
        "issuer",
        "holder"
      ],
      "actions": {
        "issue_exemption": {
          "content": [
            {
              "credential": "exemption_credential"
            },
            {
              "recipient": "holder"
            }
          ]
        }
      },
      "next": [
        {
          "connect-to-verifier": {
            "when": [
              "exemption_success",
              "test_result_credential"
            ]
          }
        },
        {
          "lab-order": {
            "when": [
              "exemption_credential"
            ],
            "actions": [
              {
                "name": "Get PCR Test",
                "type": "message",
                "content": "One more step. Get a PCR test to complete medical stack. Once you have your lab result you will be eligible to apply for a trusted traveler credential."
              }
            ]
          }
        },
        {
          "reject-exemption": {
            "when": "exemption_error"
          }
        }
      ]
    },
    "vaccine": {
      "role": "health_issuer",
      "actions": {
        "issue_vaccine": {
          "content": [
            {
              "credential": "vaccine_credential"
            },
            {
              "recipient": "holder"
            }
          ]
        }
      },
      "next": [
        {
          "connect-to-verifier": {
            "when": [
              "lab_result_success"
            ]
          }
        },
        {
          "reject-vaccine": {
            "when": "vaccine_error"
          }
        }
      ]
    },
    "connect-to-verifier": {
      "role": "holder",
      "initial": "true",
      "actions": [
        "initiate_connection",
        {
          "present_id_proof": {
            "content": [
              "passport",
              "demographics"
            ]
          }
        }
      ],
      "next": [
        {
          "validate-proof": {
            "when": [
              "connection_success"
            ]
          }
        },
        {
          "reject-connection": {
            "when": "connection_error"
          }
        }
      ]
    },
    "issue-trusted-traveler": {
      "role": "travel_issuer",
      "actions": [
        {
          "name": "issue_trusted_traveler",
          "type": "credential",
          "content": "trusted_traveler_credential"
        }
      ]
    },
    "reject-trusted-traveler": {
      "role": "travel_issuer",
      "actions": [
        {
          "name": "reject_trusted_traveler",
          "type": "message",
          "content": "Sorry, your trusted traveler credential request was rejected"
        }
      ],
      "next": "next-step"
    },
    "reject-connection": {
      "role": [
        "health_issuer",
        "health_verifier",
        "travel_verifier",
        "hospitality_verifier"
      ],
      "actions": [
        {
          "name": "reject_connection",
          "type": "message",
          "content": "Sorry, connection with the $destination_name can't be established"
        }
      ],
      "next": "connect-to-issuer"
    },
    "reject-health-credential": {
      "role": [
        "health_issuer",
        "health_verifier",
        "travel_verifier",
        "hospitality_verifier"
      ],
      "actions": [
        {
          "name": "reject_health_credential",
          "type": "message",
          "content": "Sorry, identification proof verification failed, try again"
        }
      ],
      "next": "validate-proof"
    },
    "reject-test-id": {
      "role": [
        "health_issuer"
      ],
      "actions": [
        {
          "name": "reject_test_id",
          "type": "message",
          "content": "Sorry, lab result failed to issue, contact your health issuer"
        }
      ],
      "next": "next-step"
    },
    "reject-lab-result": {
      "role": [
        "health_issuer"
      ],
      "actions": [
        {
          "name": "reject_lab_result",
          "type": "message",
          "content": "Sorry, lab result failed to issue, contact your health issuer"
        }
      ],
      "next": "next-step"
    },
    "reject-exemption": {
      "role": [
        "health_issuer"
      ],
      "actions": [
        {
          "name": "reject_exemption",
          "type": "message",
          "content": "Sorry, exemption failed to issue, try again"
        }
      ],
      "next": "exemption"
    },
    "reject-vaccine": {
      "role": [
        "health_issuer"
      ],
      "actions": [
        {
          "name": "reject_vaccine",
          "type": "message",
          "content": "Sorry, vaccine credential issuance failed, try again"
        }
      ],
      "next": "vaccine"
    },
    "contact-support": {
      "role": [
        "health_issuer"
      ],
      "actions": [
        {
          "name": "contact_support",
          "type": "message",
          "content": "Sorry, fatal error occured. Please, contact technical suport at support@indicio.tech"
        }
      ]
    }
  }
}
```

# Here is the router example for future reference
```
{
    "validate-proof": { // DONE This is true for both issuer and verifier
      "role": ["health_issuer", "health_verifier", "travel_verifier"], // would that be health and travel verifier? What is the difference between them? Isn't it should be just travel verifier?
      "initial": "true", // How "initial" state is going to work for both issuer and verifier?
      "actions": [
        "identify_holder"
      ],
      "next": [
        {
          "issue-health-credential": { // Happy path
            "when": [
                "proof_success", // How are we passing messages/state names?
                "issuer_to_holder_connection" // Can we pass that? Whould that be enough?
            ]              
          }
        },
        {
          "issue-trusted-traveler": { // Happy path
            "when": [
                "proof_success",
                "verifer_to_holder_connection" // Can we pass that? Whould that be enough?
            ]              
          }
        },
        {
          "reject-health-credential": { // Unhappy path the naming is confusing...(
            "when": "proof_error"          
          }
        }
      ]
    },
    "issue-health-credential": { // DONE This step serves as a router for the health issuer to know what to do next
      "role": ["health_issuer", "health_verifier"], // why verifier? Which verifier? Health verifier?
      "actions": [
      
      // I think this is redundant
        "initiate_connection", // Connection is already established, isn't it?
        "identify_holder", // Holder is already identified, isn't it?
        [
          "issue_lab_order",
          "issue_lab_result",
          "issue_exemption",
          "issue_vaccine"
        ]
      //  I think this is redundant
      
      ],
      "next": [
        {
          "lab-order": {
            "when": [
              [
                "issuer_to_holder_connection",
                {"request":"get_lab_order"}
              ]
            ]
          }
        },
        {
          "lab-result": {
            "when": [
              [
                "issuer_to_holder_connection",
                "lab_order_credential",
                {"request": "get_lab_result"}
              ]
            ]
          }
        },
        {
          "exemption": {
            "when": [
              [
                "issuer_to_holder_connection",
                "exemption_proof", // doctor's form, waiver application (religious (membership proof), philosophical). How and when do we validate exemption proof
                {"request":"get_exemption"}
              ]
            ]
          }
        },
        {
          "vaccine": {
            "when": [
              [
                "issuer_to_holder_connection",
                "lab_order_credential",
                {"request":"get_vaccine"}
              ]
            ]
          }
        },
        {
          "issue_trusted_traveler": {
            "when": [
              [
                "success", // Do we really need a "success" flag? What will determine success?
                "vaccine_credential" // Full vacination. Do we handle single single vaccine dose credential?
              ],
              [
                "test_result_credential"
              ],
              [
                "exemption_credential",
                "test_result_credential"
              ]
            ]
          }
        },
        {
          "contact-support": {
            "when": "unspecified_error"
          }
        }
      ]
    },
}

```


```
present test_result OR
  negative, < X days old OR
  positive, > X days old
present vaccine(s)
disease target
  Moderna
    2 doses
  Pfizer
    2 doses
  Johnson and Johnson
    1 dose
issued by validated issuer
```