diff --git a/SWIPs/swip-draft_app_data_protocols.md b/SWIPs/swip-draft_app_data_protocols.md new file mode 100644 index 0000000..d6498ec --- /dev/null +++ b/SWIPs/swip-draft_app_data_protocols.md @@ -0,0 +1,119 @@ +--- +SWIP: +title: App data protocols +author: Paul Le Cam (@PaulLeCam) +discussions-to: https://beehive.ethswarm.org/swarm/channels/dappprotocols +status: Draft +type: Standards Track (Core, Networking, Interface) +category: Interface +created: 2019-08-06 +--- + + + +## Simple Summary + + + +App developers shouldn't have to reinvent the wheel when building on top of Swarm. + +## Abstract + + + +Apps built on top of Swarm share similar end-user needs, such as establishing contact with other users, sending messages, discovering files... + +This SWIP aims to define core data structures and protocols that can be implemented by any app using Swarm to support these needs. + +## Motivation + + + +User data is currently exploited by technology companies with little respect for privacy and security, let alone transparency about the usage they make of this data. +Even though data is generated by the users, it is usually not owned by them but rather the service providers that have incentives to use this as a way to lock-in their users. + +Swarm can provide an opportunity to shift this relationship between data ownership and services using this data by allowing users to store their data directly in Swarm, and grant access to the apps and services they choose. +The problem is then to define data formats that can be shared by different apps and services having different purposes, and protocols to ensure compatiblity and security between all the interested parties interacting with this data. + +Beyond end-user incentives of data ownership, shared formats and protocols can be beneficial to application and services developers as a way to get started faster with development on top of Swarm, and possibly access to existing user data. + +## Specification + + + +### Scope (WIP) + +- Should only rely on existing features of Swarm, but might evolve as new possibilities are added +- Should be usable via a HTTP gateway +- Should protect the user's security and privacy as much as possible, and document necessary trade-offs +- Should define core data structures and validation methods +- Should define custom extensions to core data structures +- Should define protocols for data authoring and discovery accross multiple apps/devices/services and between different users +- Should support versioning + +### Terminology (WIP) + +- Actor: human entity (person, group...) +- Agent: code acting on behalf of an Actor (app, device, service...) +- Resource: data accessible on Swarm + - File (any binary data) + - Entity (JSON data defined in spec) + - Source (single Entity or Entity feed) + - Publication (list of Sources) + +### Research areas (WIP) + +#### Data structure format + +- Should we use JSON or a binary format such as protocol buffers? +- What about validation? + +#### Entities extensibility + +- Can we restrict the spec to limited number of core Entities while allowing for more complex Entities to be added as extensions? +- Can we provide fallback types for complex Entities that would not be supported by a given client? +- What about validation of unknown (non-core or from supported extensions) Entities? + +#### Core entities and protocols + +- Define what entities should be part of core vs extensions. +- Define validation rules for these core entities. +- Define discover and exchange rules for these entities. + +#### Key management + +- How could an Actor add and remove (revoke) Agents and Resources at will? +- How could an Agent add and remove (if own) a Source from a Publication? + +#### Data encryption + +- Should a single algorithm or multiple ones be supported/recommended? +- Should Swarm built-in encryption and/or ACT be used? + +## Rationale + + + +TODO + +## Backwards Compatibility + + + +N/A + +## Test Cases + + + +TODO + +## Implementation + + + +TODO + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).