Event `30168` describes a form as a parametrized replaceable event, with `field` tags that contain the description of each form field, with optional settings
**settings** - A form wide settings object, that can detail styles and visual representation of the form, certain fields in the object may be client specific
**field** - contains the description of a form field.
## Field Tag
A field tag is described as the following array:
`["field", FieldId, InputType, Label, Options, Field Settings ]`
**FieldId** - Is used to identify the field in the form, can be any alphanumeric string.
**InputType** - Can be one of: "text", "option", "label". All other types can be derived from the text type.
**Label** - Value that describes the field, can be a question the user needs feedback eg: "What is your age?"
**Options** - A stringified array of Options in case the user selected an option type.
**Field Settings** - A stringified JSON that may contain metadata about a field, like wether the field is a "required" field or "prerequisites" for a field.
## Options
The options array is a stringified Array of Option Tags, where each option tag is
represented as:
`[<OptionId>, <label>, <optional config>]`
**OptionId** - Similar to FieldId it is an alphanumeric Id that serves as an identifier for that Id in the form.
**label** - A label describing the option.
**Optional Config** - metadata object holds information about the options like "prerequisites".
## Responses
Response events are events that are attached to a form(3068 kind event), and the response data is stored in a `kind: 1069` event
The Response tag contains a "response" tag identifier "fieldId" the Id of the field as mentioned in the `kind:30168` event, response for the field as a string value, and a stringified metadata object.
for option fields, the response is the id of the option selected. In case of multiple-choice fields these id's maybe delimited by a semi-colon, ";", For example:
The kind `1059` event also works similar to as described in [[59.md]] except that instead of referencing a users pubkey, we refer to an alias pubkey which is derived by hashing the form event information to the users pubkey as follows:
Response tags are added to the `.content` field of the event and encrypted as per the spec in [nip-44](./44.md) by the responders private key and the form authors public key.
Form fields and settings should be ommitted from the tags array and placed in the `.content` key, nip-44 encrypted by the corresponding public key of the view-key, and the signing key as private key. The selected responders can decrypt the form using the view key. The `tags` array is used to keep track of the allowed-responders identities.
All of these conditions can be met by establishing a "Voter Key". The Voter Key is a private key generated by someone with edit access to the form (Issuer).
["name", "This is the title of your form! Tap to edit."],
["field", "egtD6v", "option", "What is the best breakfast?", "[[\"2KJ6h4\",\"Omelette\"],[\"1m3a5q\",\"Pancakes\"]]", "{\"renderElement\":\"radioButton\"}"
- Alias pubkey on gift wrap means that there is no notification mechanism for the user, unless the user is expecting access to an event.
- Alias pubkey also means that it can be checked that a particular user received a gift wrap for a form event, but it cannot be directly determined who all received the gift wraps, it also makes it easier in disambiguating between event kinds.
- Voter Key might make it anoymous to other participants, but the issuer can still know who a particular user voted for. In this implementation, the issuer is to be "trusted", but there may be out of band ways of having a "trustless" issuer. For example distrubiting voter Id chits in a physical meetup.