XEP-0359: Unique and Stable Stanza IDs

Abstract:This specification describes unique and stable IDs for stanzas.
Author:Florian Schmaus
Copyright:© 1999 - 2016 XMPP Standards Foundation. SEE LEGAL NOTICES.
Type:Standards Track
Last Updated:2015-09-22

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.

Table of Contents

1. Introduction
2. Requirements
3. Use Cases
    3.1. Unique stanza IDs
    3.2. Client generated stanza IDs
4. Business Rules
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
    7.1. Protocol Namespaces
8. XML Schema
9. Acknowledgements

    A: Document Information
    B: Author Information
    C: Legal Notices
    D: Relation to XMPP
    E: Discussion Venue
    F: Requirements Conformance
    G: Notes
    H: Revision History

1. Introduction

Unique and stable IDs for stanzas, which are set by a XMPP service, are beneficial in various ways. They can be used together with Message Archive Management (XEP-0313) [1] to uniquely identify a message within an archive. They are also useful in the context of Multi-User Chat (XEP-0045) [2] conferences, in order to identify a message reflected by a MUC service back to the originating entity.

2. Requirements

The herein defined stanza IDs must be unique and stable within the scope of the generating XMPP entity.

3. Use Cases

3.1 Unique stanza IDs

Example 1. The stanza ID extension.

<stanza-id xmlns='urn:xmpp:sid:0'
In order to create a 'stanza-id' extension, 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 RFC 4122 to generate the IDs.

3.2 Client generated stanza IDs

Some use cases require the client to generate the stanza ID. In this case, the client MUST use the 'client-id' element.

Example 2. A message stanza with the stanza ID extension.

<message xmlns='jabber:client'
  <body>Typical body text</body>
  <client-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013'/>

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

Example 3. A message stanza with the stanza ID extension.

<message xmlns='jabber:client'
  <body>Typical body text</body>
  <stanza-id xmlns='urn:xmpp:sid:0'
  <client-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013'/>

4. Business Rules

  1. XMPP entities, which are routing stanzas, MUST NOT strip any elements qualified by the 'urn:xmpp:sid:0' namespace from message stanzas. They SHOULD however ensure that those elements contain only the attributes defined herein, and take appropriate countermeasures if this is not the case (e.g. removing those attributes).
  2. The values of the 'id' attribute SHOULD be unpredictable.
  3. Stanza ID generating entities, which encounter a <stanza-id/> element where 'id' is already set and where the 'by' attribute matches their own XMPP address, MUST ignore the existing value of 'id' and override it.
  4. Stanzas MUST posses, 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 <client-id> extension element MUST always posses 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. Note that XMPP addresses are normalized as defined in RFC 6122 [3]

5. Security Considerations

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.

6. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [4].

7. XMPP Registrar Considerations

7.1 Protocol Namespaces

The XMPP Registrar [5] includes "urn:xmpp:sid:0" in its registry of protocol namespaces (see <http://xmpp.org/registrar/namespaces.html>).

8. XML Schema

REQUIRED for protocol specifications.

9. Acknowledgements

Thanks to Thijs Alkemade and Georg Lukas for providing feedback.


Appendix A: Document Information

Series: XEP
Number: 0359
Publisher: XMPP Standards Foundation
Status: Experimental
Type: Standards Track
Version: 0.2.1
Last Updated: 2015-09-22
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: stanza-id
Source Control: HTML
This document in other formats: XML  PDF

Appendix B: Author Information

Florian Schmaus

Email: flo@geekplace.eu
JabberID: flo@geekplace.eu

Appendix C: Legal Notices


This XMPP Extension Protocol is copyright © 1999 - 2016 by the XMPP Standards Foundation (XSF).


Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <http://xmpp.org/about-xmpp/xsf/xsf-ipr-policy/> or obtained by writing to XMPP Standards Foundation, 1899 Wynkoop Street, Suite 600, Denver, CO 80202 USA).

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. XEP-0313: Message Archive Management <http://xmpp.org/extensions/xep-0313.html>.

2. XEP-0045: Multi-User Chat <http://xmpp.org/extensions/xep-0045.html>.

3. RFC 6122: Extensible Messaging and Presence Protocol (XMPP): Address Format <http://tools.ietf.org/html/rfc6122>.

4. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

5. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

Version 0.2.1 (2015-09-22)

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


Version 0.2 (2015-09-18)


Version 0.1 (2015-07-14)

Initial published version approved by the XMPP Council.

(XEP Editor (mam))

Version 0.0.2 (2015-06-22)


Version 0.0.1 (2015-06-01)

First draft.