clj-activitypub.core
copied from Jahfer’s clj-activitypub library. If and when Jahfer issues a release of that library, this directory will be deleted and a dependency on that library will be added to the project.
activity
multimethod
Produces a map representing an ActivityPub activity which can be serialized directly to JSON in the form expected by the ActivityStreams 2.0 spec. See https://www.w3.org/TR/activitystreams-vocabulary/ for reference.
actor
(actor {:keys [user-id username public-key]})
Accepts a config, and returns a map in the form expected by the ActivityPub spec. See https://www.w3.org/TR/activitypub/#actor-objects for reference.
auth-headers
(auth-headers config {:keys [body headers]})
Given a config and request map of {:body … :headers …}, returns the original set of headers with Signature and Digest attributes appended.
config
(config {:keys [domain username username-route public-key private-key], :or {username-route "/users/", public-key nil, private-key nil}})
Creates hash of computed data relevant for most ActivityPub utilities.
fetch-user
(fetch-user user-id)
Fetches the customer account details located at user-id from a remote server. Will return cached results if they exist in memory.
gen-signature-header
(gen-signature-header config headers)
Generates a HTTP Signature string based on the provided map of headers.
obj
multimethod
Produces a map representing an ActivityPub object which can be serialized directly to JSON in the form expected by the ActivityStreams 2.0 spec. See https://www.w3.org/TR/activitystreams-vocabulary/ for reference.
parse-account
(parse-account handle)
Given an ActivityPub handle (e.g. @jahfer@mastodon.social), produces a map containing {:domain … :username …}.
with-config
(with-config config)
Returns curried forms of the #activity and #obj multimethods in the form {:activity … :obj …}, with the initial parameter set to config.