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-0398.xml 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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>User Avatar to vCard-Based Avatars Conversion</title>
  10. <abstract>This specification describes a method for using PEP based avatars and vCard based avatars in parallel by having the user’s server do a conversion between the two.</abstract>
  11. &LEGALNOTICE;
  12. <number>0398</number>
  13. <status>Experimental</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XEP-0084</spec>
  20. <spec>XEP-0153</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>pep-vcard-conversion</shortname>
  25. <author>
  26. <firstname>Daniel</firstname>
  27. <surname>Gultsch</surname>
  28. <email>daniel@gultsch.de</email>
  29. <jid>daniel@gultsch.de</jid>
  30. </author>
  31. <revision>
  32. <version>0.2.0</version>
  33. <date>2018-01-25</date>
  34. <initials>XEP Editor (jwi)</initials>
  35. <remark>Accepted by vote of Council on 2018-01-10.</remark>
  36. </revision>
  37. <revision>
  38. <version>0.1.0</version>
  39. <date>2017-12-18</date>
  40. <initials>dg</initials>
  41. <remark><p>First draft.</p></remark>
  42. </revision>
  43. </header>
  44. <section1 topic='Introduction' anchor='intro'>
  45. <p>&xep0084; and &xep0153; are usually considered to stand in competition with each other. <strong>XEP-0084</strong> even talks about superseeding <strong>XEP-0153</strong> in the future. While <strong>XEP-0084</strong> provides a more efficient interface to upload avatars by seperating meta data and data (thus saving the client from having to download its own avatar on every connect) it has the significant downside of not working with &xep0045;.</p>
  46. <p>Server implementations can aid to resolve this conflict by automatically putting avatars uploaded with <strong>XEP-0084</strong> into <strong>XEP-0153</strong> storage and vice versa. This allows clients to use the more efficient <strong>XEP-0084</strong> for uploading avatars and <strong>XEP-0153</strong> to retrieve avatars in Multi-User Chats.</p>
  47. </section1>
  48. <section1 topic='Discovery' anchor='disco'>
  49. <p>The conversion is transparent to the uploading entity. However an entity might want to discover if a service will be performing the conversion from <strong>XEP-0084</strong> to <strong>XEP-0153</strong> since using vCard-Based Avatars will make the uploaded avatar publicly available. (See the »Security Considerations« section of this XEP.)</p>
  50. <p>The service MUST include a &xep0030; feature of "urn:xmpp:pep-vcard-conversion:0" on the account.</p>
  51. <example caption='Client sends service discovery request to own account'><![CDATA[
  52. <iq from='romeo@montague.tld/garden'
  53. id='01'
  54. type='get'
  55. to='remeo@montague.tld'>
  56. <query xmlns='http://jabber.org/protocol/disco#info'/>
  57. </iq>]]></example>
  58. <example caption='Server includes feature namespace in response'><![CDATA[
  59. <iq from='romeo@montague.tld'
  60. id='01'
  61. type='result'
  62. to='romeo@montague.tld/garden'>
  63. <query xmlns='http://jabber.org/protocol/disco#info'>
  64. <feature var='urn:xmpp:pep-vcard-conversion:0'/>
  65. </query>
  66. </iq>]]></example>
  67. </section1>
  68. <section1 topic='Conversion' anchor='conversion'>
  69. <p>Modern clients are expected to use PEP (<strong>XEP-0084</strong>) as interface to upload their avatar and use vCard (<strong>XEP-0153</strong>) only as a read only fallback. Thus a service MUST support conversion from PEP to vCard. A service MAY support conversion from vCard to PEP in order to display avatars in clients that only support <strong>XEP-0084</strong>.</p>
  70. <section2 topic='From PEP to vCard' anchor='pep2vcard'>
  71. <p>Upon receiving a publication request to the 'urn:xmpp:avatar:metadata' node the service MUST look up the corresponding item published in the 'urn:xmpp:avatar:data' node and store the content of the data element as a photo in the vcard. Services MUST consider the fact that the metadata node might contain multiple info elements and MUST pick the info element that does not point to an exernal URL. Services SHOULD verify that the SHA-1 hash of the image matches the id.</p>
  72. </section2>
  73. <section2 topic='From vCard to PEP' anchor='vcard2pep'>
  74. <p>Upon receiving a vCard publication request with a valid photo attached to it a service MUST first publish an item to the 'urn:xmpp:avatar:data' node on behalf of the requesting entity. The id of that item MUST be the SHA-1 hash of the image as described in <strong>XEP-0084</strong>. Afterwards the service MUST publish a new item to the 'urn:xmpp:avatar:metadata' node with one info element that represents the newly published image using the type value from the vCard as a type attribute in the info element.</p>
  75. <p>After publication the service SHOULD send out notification messages to all subscribers of the metadata node.</p>
  76. </section2>
  77. </section1>
  78. <section1 topic='Presence Broadcast' anchor='presence'>
  79. <p>The »Business Rules« section of <strong>XEP-0153</strong> tells entities to include a hash of the vCard avatar in their presence. However this requires clients to retrieve the avatar on every connect to calculate the hash. To avoid this, services MUST include the hash on behalf of their users in every available presence that does not contain an empty photo element wrapped in an x element qualified by the 'vcard-temp:x:update' namespace. Empty x elements qualified by the 'vcard-temp:x:update' namespace (those without a photo element as child) MUST be overwritten. Presences where the content of the photo element is not empty and not equal to the hash calculated by the service MAY be overwritten.</p>
  80. <example caption='Client sends presence to server'><![CDATA[
  81. <presence/>]]></example>
  82. <example caption='Server forwards presence to other entities that have presence subscription'><![CDATA[
  83. <presence to='juliet@capulet.tld' from='romeo@montague.tld/garden'>
  84. <x xmlns='vcard-temp:x:update'>
  85. <photo>sha1-hash-of-image</photo>
  86. </x>
  87. </presence>]]></example>
  88. <example caption='Client sends a presence containing an empty photo element'><![CDATA[
  89. <presence>
  90. <x xmlns='vcard-temp:x:update'>
  91. <photo/>
  92. </x>
  93. </presence>]]></example>
  94. <example caption='The server redirects the presence but doesn’t touch the photo element'><![CDATA[
  95. <presence to='juliet@capulet.tld' from='romeo@montague.tld/garden'>
  96. <x xmlns='vcard-temp:x:update'>
  97. <photo/>
  98. </x>
  99. </presence>]]></example>
  100. <p>The hash MUST also be injected into directed presences such as MUC joins</p>
  101. </section1>
  102. <section1 topic='Implementation Notes' anchor='impl'>
  103. <p>Implementing clients SHOULD use the more efficient <strong>XEP-0084</strong> to access their own avatar storage and implement <strong>XEP-0153</strong> only to download avatars from other entities if they do not have mutual presence subscription with said entity. (For example participants in a Multi-User Chat.)</p>
  104. <p>Services will inject the hash in directed presences automatically but will not resend the presence if the avatar gets updated. Thus clients MAY resend directed available presence to all Multi-User Chats after receiving a 'urn:xmpp:avatar:metadata' update notification. The service will then inject an updated version of the hash. To avoid sending unnecassary presence updates, resending should only occur if the service annouces the 'urn:xmpp:pep-vcard-conversion:0' feature.</p>
  105. </section1>
  106. <section1 topic='Security Considerations' anchor='security'>
  107. <p><strong>XEP-0084</strong> has a default access model that only allows entities with mutual presence subscription to access the published avatar. <strong>XEP-0153</strong> has no access control at all. Clients that discover the disco feature 'urn:xmpp:pep-vcard-conversion:0' on the account MAY warn users that uploading an avatar will make that avatar accessible to anyone who knows the Jabber ID.</p>
  108. <p>In the future services MAY decide to perform PEP to vCard conversion only if the access model of the 'urn:xmpp:avatar:data' node has been set to 'open' as described in &xep0060;. However the ability to change the access model of nodes isn’t widely implemented yet and thus this paragraph exists only to act as a reminder that the privacy implications described in the previous paragraph can be avoided</p>
  109. </section1>
  110. <section1 topic='IANA Considerations' anchor='iana'>
  111. <p>This document requires no interaction with the Internet Assigned Numbers Authority (IANA).</p>
  112. </section1>
  113. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  114. <p>This specification defines the following XML namespace:</p>
  115. <ul>
  116. <li>urn:xmpp:pep-vcard-conversion:0</li>
  117. </ul>
  118. </section1>
  119. <section1 topic='XML Schema' anchor='schema'>
  120. <p>tbd</p>
  121. </section1>
  122. <section1 topic='Acknowledgements' anchor='ack'>
  123. <p>Special thanks to Evgeny Khramtsov who implemented what is now written down as a XEP in ejabberd and created the inspiration for this XEP.</p>
  124. </section1>
  125. </xep>