%ents; ]>
Unique and Stable Stanza IDs This specification describes unique and stable IDs for messages. &LEGALNOTICE; 0359 Deferred 2018-11-03 Standards Track Standards Council XMPP Core stanza-id &flow; 0.6.0 2018-10-01 XEP Editor (jsc) Defer due to lack of activity. 0.5.0 2017-08-23 dg
  • Business rules clarifications
  • Define stanza-ids for messages only
0.4.1 2017-05-20 egp
  • Added an XML schema.
  • Fixed a typo.
0.4 2016-10-30 dg

Add ability to discover support

0.3.0 2016-10-29 fs

Rename client-id element to origin-id.

Minor improvements.

0.2.1 2015-09-22 fs

Minor fixes (typos, s/JID/XMPP Address, etc.)

0.2 2015-09-18 fs
  • Refactored client-id from attribute to element.
  • Set short name to 'stanza-id'.
  • Clarified that SID elements must not have additional content.
0.1 2015-07-14 XEP Editor (mam)

Initial published version approved by the XMPP Council.

0.0.2 2015-06-22 fs
  • Rename the XEP from "Message IDs" to "Stanza IDs"
  • Add 'by' attribute
0.0.1 2015-06-01 fs

First draft.

This XEP introduces unique and stable IDs for messages, which are beneficial in various ways. For example, they can be used together with &xep0313; to uniquely identify a message within an archive. They are also useful in the context of &xep0045; conferences, as they allow to identify a message reflected by a MUC service back to the originating entity.

]]>

In order to create a &stanza-id; extension element, the creating XMPP entity generates and sets the value of the 'id' attribute, and puts its own XMPP address as value of the 'by' attribute. The value of the 'id' attribute must be unique and stable, i.e. it MUST NOT change later for some reason within the scope of the 'by' value. Thus the IDs defined in this extension MUST be unique and stable within the scope of the generating XMPP entity. It is RECOMMENDED that the ID generating service uses UUID and the algorithm defined in &rfc4122; to generate the IDs.

Some use cases require the originating entity, e.g. a client, to generate the stanza ID. In this case, the client MUST use the &origin-id; element extension element qualified by the 'urn:xmpp:sid:0' namespace. Note that originating entities often want to conceal their XMPP address and therefore the &origin-id; element has no 'by' attribute.

Typical body text ]]>

The server or component MAY add a &stanza-id; element. In that case, it MUST preserve the content of the &origin-id; element.

Typical body text ]]>
  1. The values of the 'id' attribute SHOULD be unpredictable.
  2. Stanza ID generating entities, which encounter a &stanza-id; element where the 'by' attribute matches the 'by' attribute they would otherwise set, MUST delete that element even if they are not adding their own stanza ID.
  3. Entities, which are routing stanzas, SHOULD NOT strip any elements qualified by the 'urn:xmpp:sid:0' namespace from message stanzas unless the preceding rule applied to those elements.
  4. Stanzas MUST possess, in the direct child level of the stanza, at most one &stanza-id; extension element with the same XMPP address as value of the 'by' attribute.
  5. Every &stanza-id; extension element MUST have the 'id' attribute and the 'by' attribute set.
  6. Every &stanza-id; and &origin-id; extension element MUST always possess an 'id' attribute and MUST NOT have any child elements or text content.
  7. The value of the 'by' attribute MUST be the XMPP address of the entity assigning the unique and stable stanza ID. For one-on-one messages the assigning entity is the account. In groupchats the assigning entity is the room. Note that XMPP addresses are normalized as defined in &rfc6122;.

An entity that follows the business rules, especially the rule on overriding the ID in elements where the by atttribute matches the 'by' attribute they would otherwise set, SHOULD announce the 'urn:xmpp:sid:0' namespace in its disco features allowing other entities to verify that those business rules are properly enforced.

]]> ]]>

The value of the 'id' attribute should not provide any further information besides the opaque ID itself. Entities observing the value MUST NOT be able to infer any information from it, e.g. the size of the message archive. The value of 'id' MUST be considered a non-secret value.

Before processing the stanza ID of a message and using it for deduplication purposes or for MAM catchup, the receiving entity SHOULD ensure that the stanza ID could not have been faked, by verifying that the entity referenced in the by attribute does annouce the 'urn:xmpp:sid:0' namespace in its disco features.

This document requires no interaction with &IANA;.

This specification defines the following XML namespaces:

  • urn:xmpp:sid:0

The ®ISTRAR; shall include the foregoing namespaces in its registry of protocol namespaces (see &NAMESPACES;) and in its disco features registry (&DISCOFEATURES;) as defined in &xep0030;.

urn:xmpp:sid:0 Indicates that an entity adds stanza-ids and follows the business rules described in the XEP XEP-0359 ]]>
The protocol documented by this schema is defined in XEP-0359: https://www.xmpp.org/extensions/xep-0359.html ]]>

Thanks to Thijs Alkemade and Georg Lukas for providing feedback.