Commit Graph

85 Commits

Author SHA1 Message Date
Cory Slep 2aa074e2a2 Fix typos in README 2018-05-30 23:58:05 +02:00
Cory Slep e910e86bd6 Update all the READMEs 2018-05-30 23:48:34 +02:00
Cory Slep 0fc1556d17 Fix comments and HandlerFunc 2018-05-30 23:37:59 +02:00
Cory Slep 79f0f3f118 Add go.mod and go.modverify for vgo 2018-05-30 21:44:17 +02:00
Cory Slep 00423c0cdf Tools now pass go vet 2018-05-30 21:40:20 +02:00
Cory Slep f9a2b1b8de Fix go vet issues 2018-05-30 21:33:05 +02:00
Cory Slep 6c1de66753 Move CanAdd & CanRemove into Application interface 2018-05-30 21:27:07 +02:00
Cory Slep 81d1000e1b Fix deliverer with *url.URL changes 2018-05-29 22:02:10 +02:00
Cory Slep ba40dc50b4 Use *url.URL instead of url.URL.
He who fights with monsters should be careful lest he thereby become a monster.
And if thou gaze long into an abyss, the abyss will also gaze into thee.
2018-05-29 21:57:39 +02:00
Cory Slep b8a27ed6f7 The App interfaces contain only the needed funcs
This will hopefully clarify what interfaces are needed for which kind of
implementations of ActivityPub are needed.
2018-05-29 00:04:24 +02:00
Cory Slep abda28d2dc Remove make publicly visible errors private.
We can instead directly write HTTP status codes in these special cases,
removing the burden on library users.
2018-05-27 23:11:19 +02:00
Cory Slep 96c9afee84 Add Read and ReadWrite when getting data.
This allows implementations to prevent race conditions between
contentious objects.
2018-05-27 22:57:43 +02:00
Cory Slep 353cd20402 Prepend to ordered collections. 2018-05-27 22:16:59 +02:00
Cory Slep bed3dbef16 Change vocab Add methods to Append and Prepend
This allows the reverse chronological order to be set as items are
easily prepended to non-functional activity stream properties.
2018-05-27 17:07:40 +02:00
Cory Slep 7f2faf98e1 Add handlers test.
Also, for all tests that use tables, log the test case being executed.
That way verbose mode will indicate which test case is causing any nil
pointer dereference or other segfault interrupts. Also, it will inform
anyone who runs in verbose mode just how many tests there really are.
2018-05-27 01:49:03 +02:00
Cory Slep de215c8787 Add and fix tests for PostOutbox verification.
PostOutbox and the SocialAPI can now use either HTTP Signatures or a
custom authentication scheme, such as OAuth2.

Tests for the handler authentication and authorization need to be
written still.
2018-05-26 14:37:06 +02:00
Cory Slep 2986f7601b Add function to serve ActivityPub object.
This also incorporates some interface changes to permit both HTTP
Signatures and other forms of authentication and authorization when
accessing data. This means support for something like OAuth2 should be
doable in conjunction with HTTP Signatures.

Tests are broken; this commit should not be used as a build point.
2018-05-25 00:23:50 +02:00
Cory Slep f46242ac83 Replace PostOutboxAuthorized with HTTP Signatures.
This makes the implementation conformant to §6 of the specification that
requires HTTP requests to be signed with the user's credentials.
2018-05-20 13:53:12 +02:00
Cory Slep b9606f06f2 Fix tests for HTTP Signatures.
Also, bugfix the time.Now calls to use the federator's clock instead.
This is how it should have been done in the beginning, but is necessary
for the tests since the HTTP Signatures by default sign the dates in the
headers. And I noticed said dates were being populated by time.Now
instead of the mock-able Clock.
2018-05-19 22:16:37 +02:00
Cory Slep ecc87da47f Add HTTP Signatures support for user credentials.
Tests are broken in this commit.
2018-05-18 23:31:18 +02:00
Cory Slep 5390174107 Add same-origin and same-actor checks.
These covers server-to-server Update and Delete activities as well as server-to-
server Undo activities, respectively.
2018-05-13 17:18:39 +02:00
Cory Slep c9c986f5a5 Deduplicate adding entries to the inbox.
Deduplication is simply done by the IRI of the activity.
2018-05-13 13:22:46 +02:00
Cory Slep f60bb145cf Deduplicate adding to like/following collections.
We simply prevent adding a duplicate likes, liked, following, or
follower based on the IRI of the element being added to the collection.

Adds corresponding black box tests.

Note that this deduplication does not cover the inbox.
2018-05-13 13:05:12 +02:00
Cory Slep 61807300f6 Amend tests.
Fixes some logging indicating non-breaking test configuration when
testing with verboseness on.
2018-05-12 23:05:42 +02:00
Cory Slep 4bad90902e Add extra integration tests.
These generally include improving the handling of OrderedCollections and
IRIs. Note that improvement to setting IRI'd fetches from the
implementing application were made.

