diff --git a/inbox/pubsub-file-sharing.xml b/inbox/pubsub-file-sharing.xml new file mode 100644 index 00000000..e5d48dcf --- /dev/null +++ b/inbox/pubsub-file-sharing.xml @@ -0,0 +1,235 @@ + + +%ents; +]> + + +
+ Pubsub File Sharing + This specification explains how to share files and optionally include directory structures similar to filesystems over XMPP Pubsub. It leverages XMPP Pubsub to enable notifications about file changes and manage permissions, providing users with real-time updates and control mechanisms. An optional mechanism is also specified for managing uploaded files. + &LEGALNOTICE; + xxxx + ProtoXEP + Standards Track + Standards + Council + + XMPP Core + XEP-0001 + XEP-0060 + XEP-0447 + + + + pubsub-relationships + + Jérôme + Poisson + goffi@goffi.org + goffi@jabber.fr + + + 0.0.1 + 2024-10-19 + jp +

First draft.

+
+
+ + + +

File sharing is a foundational use case in XMPP, with numerous attempts to facilitate the sharing of file hierarchies. Notable efforts include &xep0105;, &xep0135;, &xep0214;, and &xep0329;. However, these previous approaches often fall short in key areas, particularly in the realm of notifications, and/or use now-deprecated specifications. While &xep0214; is the only specification that supports file hierarchies with notifications, it has seen limited adoption and suffers from its reliance on an outdated stack and issues with &xep0248;, especially concerning permission management between collection and leaf nodes.

+

The current specification addresses these shortcomings by leveraging a more modern stack. It adapts &xep0447; to Pubsub for robust access management and notifications, and incorporates XEP-XXXX: Pubsub Node Relationships to handle hierarchical structures. This results in a flexible and easy-to-implement solution that supports a wide range of use cases, including server-based file hosting, ad-hoc or permanent per-device directory sharing, and gateways to other file-sharing protocols.

+
+ + +

The design goals of this XEP are:

+ +
+ + +

This section defines key terms used throughout this specification.

+ +
+ + +

Pubsub nodes represent directories, and files data are put in their items. The payload of the file items MUST be a <file-sharing> element, including metadata and sources, as specified in &xep0447;. The <file-sharing> element MUST NOT have a 'disposition' attribute as it doesn't make sense in the context of pubsub file sharing.

+
+ + +

To facilitate a clear and consistent approach to file sharing, this specification defines a well-known node for discovering shared files and a node/item naming convention. This ensures that files and directories can be easily identified and managed.

+ + +

Entities that support file sharing through this protocol MUST have a well-known node for discovering shared files. This node is defined as "urn:xmpp:pubsub-file-sharing:0".

+

When a user subscribes to this node using XEP-XXXX: Pubsub Extended Subscription, they will receive notifications for any new or deleted files and directories up to the requested depth. The node's items represent the shared files.

+

To discover file hierarchy, use XEP-XXXX: Pubsub Extended Discovery.

+ + + + + urn:xmpp:pubsub-ext-disco:0 + + + nodes + + + 1 + + + +]]> +
+ + +

To ensure a consistent and intuitive structure while maintaining unique node names across the pubsub service, the following naming convention is used for nodes and items:

+
    +
  • Root Node: The well-known node "urn:xmpp:pubsub-file-sharing:0" serves as the root of the file sharing structure.
  • +
  • Directory Nodes: Each directory is represented by a node with a name that reflects its path relative to the root. This node name follows the template "urn:xmpp:pubsub-file-sharing:0:<unique ID>/<directory name>, where <unique ID> is a unique identifier across the pubsub service and MUST NOT contain the "/" character. For example, a directory named "Documents" with a unique ID of "abc123" would be represented by the node "urn:xmpp:pubsub-file-sharing:0:abc123/Documents.
  • +
  • File Items: Each file is represented as an item within its corresponding directory node. The item's ID is the name of the file, and its payload contains metadata and source information for the file. For example, a file named "report.pdf" in the "Documents" directory (with unique ID "abc123") would be represented by the item "report.pdf", which is within the node "urn:xmpp:pubsub-file-sharing:0:abc123/Documents".
  • +
