-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbasicprofile.html
More file actions
450 lines (446 loc) · 21.5 KB
/
Copy pathbasicprofile.html
File metadata and controls
450 lines (446 loc) · 21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset='utf-8'>
<title>Basic Profile for Social API Servers</title>
<script src='https://www.w3.org/Tools/respec/respec-w3c' async class='remove'></script>
<script class='remove'>
var respecConfig = {
specStatus: "unofficial",
group: "cg/socialcg",
shortName: "activitypub-api-basicprofile",
edDraftURI: "https://swicg.github.io/activitypub-api/basicprofile",
editors: [{
name: "Evan Prodromou",
company: "Social Web Foundation",
companyURL: "https://socialwebfoundation.org/",
w3cid: 43626
}],
github: {
repoURL: "https://github.com/swicg/activitypub-api",
branch: "main"
},
xref: ["web-platform", "html", "activitypub", "activitystreams-core", "activitystreams-vocabulary"],
includePermalinks: false,
};
</script>
<style>
table td,
table td * {
vertical-align: top;
}
</style>
</head>
<body>
<h1 id="title">Basic Profile for Social API
Servers</h1>
<section id='abstract'>
<h2>Abstract</h2>
<p>
ActivityPub defines a social API that is complementary and
interoperable with the ActivityPub federation protocol. This
document provides additional requirements for authorization and HTTP
access to achieve higher interoperability with client applications.
</p>
</section>
<section id='sotd'>
<p>This is an experimental specification and is undergoing regular
revisions.</p>
</section>
<section id='introduction'>
<h2>Introduction</h2>
<p>[[ActivityPub]] defines a read-write application programming interface (API) for social networking in its
sections on Objects, Actors, Collections, and Client-to-Server Interactions, called the <strong>social
API</strong>. Servers that implement the social API are <strong>social API servers</strong>.</p>
<p>
This document provides an additional profile of the social API to improve interoperability with API clients. The
profile adds responsibilities to the social API server, including support for authorization and HTTP request
semantics.
</p>
<p>
This profile covers a number of different type of client deployment:
<ul>
<li>Single-page Web application</li>
<li>Native clients, mobile and desktop</li>
<li>Command-line clients</li>
<li>Open Source or proprietary clients</li>
</ul>
</p>
<p>
This profile covers a number of different client use cases:
<ul>
<li>
A stream-oriented social application for publishing content, making social connections, viewing and reacting to
content from connected actors
</li>
<li>
A utility for making bulk updates to an actor's published content or to social connections
</li>
<li>
Integration with a video game to share progress, screenshots or achievements
</li>
<li>
Integration with an enterprise application to share files or comments
</li>
<li>
A search utility to find relevant content from the actor's connections
</li>
<li>
A web content collection, like a blog or a remote social server, that can be browsed and reacted to
</li>
</ul>
</p>
<p>
In this model, applications act on behalf of, and with the informed consent of, a single actor.
</p>
<p>
Unless otherwise specified, in this document <em>server</em> means a Social API server.
</p>
</section>
<section id='activitypub'>
<h2>ActivityPub</h2>
<p>
This profile provides additional restrictions and requirements for the [[ActivityPub]] social API.
</p>
<section id='objects'>
<h3>Objects</h3>
<p>Social API servers SHOULD provide unique, dereferenceable https: URIs for
ActivityPub object IDs.</p>
</section>
<section id='collections'>
<h3>Collections</h3>
<p>Social API servers SHOULD provide an <code>inbox</code> collection that
accepts the <code>GET</code> HTTP method. Social API servers SHOULD allow actors to read their own <code>inbox</code> collection.</p>
<p>Social API servers SHOULD provide an <code>outbox</code> collection that
accepts the <code>POST</code> HTTP method.</p>
</section>
<section id='client-to-server'>
<h3>Client-to-Server Interactions</h3>
<p>Social API servers SHOULD allocate unique, dereferenceable https: URIs for
all activities created by client-to-server interactions.</p>
<p>Social API servers SHOULD implement the behaviour defined for all activity
types listed in the Client to Server Interactions section.</p>
<p>Social API servers SHOULD support the Create, Update and Delete activity
types for these common Web content object types: Article, Audio,
Image, Note, Video.</p>
<p>Social API servers SHOULD support the Create, Update and Delete activity
types for the Collection and OrderedCollection types.</p>
<p>Social API servers SHOULD support the Add and Remove activity types for
these common Web content object types: Article, Audio, Image, Note,
Video.</p>
<p>Social API servers SHOULD support the Add and Remove activity types for
actor objects.</p>
<p>Social API servers SHOULD support the Update activity type by the
authenticated user for their own actor object to change or add
properties of the actor.</p>
<p>Social API servers SHOULD store and distribute activities with other types
from the Activity Vocabulary or extension vocabularies. Servers MAY
implement side-effects of activities with these types.</p>
</section>
<section id='media-upload'>
<h3>Media Upload</h3>
<p>Social API servers SHOULD support the <a
href="https://www.w3.org/wiki/SocialCG/ActivityPub/MediaUpload">MediaUpload</a> endpoint. Social API servers SHOULD
accept, store, and distribute common Web binary file formats, including images, audio, and video.</p>
</section>
<section id='remote-object-access'>
<h3>Remote object access</h3>
<p>Social API servers SHOULD provide a <a href="https://www.w3.org/TR/activitypub/#proxyUrl">proxyUrl</a>
endpoint.</p>
</section>
</section>
<section id='oauth'>
<h2>OAuth 2.0</h2>
<p>[[rfc6749]] defines methods and protocols for granting access to
resources. In the OAuth 2.0 Authorization Framework, ActivityPub
social API servers act as a <em>resource server</em>. ActivityPub
social API servers MAY designate a separate server as an
<strong>authorization server</strong>, as defined by the OAuth 2.0 Authorization Framework, or act as their own authorization
server.
</p>
<p>
Social API servers MUST support [[rfc6750]] to
control access to ActivityPub objects, actors, and collections by actors with an id on the server.
</p>
<section id='discovery'>
<h3>Discovery</h3>
<p>Social API servers MAY use [[rfc9728]] to designate
an authorization server. If such an external authorization server
is not designated, Social API servers SHOULD act as
their own authorization server.</p>
<p>Authorization servers SHOULD use [[rfc8414]] to provide
authorization server metadata. The metadata SHOULD include:</p>
<ul>
<li><code>authorization_endpoint</code></li>
<li><code>token_endpoint</code></li>
<li><code>scopes_supported</code></li>
<li><code>response_types_supported</code></li>
<li><code>grant_types_supported</code></li>
<li><code>code_challenge_methods_supported</code></li>
<li><code>token_endpoint_auth_methods_supported</code></li>
<li>One or more of: <code>client_id_metadata_document_supported</code>,
<code>activitypub_object_id_as_client_id</code>, or <code>registration_endpoint</code>
</li>
</ul>
<p>Social API servers MAY use ActivityPub actor endpoints to
declare the <code>oauthAuthorizationEndpoint</code>, <code>oauthTokenEndpoint</code>, and
<code>oauthRegistrationEndpoint</code>.
</p>
</section>
<section id='flow'>
<h3>Flows</h3>
<p>Authorization servers MUST support the <a
href="https://datatracker.ietf.org/doc/html/rfc6749#section-4.1">authorization
code grant</a>.</p>
<p>Authorization servers SHOULD support the <a
href="https://datatracker.ietf.org/doc/html/rfc6749#section-6">refresh
token grant</a>.</p>
</section>
<section id='client-id'>
<h3>Client IDs</h3>
<p>Authorization servers SHOULD support <a
href="https://datatracker.ietf.org/doc/draft-ietf-oauth-client-id-metadata-document/">
Client ID Metadata Document</a> (CIMD) URLs as client ID.
Authorization servers SHOULD declare support for CIMD in the
authorization server metadata.</p>
<p>Authorization servers MAY support <a
href="https://codeberg.org/fediverse/fep/src/branch/main/fep/d8c2/fep-d8c2.md">
FEP-d8c2</a> URLs as client IDs. Authorization servers SHOULD
declare support for FEP-d8c2 in the authorization server metadata
and in the actor object.</p>
<p>Authorization servers MAY support [[rfc7591]] for dynamic client
registration (DCR). Authorization servers that support DCR SHOULD
declare the registration endpoint in the authorization server
metadata and in the actor object.</p>
</section>
<section id='scopes'>
<h3>Scopes</h3>
<p>Authorization servers MAY support the following scope
identifiers.</p>
<table>
<tr>
<th>Scope identifier</th>
<th>Title</th>
<th>Meaning</th>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readall</td>
<td>Read all your data</td>
<td>Read any data for the user, including their profile, standard collections, content.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readany</td>
<td>Read data on any server</td>
<td>Read data on the user's home server, however that is defined, and use <code>proxyUrl</code> to access data on other servers with the user's authorization.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readown</td>
<td>Read data on its own server</td>
<td>Read data on the client's own server, with the same domain as the the client's CIMD identity.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readlocal</td>
<td>Read data on your server</td>
<td>Read data on the user's home server, however that is defined.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readinbox</td>
<td>Read your inbox feed</td>
<td>Read the actor's <code>inbox</code> collection and collection pages, and any activities in that collection, including activities from remote servers, and their properties, like <code>actor</code> and <code>object</code>.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readoutbox</td>
<td>Read your outbox feed</td>
<td>Read the actor's <code>outbox</code> collection and collection pages, and any activities in that collection, and their properties, like <code>actor</code> and <code>object</code>.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readfollowers</td>
<td>See who follows you</td>
<td>Read the actor's <code>followers</code> collection and collection pages, and any actors in that collection.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readfollowing</td>
<td>See who you follow</td>
<td>Read the actor's <code>following</code> collection and collection pages, and any actors in that collection.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#readliked</td>
<td>See what you've liked</td>
<td>Read the actor's <code>liked</code> collection and collection pages, and any objects in that collection.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#createcontent</td>
<td>Create new content</td>
<td>Make new notes, articles, images, videos, or audio.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#updatecontent</td>
<td>Edit existing content</td>
<td>Update existing notes, articles, images, videos, or audio, whether or not they were created with the same client.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#deletecontent</td>
<td>Delete content</td>
<td>Delete existing notes, articles, images, videos, or audio, whether or not they were created with the same client.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#follow</td>
<td>Follow and unfollow accounts</td>
<td>Follow local and remote accounts. Unfollow local and remote accounts.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#managefollowers</td>
<td>Accept, reject, and remove followers</td>
<td>Accept and reject local and remote follow requests. Remove local and remote followers.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#managecollections</td>
<td>Add items to and remove items from collections</td>
<td>For user-managed collections, add and remove items.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#like</td>
<td>Like and unlike content</td>
<td>Like notes, articles, video, audio, images, and other content. Undo those likes.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#share</td>
<td>Share and unshare content</td>
<td>Announce notes, articles, video, audio, images, and other content. Announce any activities. Undo those announcements.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#block</td>
<td>Block and unblock accounts</td>
<td>Block local and remote actors. Undo those blocks.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#flag</td>
<td>Report accounts</td>
<td>Flag local and remote accounts to the user's moderators and/or the accounts' moderators.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#reactlocal</td>
<td>Interact with content on your server</td>
<td>Like, announce, and reply to notes, articles, video, audio and images and other content on the actor's own server.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#reactany</td>
<td>Interact with content on any server</td>
<td>Like, announce, and reply to notes, articles, video, audio and images and other content on the actor's own server or remote servers.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#reactown</td>
<td>Interact with content on its own server</td>
<td>Like, announce, and reply to notes, articles, video, audio and images and other content on the same server as the CIMD identity of the client.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#addressall</td>
<td>Post to anyone</td>
<td>The client can include any addressee in the <code>to</code>, <code>cc</code>, <code>bcc</code>, <code>bto</code> or <code>audience</code> properties of a new activity.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#addresspublic</td>
<td>Post publicly</td>
<td>The client can include <code>as:Public</code> in the <code>to</code>, <code>cc</code>, <code>bcc</code>, <code>bto</code> or <code>audience</code> properties of a new activity.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#addressactor</td>
<td>Post privately</td>
<td>The client can include other actor's ids in the <code>to</code>, <code>cc</code>, <code>bcc</code>, <code>bto</code> or <code>audience</code> properties of a new activity.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#addressfollowers</td>
<td>Post to your followers</td>
<td>The client can include the actor's <code>followers</code> collection in the <code>to</code>, <code>cc</code>, <code>bcc</code>, <code>bto</code> or <code>audience</code> properties of a new activity.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#uploadfiles</td>
<td>Upload files</td>
<td>The client can use the MediaUpload endpoint.</td>
</tr>
<tr>
<td>https://swicg.github.io/activitypub-api/scopes#updateprofile</td>
<td>Change your profile, including your avatar</td>
<td>The client can update the actor's profile, adding or removing any properties in the profile, including the <code>icon</code> property.</td>
</tr>
</table>
</section>
<section id='pkce'>
<h3>PKCE</h3>
<p>Authorization servers SHOULD support [[rfc7636]] (PKCE) for
public clients. Authorization servers that support PKCE SHOULD
support the <code>S256</code> challenge method, and SHOULD declare
support for the S256 challenge method in the authorization server
metadata.</p>
</section>
<section id='identity'>
<h3>Authorized actor identity</h3>
<p>The authorization server MUST provide the ActivityPub actor id
of the authenticated user to the client.</p>
<p>The authorization server SHOULD include an
<code>activitypub_actor_id</code> property in the token endpoint
results. This is the https: URL for the ActivityPub actor ID.
</p>
<p>The authorization server MAY use [[rfc7519]] for the
<code>access_token</code>. If so, it MUST use the ActivityPub actor
ID as the <code>sub</code> claim.
</p>
<p>The authorization server MAY support <a href="https://openid.net/specs/openid-connect-core-1_0.html">OpenID
Connect</a>. If so, it MUST use the ActivityPub actor ID as the
<code>sub</code> claim in the UserInfo endpoint.
</p>
</section>
</section>
<section id="http">
<h2>HTTP</h2>
<p>This profile adds requirements and restrictions to the HTTP interactions of the social API server.</p>
<section id='status'>
<h3>HTTP Status</h3>
<p>Social API servers SHOULD use [[rfc9457]] to indicate problems or successful HTTP status details.</p>
<p>Social API servers MAY use <a
href="https://codeberg.org/fediverse/fep/src/branch/main/fep/c180/fep-c180.md">FEP-c180</a> to provide
ActivityPub-specific problem details.</p>
</section>
<section id='cors'>
<h3>Cross-origin Resource Sharing (CORS)</h3>
<p>Social API servers SHOULD support [[CORS]], including CORS pre-flight requests.</p>
<p>Social API servers SHOULD allow access to all origins ('*') with the <a
href="https://fetch.spec.whatwg.org/#http-access-control-allow-origin">Access-Control-Allow-Origin</a> header.
</p>
</section>
<section id='caching'>
<h3>Caching</h3>
<p>Social API servers SHOULD support [[rfc9111]] for HTTP caching.</p>
</section>
<section id='rate-limiting'>
<h3>Rate Limiting</h3>
<p>
Social API servers MAY limit API requests by any conditions necessary. Servers MAY have different rate limiting
policies for different types of requests, including but not limited to different HTTP methods, different types
of ActivityPub object, different ActivityPub collections, network conditions, time of day, calendar date,
different API clients, or different users.
</p>
<p>
Social API servers SHOULD support rate limits appropriate for interactive use of the server under typical social
network workloads. Social API servers SHOULD support different rate limits for sustained rate (average number of
requests over minutes or hours) and burst rate (a high number of requests in a few seconds, as when loading or
scrolling an inbox or followers collection).
</p>
<p>
Social API servers MUST use the <a href="https://datatracker.ietf.org/doc/html/rfc6585#section-4">429 Too Many
Requests</a> HTTP status code to indicate that the client has reached its rate limit. Social API servers SHOULD include
the <a href="https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3">Retry-After</a> header in the HTTP
response to indicate how long the client should wait.
</p>
<p>
Social API servers SHOULD use the <a
href="https://www.ietf.org/archive/id/draft-ietf-httpapi-ratelimit-headers-10.html">RateLimit header fields
for HTTP</a> to indicate rate limit policies, remaining request quotas, and quota reset times.
</p>
</section>
</section>
<section id='conformance'>
<!-- This section is filled automatically by ReSpec. -->
</section>
</body>
</html>