Improve the handing of AutoAccept and AutoReject follows. If there are
no owned objects in the Activity, we prevent sending the automatic reply
in case the implemented application is not checking for ownership of the
object of the original Follow activity.
2018-05-12 23:03:20 +02:00
Cory Slep f6373d9c86 PostOutbox Block tests 2018-05-12 21:55:15 +02:00
Cory Slep 4fa0103cc8 PostOutbox Undo tests 2018-05-12 21:47:55 +02:00
Cory Slep 6e56e8710e PostOutbox Like tests
Note that some other tests were impacted due to a change to keep
modifications to collections on objects/actors at parity when calling
get and set on the App.
2018-05-12 14:44:07 +02:00
Cory Slep 3e7a7f2f97 PostOutbox Remove tests 2018-05-10 22:34:10 +02:00
Cory Slep 2509c9e844 PostOutbox Add tests 2018-05-10 19:29:41 +02:00
Cory Slep 2e2594706a PostOutbox Reject tests 2018-05-10 17:34:49 +02:00
Cory Slep 68bc0a2fa5 PostOutbox Accept tests 2018-05-10 17:30:55 +02:00
Cory Slep 9fbd18b53c PostOutbox Follow tests 2018-05-10 17:25:48 +02:00
Cory Slep 7b63dca953 Support Inbox Forwarding.
Client libraries can also filter the collections being targeted for the
inbox forwarding.
2018-05-10 12:49:37 +02:00
Cory Slep c85503011e gofmt 2018-05-10 12:49:26 +02:00
Cory Slep c5dd064b06 PostInbox adds to actor's Inbox OrderedCollection.
Tests were upated and refactored to use common initialization similar to
how PostOutbox has common intialization.
2018-04-29 15:56:38 +02:00
Cory Slep fae166f9dc Add PostOutbox Delete unit tests 2018-04-28 23:09:21 +02:00
Cory Slep da317e0cf7 Add unit tests for PostOutbox Update.
Tests cover the usual plus the major points:
- Updating top-level fields in object
- Updating multiple objects at once
- Removing values that are a null literal in JSON
- Remove sub-fields of objects; this may not be to spec (pending
  response from https://github.com/w3c/activitypub/issues/303)
2018-04-28 17:23:11 +02:00
Cory Slep 2827a4cb1e Do not capture unused IRIs of objects 2018-04-28 17:23:03 +02:00
Cory Slep bcaa3a9059 Fix handling of null JSON literals in vocab
We now recognize an all-empty intermediate value to mean that the
unknown value is really a null one.
2018-04-28 16:22:17 +02:00
Cory Slep e3a72c5274 Apply nulls in JSON in PostOutbox Update
This is a much better solution than trying to do some sort of roll-your-
own JSON parser.
2018-04-28 13:47:33 +02:00
Cory Slep 0a84346ab3 LOL no.
Don't drink and stay up late at night trying to solve nasty problems,
one just might decide writing a from-scratch JSON parser is the right
thing to do. Instead of diving into nuances of existing solutions within
the standard library and leveraging those.

I am only committing this to history so that I can immediately delete it
afterwards. As insurance against anyone trying to glorify this work
as the product of some genius, I can point to this and say "yeah, some
genius this guy is".

Saturday-morning coffee-drinking me is laughing at Friday-night
beer-drinking me.

Note that if this project gets serious I won't pollute the git history
like this. But as the project is young enough that most won't care about
this early history, I feel like enshrining some self-deprecating humor
into deep history is OK.
2018-04-28 13:25:45 +02:00
Cory Slep 4672f6a325 Replace TODO with comment clarification 2018-04-25 00:57:55 +02:00
Cory Slep 07c0392ada Clean up some TODOs. 2018-04-25 00:43:41 +02:00
Cory Slep 2adcc56581 Add PostOutbox Create unit tests.
Fix normalizing the recipents between the object and the activity. Also
allow the handlers to adjust what gets placed in the outbox, since the
client-to-server API allows the server to modify the object before being
delivered.
2018-04-22 14:02:45 +02:00
Cory Slep 19ca5b0975 Add PostOutbox non-callback tests.
Also move some functions out of the generic Application interface into
the specialized SocialApp interface. They will be moved back into the
Application interface if further development needs it when implementing
inbox forwarding, for example.
2018-04-19 20:58:00 +02:00
Cory Slep e9b4c720b2 Add GetOutbox tests 2018-04-17 19:24:18 +02:00
Cory Slep a028bcc302 Add all GetInbox unit tests 2018-04-14 18:20:03 +02:00
Cory Slep c5830e6eff Add PostInbox Like and Undo unit tests 2018-04-14 09:54:30 +02:00
Cory Slep a06ee678e8 Add PostInbox Remove unit tests 2018-04-14 09:36:24 +02:00