No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0222.xml 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Persistent Storage of Public Data via PubSub</title>
  10. <abstract>This specification defines best practices for using the XMPP publish-subscribe extension to persistently store semi-public data objects such as public keys and personal profiles.</abstract>
  11. &LEGALNOTICE;
  12. <number>0222</number>
  13. <status>Active</status>
  14. <type>Informational</type>
  15. <sig>Standards JIG</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XMPP IM</spec>
  20. <spec>XEP-0030</spec>
  21. <spec>XEP-0060</spec>
  22. <spec>XEP-0115</spec>
  23. </dependencies>
  24. <supersedes/>
  25. <supersededby/>
  26. <shortname>N/A</shortname>
  27. &stpeter;
  28. <revision>
  29. <version>1.0</version>
  30. <date>2008-09-08</date>
  31. <initials>psa</initials>
  32. <remark><p>Per a vote of the XMPP Council, advanced specification to Active.</p></remark>
  33. </revision>
  34. <revision>
  35. <version>0.3</version>
  36. <date>2008-06-20</date>
  37. <initials>psa</initials>
  38. <remark><p>Added text about composition model, and modified examples accordingly.</p></remark>
  39. </revision>
  40. <revision>
  41. <version>0.2</version>
  42. <date>2008-03-03</date>
  43. <initials>psa</initials>
  44. <remark><p>Removed hokey acronym; changed type to Informational; clarified text.</p></remark>
  45. </revision>
  46. <revision>
  47. <version>0.1</version>
  48. <date>2007-08-08</date>
  49. <initials>psa</initials>
  50. <remark><p>Initial published version.</p></remark>
  51. </revision>
  52. <revision>
  53. <version>0.0.1</version>
  54. <date>2007-07-18</date>
  55. <initials>psa</initials>
  56. <remark><p>First draft.</p></remark>
  57. </revision>
  58. </header>
  59. <section1 topic='Introduction' anchor='intro'>
  60. <section2 topic='Motivation' anchor='motivation'>
  61. <p>&xep0163; introduced the idea of a virtual &xep0060; service associated with an IM user's bare JID &LOCALBARE;. However, the default node configuration options associated with PEP nodes are not optimized for the persistent storage of semi-public data objects such as public keys or user profiles. Therefore this document defines a set of best practices that enable IM users to persistently store semi-public data objects at their virtual pubsub service; in effect, we "sub-class" PEP by showing how a particular pubsub node can be configured for persisting objects.</p>
  62. </section2>
  63. <section2 topic='How It Works' anchor='howitworks'>
  64. <p>Imagine that you are a Shakespearean character named Juliet and that you want to persistently store information such as your public keys (see &xep0189;) and user profile (see &xep0154;).</p>
  65. <p>We assume that you have three contacts with the following relationship to you:</p>
  66. <ol start='1'>
  67. <li>benvolio@montague.lit, who has no subscription to your presence</li>
  68. <li>nurse@capulet.lit, who has a bidirectional subscription to your presence and who is in your "Servants" roster group</li>
  69. <li>romeo@montague.lit, who has a bidirectional subscription to your presence and who is in your "Friends" roster group</li>
  70. </ol>
  71. <p>We also assume that your server (capulet.lit) supports PEP along with the "publish-options" feature, and that your client discovered that support when you logged in.</p>
  72. <p>Because you want to keep your communications with Romeo confidential, you decide to start encrypting your messages. Therefore you reconfigure your client, which generates an RSA key that it publishes to the virtual pubsub service hosted at your bare JID &lt;juliet@capulet.lit&gt;.</p>
  73. <example caption='Publishing a key'><![CDATA[
  74. <iq from='juliet@capulet.lit/balcony' type='set' id='pub1'>
  75. <pubsub xmlns='http://jabber.org/protocol/pubsub'>
  76. <publish node='urn:xmpp:tmp:pubkey'>
  77. <item id='julietRSAkey1hash'>
  78. <key xmlns='urn:xmpp:tmp:pubkey'>
  79. <x509cert>
  80. der-encoded-cert
  81. </x509cert>
  82. </key>
  83. </item>
  84. </publish>
  85. <publish-options>
  86. <x xmlns='jabber:x:data' type='submit'>
  87. <field var='FORM_TYPE' type='hidden'>
  88. <value>http://jabber.org/protocol/pubsub#publish-options</value>
  89. </field>
  90. <field var='pubsub#persist_items'>
  91. <value>true</value>
  92. </field>
  93. <field var='pubsub#send_last_published_item'>
  94. <value>never</value>
  95. </field>
  96. <field var='pubsub#access_model'>
  97. <value>roster</value>
  98. </field>
  99. <field var='pubsub#roster_groups_allowed'>
  100. <value>Friends</value>
  101. </field>
  102. </x>
  103. </publish-options>
  104. </pubsub>
  105. </iq>
  106. ]]></example>
  107. <p>Your publish request is a standard pubsub request except that:</p>
  108. <ol start='1'>
  109. <li>The item is persisted (pubsub#persist_items is true).</li>
  110. <li>The last published item is never sent (pubsub#send_last_published_item is set to "never" so that items are pushed out only when modified).</li>
  111. </ol>
  112. <p>(In this case, access is limited to people in your Friends roster group.)</p>
  113. <p>If all goes well (see <link url='#publish'>Publishing an Item</link>), your key will be pushed out to all appropriate individuals (in this case only Romeo). In particular, Romeo receives your key because he has auto-subscribed to the virtual pubsub service at your bare JID via a presence subscription and because his &xep0115; data indicated that he is interested in the "urn:xmpp:tmp:pubkey" payload type.</p>
  114. <example caption='Appropriate entities receive event notifications'><![CDATA[
  115. <message from='juliet@capulet.lit'
  116. to='romeo@montague.lit/orchard'
  117. type='headline'
  118. id='keyfoo1'>
  119. <event xmlns='http://jabber.org/protocol/pubsub#event'>
  120. <items node='urn:xmpp:tmp:pubkey'>
  121. <item id='julietRSAkey1hash'>
  122. <key xmlns='urn:xmpp:tmp:pubkey'>
  123. <x509cert>
  124. der-encoded-cert
  125. </x509cert>
  126. </key>
  127. </item>
  128. </items>
  129. </event>
  130. </message>
  131. ]]></example>
  132. <p>Because PEP services must send notifications to the account owner, you too receive the notification at each of your resources (here "balcony" and "chamber").</p>
  133. <example caption='Publisher receives event notification'><![CDATA[
  134. <message from='juliet@capulet.lit'
  135. to='juliet@capulet.lit/balcony'
  136. type='headline'
  137. id='keyfoo2'>
  138. <event xmlns='http://jabber.org/protocol/pubsub#event'>
  139. <items node='urn:xmpp:tmp:pubkey'>
  140. <item id='julietRSAkey1hash'>
  141. <key xmlns='urn:xmpp:tmp:pubkey'>
  142. <x509cert>
  143. der-encoded-cert
  144. </x509cert>
  145. </key>
  146. </item>
  147. </items>
  148. </event>
  149. </message>
  150. <message from='juliet@capulet.lit'
  151. to='juliet@capulet.lit/chamber'
  152. type='headline'
  153. id='keyfoo3'>
  154. <event xmlns='http://jabber.org/protocol/pubsub#event'>
  155. <items node='urn:xmpp:tmp:pubkey'>
  156. <item id='julietRSAkey1hash'>
  157. <key xmlns='urn:xmpp:tmp:pubkey'>
  158. <x509cert>
  159. der-encoded-cert
  160. </x509cert>
  161. </key>
  162. </item>
  163. </items>
  164. </event>
  165. </message>
  166. ]]></example>
  167. <p>So that's the general idea.</p>
  168. </section2>
  169. </section1>
  170. <section1 topic='Concepts and Approach' anchor='approach'>
  171. <p>The best practices described herein re-use the concepts already defined in <cite>XEP-0060</cite> and <cite>XEP-0163</cite>. In order to optimize for object persistence instead of transient event notifications, a node MUST be configured as follows:</p>
  172. <ol start='1'>
  173. <li>Set pubsub#persist_items to true.</li>
  174. <li>Set pubsub#send_last_published_item to "never".</li>
  175. </ol>
  176. <p>The access model MAY be any model defined in <cite>XEP-0060</cite>.</p>
  177. </section1>
  178. <section1 topic='Publishing an Item' anchor='publish'>
  179. <p>An account owner publishes an item to a node by following the protocol specified in <cite>XEP-0060</cite>:</p>
  180. <example caption='Account owner publishes item'><![CDATA[
  181. <iq from='juliet@capulet.lit/balcony' type='set' id='pub1'>
  182. <pubsub xmlns='http://jabber.org/protocol/pubsub'>
  183. <publish node='urn:xmpp:tmp:pubkey'>
  184. <item id='julietRSAkey1hash'>
  185. <key xmlns='urn:xmpp:tmp:pubkey'>
  186. <x509cert>
  187. der-encoded-cert
  188. </x509cert>
  189. </key>
  190. </item>
  191. </publish>
  192. </pubsub>
  193. </iq>
  194. ]]></example>
  195. <p>If the node does not already exist, the virtual pubsub service MUST create the node. As described in <cite>XEP-0163</cite>, this "auto-create" feature (defined in <cite>XEP-0060</cite>) MUST be supported by a PEP service. (Naturally, the account owner's client MAY follow the node creation use case specified in <cite>XEP-0060</cite> before attempting to publish an item.)</p>
  196. <p>In order for the client to reliably persist objects, the virtual pubsub service must also support the "publish-options" feature defined in <cite>XEP-0060</cite>. Typically, a client will publish with options so that the object is properly persisted.</p>
  197. <example caption='Publishing a key'><![CDATA[
  198. <iq from='juliet@capulet.lit/balcony' type='set' id='pub1'>
  199. <pubsub xmlns='http://jabber.org/protocol/pubsub'>
  200. <publish node='urn:xmpp:tmp:pubkey'>
  201. <item id='julietRSAkey1hash'>
  202. <key xmlns='urn:xmpp:tmp:pubkey'>
  203. <x509cert>
  204. der-encoded-cert
  205. </x509cert>
  206. </key>
  207. </item>
  208. </publish>
  209. <publish-options>
  210. <x xmlns='jabber:x:data' type='submit'>
  211. <field var='FORM_TYPE' type='hidden'>
  212. <value>http://jabber.org/protocol/pubsub#publish-options</value>
  213. </field>
  214. <field var='pubsub#persist_items'>
  215. <value>true</value>
  216. </field>
  217. <field var='pubsub#send_last_published_item'>
  218. <value>never</value>
  219. </field>
  220. <field var='pubsub#access_model'>
  221. <value>roster</value>
  222. </field>
  223. <field var='pubsub#roster_groups_allowed'>
  224. <value>Friends</value>
  225. </field>
  226. </x>
  227. </publish-options>
  228. </pubsub>
  229. </iq>
  230. ]]></example>
  231. <p>If the publication logic dictates that event notifications shall be sent, the account owner's server generates notifications and sends them to all appropriate entities as described in the Receiving Event Notifications section of <cite>XEP-0163</cite>.</p>
  232. </section1>
  233. <section1 topic='Composition' anchor='composition'>
  234. <p>Each item published to the node is a logically separate instance of the data to be stored. It is the responsibility of the publishing and receiving entities to construct a complete view of all such items, if desired. For example, each bookmark published to a private data node is a separate piece of data, whereas the history of all items published to the node provides a complete list of the user's bookmarks. This history may include items that are republished with an existing ItemID (thus overwriting the previous version of that item).</p>
  235. </section1>
  236. <section1 topic='Determining Support' anchor='support'>
  237. <p>Before an account owner attempts to complete the use cases defined herein, its client SHOULD verify that the account owner's server supports both PEP and the "publish-options" feature; to do so, it MUST send a &xep0030; information request to the server (or cache <cite>Entity Capabilities</cite> information received from the server).</p>
  238. <example caption='Account owner queries server regarding protocol support'><![CDATA[
  239. <iq from='juliet@capulet.lit/balcony'
  240. to='capulet.lit'
  241. id='disco1'
  242. type='get'>
  243. <query xmlns='http://jabber.org/protocol/disco#info'/>
  244. </iq>
  245. ]]></example>
  246. <p>The server MUST return an identity of "pubsub/pep" and include the "publish-options" feauture in the list of the namespaces and other features it supports:</p>
  247. <example caption='Server communicates protocol support'><![CDATA[
  248. <iq from='capulet.lit'
  249. to='juliet@capulet.lit/balcony'
  250. id='disco1'
  251. type='result'>
  252. <query xmlns='http://jabber.org/protocol/disco#info'>
  253. <identity category='server' type='im'/>
  254. <identity category='pubsub' type='pep'/>
  255. ...
  256. <feature var='http://jabber.org/protocol/pubsub#publish-options'/>
  257. ...
  258. </query>
  259. </iq>
  260. ]]></example>
  261. </section1>
  262. <section1 topic='Security Considerations' anchor='security'>
  263. <p>This document introduces no security considerations above and beyond those specified in <cite>XEP-0060</cite> and <cite>XEP-0163</cite>.</p>
  264. </section1>
  265. <section1 topic='IANA Considerations' anchor='iana'>
  266. <p>This document requires no interaction with &IANA;.</p>
  267. </section1>
  268. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  269. <p>This document requires no interaction with the &REGISTRAR;.</p>
  270. </section1>
  271. </xep>