---
# System prepended metadata

title: (HOLDER) State payload variants for credentials issuance and verification and flows explanation.

---

# (HOLDER) State payload variants for credentials issuance and verification and flows explanation.

For each flow to start - should be used `parse` method of an SDK thru the exposed bindings (note that the name of the exposed function could be called different, you need to clarify this with SDK team while this is in active development stage). 

## Credential issuance

### Receiving Invitation

`Credential Issuance` flow is starting from invitation (Out-Of-Band) processing, previously generated by the `Issuer`. Invitation could be received by the wallet in any available way (for now by extracting it from scanned QR code or directly by passing raw message to it. This is just a `didcomm` message (JSON object with strictly predefined possible members/properties).
After receiving `Invitation` (Out-Of-Band) message - `SDK` will:
1. create a new `didcomm` message to be send to the `Issuer`. 
2. create a new record in the db with state named `ProposalSent`, it will contain, received in the `Invitation` message, extra data from `body` property ([Out-Of-Band message](https://identity.foundation/waci-didcomm/#step-1-generate-out-of-band-oob-message));
TODO: Add structure from SDK with payload and body in JSON object format....


TODO: Continue with this description here for each possible state for the `Holder`.





--------------------------
FIXME @Hedayat: After describing each possible state and payload data above - here at the end we could provide final possible structure of the JSON Object which will be provided to the wallet team with the higher level info, not just payloads as above. Then show them this document and discuss with them if they are ok with it and after that on the SDK side - make some data mappings and provide them these structures.

### Suggested interaction state item to use:

```json
{
    "id":"07b34f91-b8f5-43c1-b3a5-97b6702da96e",
    "type": "Enum with variants 'Presentation' OR 'Credential Issuance'",
    "createdBy":"did:jolo:v1:E670yj0YACWivyIZ-t0fUNnjPkWILKJCpSQHUkQqJNd8",
    "createdFor":"did:jolo:v1:Es8IUK_tXTgV4jirKthghprHblR6Rh2jx67YHXUn6yD4",
    "currentState": {
      "state": "Depends on the state and interaction type enum variant e.g. 'ProposalSent', 'RequestReceived', 'Done' etc.",
      "payload": "Here should be provided only internal data of 'HolderPresentationState' or 'HolderCredentialIssuanceState' which should be casted/transformed to concrete data type in the wallet for example and which type it should be is depends on interaction type and state property of this currentState object.  ! THIS WILL BE ONE OF ABOVE DESCRIBED PAYLOADS OBJECTS!"
    },
    "createdAt":"2023-02-10T10:54:41.110513220",
    "invitationId":"d590760b-6403-40e6-8a54-1ab05c80705a"  }
```

# JsonSchemas

### ProposalSent

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "options": {
      "type": "object",
      "properties": {
        "challenge": {
          "type": "string",
          "description": "UUID as a string. Example: 'cd2cb06b-91a5-4544-8c5e-eec12765a6a7'.",
          "minLength": 36,
          "maxLength": 36,
          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "domain": {
          "type": "string"
        }
      },
      "required": [
        "challenge"
      ]
    },
    "presentation_definition": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "UUID as a string. Example: 'cd2cb06b-91a5-4544-8c5e-eec12765a6a7'.",
          "minLength": 36,
          "maxLength": 36,
          "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
        },
        "format": {
          "type": "object",
          "properties": {
            "jwt": {
              "type": "object",
              "properties": {
                "alg": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string"
                    }
                  ],
                  "minItems": 1
                },
                "proof_type": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string",
                      "enum": [
                        "BbsBlsSignature2020",
                        "Ed25519Signature2018"
                      ]
                    }
                  ],
                  "minItems": 1
                }
              },
              "oneOf": [
                {
                  "required": [
                    "proof_type"
                  ]
                },
                {
                  "required": [
                    "alg"
                  ]
                }
              ]
            },
            "jwt_vc": {
              "type": "object",
              "properties": {
                "alg": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string"
                    }
                  ],
                  "minItems": 1
                },
                "proof_type": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string",
                      "enum": [
                        "BbsBlsSignature2020",
                        "Ed25519Signature2018"
                      ]
                    }
                  ],
                  "minItems": 1
                }
              },
              "oneOf": [
                {
                  "required": [
                    "proof_type"
                  ]
                },
                {
                  "required": [
                    "alg"
                  ]
                }
              ]
            },
            "jwt_vp": {
              "type": "object",
              "properties": {
                "alg": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string"
                    }
                  ],
                  "minItems": 1
                },
                "proof_type": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string",
                      "enum": [
                        "BbsBlsSignature2020",
                        "Ed25519Signature2018"
                      ]
                    }
                  ],
                  "minItems": 1
                }
              },
              "oneOf": [
                {
                  "required": [
                    "proof_type"
                  ]
                },
                {
                  "required": [
                    "alg"
                  ]
                }
              ]
            },
            "ldp": {
              "type": "object",
              "properties": {
                "alg": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string"
                    }
                  ],
                  "minItems": 1
                },
                "proof_type": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string",
                      "enum": [
                        "BbsBlsSignature2020",
                        "Ed25519Signature2018"
                      ]
                    }
                  ],
                  "minItems": 1
                }
              },
              "oneOf": [
                {
                  "required": [
                    "proof_type"
                  ]
                },
                {
                  "required": [
                    "alg"
                  ]
                }
              ]
            },
            "ldp_vc": {
              "type": "object",
              "properties": {
                "alg": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string"
                    }
                  ],
                  "minItems": 1
                },
                "proof_type": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string",
                      "enum": [
                        "BbsBlsSignature2020",
                        "Ed25519Signature2018"
                      ]
                    }
                  ],
                  "minItems": 1
                }
              },
              "oneOf": [
                {
                  "required": [
                    "proof_type"
                  ]
                },
                {
                  "required": [
                    "alg"
                  ]
                }
              ]
            },
            "ldp_vp": {
              "type": "object",
              "properties": {
                "alg": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string"
                    }
                  ],
                  "minItems": 1
                },
                "proof_type": {
                  "type": "array",
                  "items": [
                    {
                      "type": "string",
                      "enum": [
                        "BbsBlsSignature2020",
                        "Ed25519Signature2018"
                      ]
                    }
                  ],
                  "minItems": 1
                }
              },
              "oneOf": [
                {
                  "required": [
                    "proof_type"
                  ]
                },
                {
                  "required": [
                    "alg"
                  ]
                }
              ]
            }
          }
        },
        "input_descriptors": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The value of the id property MUST be a string that does not conflict with the id of another Input Descriptor Object in the same Presentation Definition."
              },
              "name": {
                "type": "string",
                "description": "Human readable description of the requested properties."
              },
              "purpose": {
                "type": "string",
                "description": "Describes the purpose for which the Claim's data is being requested."
              },
              "schema": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "uri": {
                      "type": "string",
                      "description": "Valid URI for an acceptable Claim schema."
                    },
                    "required": {
                      "type": "boolean",
                      "description": "Indicates if the given schema object is required to be the schema of the inputs used to fulfill the given Submission Requirement."
                    }
                  },
                  "required": [
                    "uri"
                  ]
                }
              },
              "constraints": {
                "type": "object",
                "properties": {
                  "subject_is_issuer": {
                    "type": "string",
                    "enum": ["required", "preferred"]
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "path": {
                          "type": "array",
                          "description": "Property path to validate by rules defined in `Field::filter` property.",
                          "items": {
                            "type": "string"
                          }
                        },
                        "filter": {
                          "type": "object",
                          "description": "Json schema to validate value by path defined in `Field::path` property."
                        }
                      }
                    }
                  }
                }
              }
            },
            "required": [
              "id"
            ]
          }
        }
      },
      "required": [
        "id"
      ]
    }
  },
  "required": [
    "options",
    "presentation_definition"
  ]
}
```