diff --git a/101.md b/101.md index 39bf63b..098bda6 100644 --- a/101.md +++ b/101.md @@ -28,13 +28,12 @@ Event `30168` describes a form as a parametrized replaceable event, with `field` The different tags used to detail the form are described as: -| Tags | Description | -| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| d | The unique identifier of a form, for a user | -| name | A text serving as the name of the form | -| settings | An optional global config for the form. | -| field | Contains the following values | +| Tags | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| d | The unique identifier of a form, for a user | +| name | A text serving as the name of the form | +| settings | An optional global config for the form. | +| field | Contains the following values
indexnamedescription
1FieldIdan id that uniqely identifies a field in the forn
2input-typeA field that describes the type of value that can be expected as a response to this field, values can be: `text`, `option` or `label`
3labelA label for the field
4options Only used for input-type option, is a Json stringified array of option Tags. | -| Option Tags | Option Tags are defined as: [`, <`label`>, ``], optionId can be any alphanumeric string
5fieldSettingsAn optional JSON stringified object that contains settings specific to the field, for example `renderElement`, a setting which indicates what UI element to render to the client
|
indexnamedescription
1FieldIdan id that uniqely identifies a field in the forn
2input-typeA field that describes the type of value that can be expected as a response to this field, values can be: `text`, `option` or `label`
3labelA label for the field
4options Only used for input-type option, is a Json stringified array of option Tags.
- Option Tags Option Tags are defined as: [`, <`label`>, ``], optionId can be any alphanumeric string
5fieldSettingsAn optional JSON stringified object that contains settings specific to the field, for example `renderElement`, a setting which indicates what UI element to render to the client
@@ -71,7 +70,8 @@ for option fields, the response is the id of the option selected. In case of mul "kind": 30169, "content": "", "tags": [ - ["a", "30168::
"], + ["d", ":"], + ["a", "30168::"], [ "response", "", @@ -145,3 +145,25 @@ let encyptedKey = nip44.v2.encrypt(bytesToHex(signingKey), conversationKey); The rest of the mechanism remains same as in public forms editable by a group except that the form fields should be placed in the `.content` key, encrypted by a `view-key`, which is shared in the 3rd index of the key tag for the viewers. + +## Querying Form Template & Responses + +form template maybe filtered using the form author's pubkey and the d-tag as follows + +```js +const filter = { + kinds: [30168], + authors: [formIdPubkey], + "#d": [formIdentifier], +}; +``` + +Responses can be queried using the a-tag, and an optional authors tag depending the visibility of the form, for example + +```js +const filter: Filter = { + kinds: [30169], + "#a": [`30168:${pubKey}:${formId}`], +}; +if (allowedPubkeys) filter.authors = allowedPubkeys; +```