+

This convention allows for an easy mapping of file system structure to a pubsub node hierarchy, making it simple to navigate and manage shared files without encountering conflicts due to non-unique node names.

+
+
+ + +

This section specifies how metadata and file deletions are handled in the context of shared files and directories.

+ + +

Each file item includes metadata and source information. The metadata is provided using the file element as described in File metadata element (XEP-0446) XEP-0446: File metadata element <https://xmpp.org/extensions/xep-0446.html>.. The source information is provided using the sources element, which lists the available sources for the file.

+ + + + + + + image/jpeg + beach-sunset.jpg + 8765432 + GZTbL1pJmX9jzVgQwR0HfI+DyKuPcWvE2nUxYiMkS78= + A stunning sunset on the beach. + + + + + + + + + + + +]]> + +
+ + +

For services declaring support for this specification (as explained in the Discovering Support section), the following rules apply:

+
    +
  • When a mapped file is deleted or updated, the corresponding items SHOULD be deleted or updated accordingly.
  • +
  • Conversely, when an item in pubsub corresponding to a file is updated or retracted, the corresponding file SHOULD be updated or deleted accordingly.
  • +
  • When a directory is deleted, the mapped node SHOULD also be deleted accordingly.
  • +
  • When a directory is renamed, the mapped node SHOULD first be deleted and another one SHOULD be created with the new name. Additionally, the <redirect/> element SHOULD be used as specified in the XEP-0060: Delete a Node/Success Case.
  • +
+

A service MAY prohibit deletion or update of items based on its internal policy. In this case, the service MUST return a <forbidden> error and SHOULD use a human-readable explanation of the error.

+ +

If support for this specification is not advertised, it means that file sharing metadata are manually set by an XMPP client on a generic pubsub service. In such cases, the mapping cannot be performed by the pubsub service and there is no guarantee of synchronization between files and metadata.

+
+ +
+ + +

File sharing can optionally use end-to-end encryption. For file metadata, this can be achieved at the pubsub level using specifications such as &xep0473; or &xep0477; or any relevant mechanism. For file transfers, this is dependent on the chosen source, and specifications such as &xep0391; with &xep0396; could be used.

+
+ + +

This specification introduces predefined nodes for special directories that MAY be used by pubsub services. Other specifications MAY define additional well-known nodes as needed. If these directories are implemented, they SHOULD be attached to the root node "urn:xmpp:pubsub-file-sharing:0".

+ +

The only explicitly defined directory in this specification is the 'Uploaded' directory. This directory MUST use the node named "urn:xmpp:pubsub-file-sharing:0:/uploaded", where the unique ID field is intentionally left blank. The purpose of the 'Uploaded' directory is to track files uploaded via specifications such as &xep0363;. It enables end-users to view and manage their uploaded files (e.g., for deletion purposes), typically through the PEP service associated with each user.

+
+ + +

The following business rules apply to the file sharing protocol:

+ +
+ + +

If an entity supports sharing files through the protocol specified in this XEP, it MUST advertise it by including the "urn:xmpp:pubsub-file-sharing:0" discovery feature in response to a &xep0030; information request.

+ + +]]> + + + ... + + ... + +]]> +

When declaring support for this protocol, a pubsub service MUST manage a mapping between files and pubsub nodes.

+

Alternatively, XMPP clients can use this specification by filling in metadata related to files on any generic pubsub service. In such cases, there is no need to advertise support at the discovery level. File sharing nodes are identified either by searching for the well-known node 'urn:xmpp:pubsub-file-sharing:0' or any other node that starts with a similar prefix.

+ +
+ + +

The following security considerations apply to the file sharing protocol:

+ +
+ + +

This document does not require interaction with &IANA;.

+
+ + +

TODO

+
+ + +

Thanks to NLNet foundation/NGI Zero Core for funding the work on this specification.

+
+ +