D5.1 Apis and Interfaces for Decentralised Social Interaction Over the Web
Total Page:16
File Type:pdf, Size:1020Kb
INNOVATION ACTION H2020 GRANT AGREEMENT NUMBER: 825171 WP5 – Integration, Deployment and Evaluation D5.1 APIs and interfaces for decentralised social interaction over the Web Document Info Contractual Delivery Date: 29/02/2020 Actual Delivery Date: 27/02/2020 Responsible Beneficiary: UWA Contributing Beneficiaries: SIMAVI, EGR Dissemination Level: Public Version: 1.2 Type: Final This project has received funding from the European Union’s H2020 research and innovation programme under the grant agreement No 825171 ` DOCUMENT INFORMATION Document ID: D5.1: APIs and interfaces for decentralised social interaction over the Web Version Date: 27/02/2020 Total Number of Pages: 37 Abstract: Prototype implementation of the Web-based APIs and interfaces for retrieving/publishing information to decentralised social interaction, offered as extensions to the opensource software of Mastodon and Diaspora*, enabling the integration of EUNOMIA platform with decentralised online social networks. Keywords: Web-based APIs, Decentralised Social Networks AUTHORS Full Name Beneficiary / Organisation Role University of West Attica UWA Overall Editor SIVECO / SIMAVI SIV / SIMAVI Contributor Eugen Rochko EGR Contributor REVIEWERS Full Name Beneficiary / Organisation Date SIMAVI SIMAVI 24/02/2020 VERSION HISTORY Version Date Comments 0.1 15/11/2019 First draft of the ToC 0.2 30/11/2019 ToC update, Partners Assignment 0.3 13/01/2020 Section 3 completed 0.4 27/01/2020 Section 4 completed 0.5 02/02/2020 Section 1 completed 0.6 16/02/2020 Section 2.1 completed 0.7 19/02/2020 Section 2.2 completed 1.0 21/02/2020 Prefinal version for internal review 1.1 24/02/2020 Internal review version 1.2 27/02/2020 Final version Type of deliverable PUBLIC Page | 2 H2020 Grant Agreement Number: 825171 Document ID: WP5/ D5.1 EXECUTIVE SUMMARY This deliverable aims at providing details regarding the open-source API of Mastodon and the one we developed for Diaspora*. These two APIs were utilized in order to implement the necessary integration of EUNOMIA platform with decentralised online social networks, thus, this deliverable can be considered as a manual for interfacing (client-to-server) EUNOMIA with Mastodon and Diaspora*. Moreover, we designed and implemented a server-to-server communication based on the ActivityPub, which is a W3C decentralised social networking protocol based upon the ActivityStreams format. This federated server-to-server interaction relies on JSON-LD based API that we developed and can interact with any decentralised social network as long as it uses an ActivityPub server. @Copyright of EUNOMIA Consortium Page iii ` TABLE OF CONTENTS DOCUMENT INFORMATION ........................................................................................................ ii AUTHORS ......................................................................................................................................... ii REVIEWERS ...................................................................................................................................... ii VERSION HISTORY ......................................................................................................................... ii Executive Summary ....................................................................................................................... iii Table of Contents .......................................................................................................................... iv LIST of Figures ................................................................................................................................ iv LIST of Tables .................................................................................................................................. v List of Acronyms and Abbreviations........................................................................................... vi 1. INTRODUCTION ..................................................................................................................... 1 1.1 Scope and objectives of the deliverable ................................................................................. 1 1.2 Structure of the deliverable ...................................................................................................... 1 1.3 Relation to Other Tasks and Deliverables .............................................................................. 1 2. Distributed Social Networks APIs ....................................................................................... 2 2.1 Mastodon (UWA) ........................................................................................................................ 2 2.2 Diaspora* ..................................................................................................................................... 7 3. ActivityPub Protocol ........................................................................................................... 20 4. Server-to-server Communication ..................................................................................... 22 4.1 Development methodology .................................................................................................. 22 4.2 Design ....................................................................................................................................... 22 4.3 Development ............................................................................................................................ 23 4.4 Deployment .............................................................................................................................. 29 4.5 Testing ....................................................................................................................................... 32 5. CONCLUSIONS .................................................................................................................... 35 6. References ............................................................................................................................ 36 LIST OF FIGURES Figure 1: Mastodon Status HTTP Response ....................................................................................................... 7 Type of deliverable PUBLIC Page | 4 H2020 Grant Agreement Number: 825171 Document ID: WP5/ D5.1 Figure 2. New API for Diaspora interfacing an instance or pod of Diaspora with Digital Companion .......................................................................................................................................................................................... 8 Figure 3. Reading a comment of a post from a Diaspora pod ................................................................. 17 Figure 4. Retrieving a post from a Diaspora pod .......................................................................................... 18 Figure 5. Creating a post in a Diaspora pod ................................................................................................... 19 Figure 6. ActivityPub actor example [1] ............................................................................................................ 20 Figure 7. Created activity by the server [1] ....................................................................................................... 21 Figure 8. Development Methodology .............................................................................................................. 22 Figure 9. EUNOMIA server-to-server Architecture....................................................................................... 23 Figure 10. Source Code for posts discovery ................................................................................................... 28 Figure 11. Source code for user discovery ....................................................................................................... 29 Figure 12. NodeJS application dockerfile (EUNOMIA Node) .................................................................... 30 Figure 13. EUNOMIA Node Dependencies ..................................................................................................... 30 Figure 14. Docker-compose configuration file ............................................................................................... 31 Figure 15. Nginx configuration file ..................................................................................................................... 32 Figure 16. Vulnerabilities results from testssl.................................................................................................. 33 Figure 17. Security Headers .................................................................................................................................. 33 Figure 18. Results from static code analysis .................................................................................................... 33 Figure 19. Authorized request to EUNOMIA Node ...................................................................................... 34 Figure 20. Unauthorized request to EUNOMIA Node ................................................................................ 34 LIST OF TABLES Table 1: Mastodon Account entity [6] .................................................................................................................. 2 Table 2: Mastodon Status entity [6] ....................................................................................................................