forked from w3c/activitypub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
2436 lines (2286 loc) · 102 KB
/
index.html
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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>ActivityPub</title>
<meta charset="utf-8">
<script src="https://www.w3.org/Tools/respec/respec-w3c-common"
async class="remove"></script>
<script class="remove">
var respecConfig = {
specStatus: "ED",
publishDate: "2018-01-23",
previousPublishDate: "2018-01-23",
previousMaturity: "REC",
license: "w3c-software-doc",
shortName: "activitypub",
wg: "Social Web Working Group",
wgURI: "https://www.w3.org/Social/WG",
wgPublicList: "public-socialweb",
wgPatentURI: "https://www.w3.org/2004/01/pp-impl/72531/status",
edDraftURI: "https://w3c.github.io/activitypub/",
testSuiteURI: "https://test.activitypub.rocks/",
errata: "https://www.w3.org/wiki/ActivityPub_errata",
implementationReportURI: "https://activitypub.rocks/implementation-report",
otherLinks: [
{
"key": "Repository",
"data": [
{
"value": "Git repository",
"href": "https://github.com/w3c/activitypub",
},
{
"value": "Issues",
"href": "https://github.com/w3c/activitypub/issues",
},
{
"value": "Commits",
"href": "https://github.com/w3c/activitypub/commits/gh-pages",
}
]
}
],
editors: [
{
name: "Christopher Lemmer Webber",
url: "https://dustycloud.org/",
w3cid: "57007"
},
{
name: "Jessica Tallon",
url: "https://tsyesika.se",
w3cid: "72695"
},
],
authors: [
{
name: "Christopher Lemmer Webber",
url: "https://dustycloud.org/"
},
{
name: "Jessica Tallon",
url: "https://tsyesika.se"
},
{
name: "Erin Shepherd",
url: "http://erinshepherd.net/"
},
{
name: "Amy Guy",
url: "https://rhiaro.co.uk/"
},
{
name: "Evan Prodromou",
url: "https://en.wikipedia.org/wiki/Evan_Prodromou"
}
],
localBiblio: {
"ActivityStreams": {
title: "Activity Streams 2.0",
href: "https://www.w3.org/TR/activitystreams-core/",
authors: [
"J. Snell",
],
status: "Editors Draft",
publisher: "ActivityStreams Working Group",
},
"Activity-Vocabulary": {
title: "Activity Vocabulary",
href: "https://www.w3.org/TR/activitystreams-vocabulary/",
authors: [
"J. Snell",
],
status: "Editors Draft",
publisher: "ActivityStreams Working Group",
},
"OAuth-Server-Metadata": {
title: "OAuth 2.0 Authorization Server Metadata",
href: "https://tools.ietf.org/html/draft-ietf-oauth-discovery-06",
authors: [
"M. Jones",
"N. Sakimura",
"J. Bradley"
],
status: "Internet-Draft",
publisher: "OAuth Working Group",
},
},
};
</script>
<style type="text/css">
img {
max-width: 100%;
}
</style>
</head>
<!-- STYLISTIC NOTE: This document wraps on column 79 and at the end of every
sentence. -->
<body>
<section id="abstract">
<p>
The ActivityPub protocol is a decentralized social networking protocol
based upon the [[!ActivityStreams]] 2.0 data format.
It provides a client to server API for creating, updating and deleting
content, as well as a federated server to server API for delivering
notifications and content.
</p>
</section>
<section id="sotd">
</section>
<section id="Overview">
<h2>Overview</h2>
<p>ActivityPub provides two layers:</p>
<ul>
<li>
<b>A server to server federation protocol</b>
(so decentralized websites can share information)
</li>
<li>
<b>A client to server protocol</b>
(so users, including real-world users, bots, and other automated processes,
can communicate with ActivityPub using their accounts on servers,
from a phone or desktop or web application or whatever)
</li>
</ul>
<p>
ActivityPub implementations can implement just one of these things or
both of them.
However, once you've implemented one, it isn't too many steps to
implement the other, and there are a lot of benefits to both (making
your website part of the decentralized social web, and being able to
use clients and client libraries that work across a wide variety of
social websites).
</p>
<p>
In ActivityPub, a user is represented by "<a href="#actors">actors</a>"
via the user's accounts on servers.
User's accounts on different servers correspond to different actors.
Every Actor has:
</p>
<ul>
<li><b>An <code>inbox</code>:</b> How they get messages from the world</li>
<li><b>An <code>outbox</code>:</b> How they send messages to others</li>
</ul>
<p>
<img src="illustration/tutorial-1.png"
alt="Actor with inbox and outbox" />
</p>
<p>
These are endpoints, or really, just URLs which are listed in the
ActivityPub actor's ActivityStreams description.
(More on ActivityStreams later).
</p>
<p>
Here's an example of the record of our friend Alyssa P. Hacker:
</p>
<pre class="example highlight json">
{"@context": "https://www.w3.org/ns/activitystreams",
"type": "Person",
"id": "https://social.example/alyssa/",
"name": "Alyssa P. Hacker",
"preferredUsername": "alyssa",
"summary": "Lisp enthusiast hailing from MIT",
"inbox": "https://social.example/alyssa/inbox/",
"outbox": "https://social.example/alyssa/outbox/",
"followers": "https://social.example/alyssa/followers/",
"following": "https://social.example/alyssa/following/",
"liked": "https://social.example/alyssa/liked/"}
</pre>
<p>
ActivityPub uses [[!ActivityStreams]] for its vocabulary.
This is pretty great because ActivityStreams includes all the common
terms you need to represent all the activities and content flowing
around a social network.
It's likely that ActivityStreams already includes all the vocabulary
you need, but even if it doesn't, ActivityStreams can be extended
via [[!JSON-LD]].
If you know what JSON-LD is, you can take advantage of the cool linked
data approaches provided by JSON-LD.
If you don't, don't worry, JSON-LD documents and ActivityStreams can be
understood as plain old simple JSON.
(If you're going to add extensions, that's the point at which JSON-LD
really helps you out).
</p>
<p>
So, okay.
Alyssa wants to talk to her friends, and her friends want to talk to
her!
Luckily these "inbox" and "outbox" things can help us out.
They both behave differently for GET and POST.
Let's see how that works:
</p>
<p>
<img src="illustration/tutorial-2.png"
alt="Actor with messages flowing from rest of world to inbox and from outbox to rest of world" />
</p>
<p>
Hey nice, so just as a recap:
</p>
<ul>
<li>
You can POST to someone's inbox to send them a message
(server-to-server / federation only... this <em>is</em> federation!)
</li>
<li>
You can GET from your inbox to read your latest messages
(client-to-server; this is like reading your social
network stream)
</li>
<li>
You can POST to your outbox to send messages to the world
(client-to-server)
</li>
<li>
You can GET from someone's outbox to see what messages they've
posted (or at least the ones you're authorized to see).
(client-to-server and/or server-to-server)
</li>
</ul>
<p>
Of course, if that last one (GET'ing from someone's outbox) was the
only way to see what people have sent, this wouldn't be a very
efficient federation protocol!
Indeed, federation happens usually by servers posting messages sent by
actors to actors on other servers' inboxes.
</p>
<p>
Let's see an example!
Let's say Alyssa wants to catch up with her friend, Ben Bitdiddle.
She lent him a book recently and she wants to make sure he returns it
to her.
Here's the message she composes, as an ActivityStreams object:
</p>
<pre class="example highlight json">
{"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"to": ["https://chatty.example/ben/"],
"attributedTo": "https://social.example/alyssa/",
"content": "Say, did you finish reading that book I lent you?"}
</pre>
<p>
This is a note addressed to Ben.
She POSTs it to her outbox.
</p>
<p>
<img src="illustration/tutorial-3.png"
alt="Actor posting message to outbox" />
</p>
<p>
Since this is a non-activity object, the server recognizes that this is
an object being newly created, and does the courtesy of wrapping it in
a Create activity.
(Activities sent around in ActivityPub generally follow the pattern of
some activity by some actor being taken on some object.
In this case the activity is a Create of a Note object, posted by a
Person).
</p>
<pre class="example highlight json">
{"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://social.example/alyssa/posts/a29a6843-9feb-4c74-a7f7-081b9c9201d3",
"to": ["https://chatty.example/ben/"],
"actor": "https://social.example/alyssa/",
"object": {"type": "Note",
"id": "https://social.example/alyssa/posts/49e2d03d-b53a-4c4c-a95c-94a6abf45a19",
"attributedTo": "https://social.example/alyssa/",
"to": ["https://chatty.example/ben/"],
"content": "Say, did you finish reading that book I lent you?"}}
</pre>
<p>
Alyssa's server looks up Ben's ActivityStreams actor object, finds his
inbox endpoint, and POSTs her object to his inbox.
</p>
<p>
<img src="illustration/tutorial-4.png"
alt="Server posting to remote actor's inbox" />
</p>
<p>
Technically these are two separate steps... one is client to server
communication, and one is server to server communication (federation).
But, since we're using them both in this example, we can abstractly
think of this as being a streamlined submission from outbox to inbox:
</p>
<p>
<img src="illustration/tutorial-5.png"
alt="Note flowing from one actor's outbox to other actor's inbox" />
</p>
<p>
Cool!
A while later, Alyssa checks what new messages she's gotten.
Her phone polls her inbox via GET, and amongst a bunch of cat videos
posted by friends and photos of her nephew posted by her sister, she
sees the following:
</p>
<pre class="example highlight json">
{"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://chatty.example/ben/p/51086",
"to": ["https://social.example/alyssa/"],
"actor": "https://chatty.example/ben/",
"object": {"type": "Note",
"id": "https://chatty.example/ben/p/51085",
"attributedTo": "https://chatty.example/ben/",
"to": ["https://social.example/alyssa/"],
"inReplyTo": "https://social.example/alyssa/posts/49e2d03d-b53a-4c4c-a95c-94a6abf45a19",
"content": "<p>Argh, yeah, sorry, I'll get it back to you tomorrow.</p>
<p>I was reviewing the section on register machines,
since it's been a while since I wrote one.</p>"}}
</pre>
<p>Alyssa is relieved, and likes Ben's post:</p>
<pre class="example highlight json">
{"@context": "https://www.w3.org/ns/activitystreams",
"type": "Like",
"id": "https://social.example/alyssa/posts/5312e10e-5110-42e5-a09b-934882b3ecec",
"to": ["https://chatty.example/ben/"],
"actor": "https://social.example/alyssa/",
"object": "https://chatty.example/ben/p/51086"}
</pre>
<p>
She POSTs this message to her outbox.
(Since it's an activity, her server knows it doesn't need to wrap it in
a Create object).
</p>
<p>
Feeling happy about things, she decides to post a public message to her
followers.
Soon the following message is blasted to all the members of her
followers collection, and since it has the special Public group
addressed, is generally readable by anyone.
</p>
<pre class="example highlight json">
{"@context": "https://www.w3.org/ns/activitystreams",
"type": "Create",
"id": "https://social.example/alyssa/posts/9282e9cc-14d0-42b3-a758-d6aeca6c876b",
"to": ["https://social.example/alyssa/followers/",
"https://www.w3.org/ns/activitystreams#Public"],
"actor": "https://social.example/alyssa/",
"object": {"type": "Note",
"id": "https://social.example/alyssa/posts/d18c55d4-8a63-4181-9745-4e6cf7938fa1",
"attributedTo": "https://social.example/alyssa/",
"to": ["https://social.example/alyssa/followers/",
"https://www.w3.org/ns/activitystreams#Public"],
"content": "Lending books to friends is nice. Getting them back is even nicer! :)"}}
</pre>
<section id="social-web-working-group" inlist="" rel="schema:hasPart"
resource="#social-web-working-group">
<h3 property="schema:name">Social Web Working Group</h3>
<div datatype="rdf:HTML" property="schema:description">
<p>
<a href="#Overview">ActivityPub</a> is one of several related
specifications being produced by the Social Web Working Group.
Implementers interested in alternative approaches and complementary
protocols should review [[Micropub]] and the overview document
[[Social-Web-Protocols]].
</p>
</div>
</section>
</section>
<section id="conformance">
<section id="specification-profiles">
<h2>Specification Profiles</h2>
<p>
This specification defines two closely related and interacting
protocols:
</p>
<dl>
<dt>A client to server protocol, or "Social API"</dt>
<dd>
This protocol permits a client to act <i>on behalf</i> of a user.
For example, this protocol is used by a mobile phone application to
interact with a social stream of the user's actor.
</dd>
<dt>A server to server protocol, or "Federation Protocol"</dt>
<dd>
This protocol is used to distribute activities between actors on
different servers, tying them into the same social graph.
</dd>
</dl>
<p>
The ActivityPub specification is designed so that once either of
these protocols are implemented, supporting the other is of very
little additional effort.
However, servers may still implement one without the other.
This gives three conformance classes:
</p>
<dl>
<dt>ActivityPub conformant Client</dt>
<dd>
This designation applies to any implementation of the entirety of the
client portion of the client to server protocol.
</dd>
<dt>ActivityPub conformant Server</dt>
<dd>
This designation applies to any implementation of the entirety of the
server portion of the client to server protocol.
</dd>
<dt>ActivityPub conformant Federated Server</dt>
<dd>
This designation applies to any implementation of the entirety of
the federation protocols.
</dd>
</dl>
<p>
It is called out whenever a portion of the specification only applies
to implementation of the federation protocol.
In addition, whenever requirements are specified, it is called out
whether they apply to the client or server (for the client-to-server
protocol) or whether referring to a sending or receiving server in
the server-to-server protocol.
</p>
</section>
</section>
<section id="obj">
<h2>Objects</h2>
<p>
Objects are the core concept around which both [[!ActivityStreams]] and
ActivityPub are built.
Objects are often wrapped in Activities and are contained in streams of
Collections, which are themselves subclasses of Objects.
See the [[!Activity-Vocabulary]] document, particularly the
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#types">Core Classes</a>;
ActivityPub follows the mapping of this vocabulary very closely.
</p>
<p>
ActivityPub defines some terms in addition to those provided by
ActivityStreams.
These terms are provided in the ActivityPub
<a href="http://www.w3.org/TR/json-ld/#the-context">JSON-LD context</a>
at
<code>https://www.w3.org/ns/activitystreams</code>.
Implementers SHOULD include the ActivityPub context in their
object definitions.
Implementers MAY include additional context as appropriate.
</p>
<p>
ActivityPub shares the same
<a href="https://www.w3.org/TR/activitystreams-core/#urls">
URI / IRI conventions as in ActivityStreams</a>.
</p>
<p>
Servers SHOULD validate the content they receive to avoid content
spoofing attacks.
(A server should do something at least as robust as checking that
the object appears as received at its origin, but mechanisms
such as checking signatures would be better if available).
No particular mechanism for verification is authoritatively specified by
this document, but please see <a href="#security-considerations">Security
Considerations</a> for some suggestions and good practices.
</p>
<div class="informative">
As an example, if example.com receives the activity
<pre class="example">
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Like",
"actor": "https://example.net/~mallory",
"to": ["https://hatchat.example/sarah/",
"https://example.com/peeps/john/"],
"object": {
"@context": {"@language": "en"},
"id": "https://example.org/~alice/note/23",
"type": "Note",
"attributedTo": "https://example.org/~alice",
"content": "I'm a goat"
}
}
</pre>
it should dereference the <code>id</code> both to ensure that it exists
and is a valid object, and that it is not misrepresenting the object.
(In this example, Mallory could be spoofing an object allegedly posted
by Alice).
</div>
<section id="obj-id">
<h2>Object Identifiers</h2>
<p>
All Objects in [[!ActivityStreams]] should have unique global
identifiers.
ActivityPub extends this requirement; all objects distributed by the
ActivityPub protocol MUST have unique global identifiers, unless they
are intentionally transient (short lived activities that are not
intended to be able to be looked up, such as some kinds of chat
messages or game notifications).
These identifiers must fall into one of the following groups:
</p>
<ol>
<li>
Publicly dereferencable URIs, such as HTTPS URIs, with their
authority belonging to that of their originating server.
(Publicly facing content SHOULD use HTTPS URIs).
</li>
<li>
An ID explicitly specified as the JSON <code>null</code> object,
which implies an anonymous object (a part of its parent context)
</li>
</ol>
<p>
Identifiers MUST be provided for activities posted in server to
server communication, unless the activity is intentionally transient.
However, for client to server communication, a server receiving an
object posted to the outbox with no specified <code>id</code> SHOULD
allocate an object ID in the actor's namespace and attach it to the
posted object.
</p>
<p>All objects have the following properties:</p>
<dl>
<dt>id</dt>
<dd>
The object's unique global identifier (unless the object is transient,
in which case the <code>id</code> MAY be omitted).
</dd>
<dt>type</dt>
<dd>
The type of the object.
</dd>
</dl>
</section>
<section id="retrieving-objects">
<h2>Retrieving objects</h2>
<p>
The HTTP GET method may be dereferenced against an object's
<code>id</code> property to retrieve the activity.
Servers MAY use HTTP content negotiation as defined in [[!RFC7231]] to
select the type of data to return in response to a request,
but MUST present the ActivityStreams object representation
in response to
<code>application/ld+json; profile="https://www.w3.org/ns/activitystreams"</code>,
and SHOULD also present the ActivityStreams representation in
response to <code>application/activity+json</code> as well.
The client MUST specify an <code>Accept</code> header with the
<code>application/ld+json; profile="https://www.w3.org/ns/activitystreams"</code>
media type in order to retrieve the activity.
</p>
<p>
Servers MAY implement other behavior for requests which do not comply
with the above requirement.
(For example, servers may implement additional legacy protocols, or
may use the same URI for both HTML and ActivityStreams
representations of a resource).
</p>
<p>
Servers MAY require authorization as specified in
<a href="#authorization"></a>, and may additionally implement their
own authorization rules.
Servers SHOULD fail requests which do not pass their authorization
checks with the appropriate HTTP error code, or the 403 Forbidden
error code where the existence of the object is considered private.
An origin server which does not wish to disclose the existence of
a private target MAY instead respond with a status code of
404 Not Found.
</p>
</section>
<section id="source-property">
<h2>The source property</h2>
<p>
In addition to all the properties defined by the
[[!Activity-Vocabulary]], ActivityPub extends the <code>Object</code> by
supplying the <code>source</code> property.
The <code>source</code> property is intended to convey some
sort of source from which the <code>content</code> markup
was derived, as a form of provenance, or to support future
editing by clients.
In general, clients do the conversion from <code>source</code>
to <code>content</code>, not the other way around.
</p>
<p>
The value of <code>source</code> is itself an object
which uses its own <code>content</code> and <code>mediaType</code>
fields to supply source information.
</p>
<pre class="example">
{
"@context": ["https://www.w3.org/ns/activitystreams",
{"@language": "en"}],
"type": "Note",
"id": "http://postparty.example/p/2415",
"content": "<p>I <em>really</em> like strawberries!</p>",
"source": {
"content": "I *really* like strawberries!",
"mediaType": "text/markdown"}
}
</pre>
<div class="note"
title="What to do when clients can't meaningfully handle a mediaType?">
<p>
In general, it's best to let a user edit their original post
in the same source format they originally composed it in.
But not all clients can reliably provide a nice interface for
all source types, and since clients are expected to do the
conversion from <code>source</code> to <code>content</code>,
some clients may work with a media type that another client
does not know how to work with.
While a client could feasibly provide the <code>content</code>
markup to be edited and ignore the source, this means that the
user will lose the more desirable form of the original
<code>source</code> in any future revisions.
A client doing so should thus provide a minimally obtrusive warning
cautioning that the original source format is not understood and is
thus being ignored.
</p>
<p>
For example, Alyssa P. Hacker likes to post to her ActivityPub
powered blog via an Emacs client she has written, leveraging
<a href="http://orgmode.org/">Org mode</a>.
Later she switches to editing on her phone's client, which
has no idea what <code>text/x-org</code> is or how to render
it to HTML, so it provides a text box to edit the original
<code>content</code> instead.
A helpful warning displays above the edit area saying,
"This was originally written in another markup language we don't
know how to handle. If you edit, you'll lose your original
source!"
Alyssa decides the small typo fix isn't worth losing her nice
org-mode markup and decides to make the update when she gets
home.
</p>
</div>
</section>
</section>
<section id="actors">
<h2>Actors</h2>
<p>
ActivityPub actors are generally one of the
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#actor-types">
ActivityStreams Actor Types</a>,
but they don't have to be. For example, a
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-profile">
Profile</a> object
might be used as an actor, or a type from an ActivityStreams extension.
Actors are <a href="#retrieving-objects">retrieved</a> like any other
Object in ActivityPub.
Like other ActivityStreams objects, actors have an <code>id</code>,
which is a URI.
When entered directly into a user interface (for example on a login
form), it is desirable to support simplified naming.
For this purpose, ID normalization SHOULD be performed as follows:
</p>
<ol>
<li>
If the entered ID is a valid URI, then it is to be used directly.
</li>
<li>
If it appears that the user neglected to add a scheme for a URI that
would otherwise be considered valid, such as
<code>example.org/alice/</code>, clients MAY attempt to provide
a default scheme, preferably <code>https</code>.
</li>
<li>
Otherwise, the entered value should be considered invalid.
</li>
</ol>
<p>
Once the actor's URI has been identified, it should be dereferenced.
</p>
<div class="note">
ActivityPub does not dictate a specific relationship between
"users" and Actors; many configurations are possible.
There may be multiple human users or organizations controlling an
Actor, or likewise one human or organization may control multiple
Actors. Similarly, an Actor may represent a piece of software,
like a bot, or an automated process.
More detailed "user" modelling, for example linking together of Actors which
are controlled by the same entity, or allowing one Actor to be presented
through multiple alternate profiles or aspects, are at the discretion
of the implementation.
</div>
<section id="actor-objects">
<h2><i>Actor</i> objects</h2>
<p>
Actor objects MUST have, in addition to the properties mandated by
<a href="#obj-id"></a>, the following properties:
</p>
<dl>
<dt id="inbox-property">inbox</dt>
<dd>
A reference to an [[!ActivityStreams]]
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection">
<code>OrderedCollection</code></a>
comprised of all the messages received by the actor; see
<a href="#inbox"></a>.
</dd>
<dt id="outbox-property">outbox</dt>
<dd>
An [[!ActivityStreams]]
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection">
<code>OrderedCollection</code></a>
comprised of all the messages produced by the actor; see
<a href="#outbox"></a>.
</dd>
</dl>
<p>
Implementations SHOULD, in addition, provide the following
properties:
</p>
<dl>
<dt id="following-property">following</dt>
<dd>
A link to an [[!ActivityStreams]] collection of the actors that
this actor is following; see <a href="#following"></a>
</dd>
<dt id="followers-property">followers</dt>
<dd>
A link to an [[!ActivityStreams]] collection of the actors that
follow this actor; see <a href="#followers"></a>.
</dd>
</dl>
<p>
Implementations MAY provide the following properties:
</p>
<dl>
<dt id="liked-property">liked</dt>
<dd>
A link to an [[!ActivityStreams]] collection of objects this
actor has liked; see <a href="#liked"></a>.
</dd>
</dl>
<pre class="example">
{
"@context": ["https://www.w3.org/ns/activitystreams",
{"@language": "ja"}],
"type": "Person",
"id": "https://kenzoishii.example.com/",
"following": "https://kenzoishii.example.com/following.json",
"followers": "https://kenzoishii.example.com/followers.json",
"liked": "https://kenzoishii.example.com/liked.json",
"inbox": "https://kenzoishii.example.com/inbox.json",
"outbox": "https://kenzoishii.example.com/feed.json",
"preferredUsername": "kenzoishii",
"name": "石井健蔵",
"summary": "この方はただの例です",
"icon": [
"https://kenzoishii.example.com/image/165987aklre4"
]
}
</pre>
<p>Implementations MAY, in addition, provide the following properties:</p>
<dl>
<dt id="streams-property">streams</dt>
<dd>
A list of supplementary Collections which may be of interest.
</dd>
<dt id="preferredUsername">preferredUsername</dt>
<dd>
A short username which may be used to refer to the actor, with no
uniqueness guarantees.
</dd>
<dt id="endpoints">endpoints</dt>
<dd>
A json object which maps additional (typically server/domain-wide)
endpoints which may be useful either for this actor or someone
referencing this actor.
This mapping may be nested inside the actor document as the value
or may be a link to a JSON-LD document with these properties.
</dd>
</dl>
<p>
The <code>endpoints</code> mapping MAY include the following
properties:
</p>
<dl>
<dt id="proxyUrl">proxyUrl</dt>
<dd>
Endpoint URI so this actor's clients may access remote
ActivityStreams objects which require authentication to access.
To use this endpoint, the client posts an
<code>x-www-form-urlencoded</code> <code>id</code> parameter
with the value being the <code>id</code> of the requested
ActivityStreams object.
</dd>
<dt id="oauthAuthorizationEndpoint">oauthAuthorizationEndpoint</dt>
<dd>
If OAuth 2.0 bearer tokens [[RFC6749]] [[RFC6750]] are being used
for authenticating
<a href="#client-to-server-interactions">client to server
interactions</a>,
this endpoint specifies a URI at which a browser-authenticated user
may obtain a new authorization grant.
</dd>
<dt id="oauthTokenEndpoint">oauthTokenEndpoint</dt>
<dd>
If OAuth 2.0 bearer tokens [[RFC6749]] [[RFC6750]] are being used
for authenticating
<a href="#client-to-server-interactions">client to server
interactions</a>,
this endpoint specifies a URI at which a client may acquire an
access token.
</dd>
<dt id="provideClientKey">provideClientKey</dt>
<dd>
If Linked Data Signatures and HTTP Signatures are being used for
authentication and authorization, this endpoint specifies a URI at
which browser-authenticated users may authorize a client's public
key for
<a href="#client-to-server-interactions">client to server
interactions</a>.
</dd>
<dt id="signClientKey">signClientKey</dt>
<dd>
If Linked Data Signatures and HTTP Signatures are being used for
authentication and authorization, this endpoint specifies a URI at
which a client key may be signed by the actor's key for a time
window to act on behalf of the actor in interacting with foreign
servers.
</dd>
<dt id="sharedInbox">sharedInbox</dt>
<dd>
An optional endpoint
<a href="#shared-inbox-delivery">
used for wide delivery of publicly addressed activities
and activities sent to followers</a>.
<code>sharedInbox</code> endpoints SHOULD also be publicly
readable <code>OrderedCollection</code> objects containing
objects addressed to the <a href="#public-addressing">Public</a>
special collection.
Reading from the <code>sharedInbox</code> endpoint MUST NOT present
objects which are not addressed to the <code>Public</code>
endpoint.
</dd>
</dl>
<div class="note" id="as2-actor-properties">
<p>
As the upstream vocabulary for ActivityPub, any applicable
[[!ActivityStreams]] property may be used on ActivityPub Actors.
Some ActivityStreams properties are particularly worth highlighting
to demonstrate how they are used in ActivityPub implementations.
</p>
<dl>
<dt id="url-property">url</dt>
<dd>
A link to the actor's "profile web page", if not equal to the
value of <code>id</code>.
</dd>
<dt id="name-property">name</dt>
<dd>
The preferred "nickname" or "display name" of the actor.
</dd>
<dt id="summary-property">summary</dt>
<dd>A quick summary or bio by the user about themselves.</dd>
<dt id="icon-property">icon</dt>
<dd>
A link to an image or an Image object which represents the user's
profile picture (this may be a thumbnail).
</dd>
</dl>
</div>
<p class="note" id="actor-text-direction">
Properties containing natural language values,
such as <code>name</code>, <code>preferredUsername</code>, or
<code>summary</code>, make use of
<a href="https://www.w3.org/TR/activitystreams-core/#naturalLanguageValues">
natural language support defined in ActivityStreams</a>.
</p>
</section>
</section>
<section id="collections">
<h2>Collections</h2>
<p>
[[!ActivityStreams]] defines the collection concept; ActivityPub
defines several collections with special behavior.
Note that ActivityPub makes use of
<a href="https://www.w3.org/TR/activitystreams-core/#paging">
ActivityStreams paging</a>
to traverse large sets of objects.
</p>
<p>
Note that some of these collections are specified to be of type
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection">
<code>OrderedCollection</code></a>
specifically, while others are permitted to be either a
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection">
<code>Collection</code></a>
or an
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection">
<code>OrderedCollection</code></a>.
An
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection">
<code>OrderedCollection</code></a>
MUST be presented consistently in reverse chronological order.
</p>
<p class="note">
What property is used to determine the reverse chronological order
is intentionally left as an implementation detail.
For example, many SQL-style databases use an incrementing integer
as an identifier, which can be reasonably used for handling
insertion order in most cases.
In other databases, an insertion time timestamp may be preferred.
What is used isn't important, but the ordering of elements must
remain intact, with newer items first.
A property which changes regularly, such a "last updated" timestamp,
should not be used.
</p>
<section id="outbox">
<h2>Outbox</h2>
<p>
The outbox is discovered through the <code>outbox</code>
property of an <a href="#actors">actor's</a> profile.
The <code>outbox</code> MUST be an
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection">
<code>OrderedCollection</code></a>.
</p>
<p>
The outbox stream contains activities the user has
published, subject to the ability of the requestor to retrieve the
activity (that is, the contents of the outbox are filtered by the
permissions of the person reading it).
If a user submits a request without
<a href="#authorization">Authorization</a> the server should
respond with all of the <a href="#public-addressing">Public</a>
posts.
This could potentially be all relevant objects published by the
user, though the number of available items is left to the
discretion of those implementing and deploying the server.
</p>
<p>
The outbox accepts HTTP POST requests, with behaviour described in
<a href="#client-to-server-interactions">Client to Server
Interactions</a>.
</p>
</section>
<section id="inbox">
<h2>Inbox</h2>
<p>
The inbox is discovered through the <code>inbox</code>
property of an <a href="#actors">actor's</a> profile.
The <code>inbox</code> MUST be an
<a href="https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection">
<code>OrderedCollection</code></a>.
</p>