Documentation

This commit is contained in:
Simon Brooke 2022-12-19 23:39:24 +00:00
parent b2ff133e4a
commit ed7d4e22f1
38 changed files with 3182 additions and 26 deletions

View file

@ -1,5 +1,6 @@
# Using ActivityPub
```clojure
user=> (require '[clj-activitypub.core :as activitypub])
nil
user=> (require '[clj-activitypub.webfinger :as webfinger])
@ -108,3 +109,4 @@ user=> (pprint sb)
:name "Home Page",
:value
"<a href=\"https://www.journeyman.cc/~simon/\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://www.</span><span class=\"\">journeyman.cc/~simon/</span><span class=\"invisible\"></span></a>"}]}
```

View file

@ -1,3 +1,82 @@
# Introduction to dog-and-duck
# The Old Dog and Duck
TODO: write [great documentation](http://jacobian.org/writing/what-to-write/)
A Clojure library designed to implement the ActivityPub protocol, obviously.
## Introduction
The Old Dog and Duck is clearly a pub, and it's a pub related to an activity; to whit, hunting ducks with dogs. Yes, of course one could also hunt dogs with ducks, but in practice that doesn't work so well. The point isn't whether or not I approve of hunting ducks with dogs (or vice versa); to be clear, I don't. The point is that it's a pub related to an activity, and is therefore an [ActivityPub](https://www.w3.org/TR/activitypub/).
Are we clear?
Good.
Let us proceed.
**The Old Dog and Duck** is intended to be a set of libraries to enable people to build stuff which interacts with ActivityPub. It isn't intended to be a replacement for, or clone of, Mastodon. I do think I might implement my own ActivityPub server on top of The Old Dog and Duck, that specifically might allow for user-pluggable feed-sorting algorithms and with my own user interface/user experience take, but that project is not (yet, at any rate) this project.
## Status
This is a long way pre-alpha. Everything will change. Feel free to play, but do so at your own risk. Contributions welcome.
## Architecture
There are a number of separate concerns required to implement ActivityPub. They include
1. Parsing ActivityStreams messages received from peers and from clients;
2. Persisting ActivityStreams objects;
3. Delivering ActivityStreams objects to peers;
4. Delivering ActivityStreams objects to clients.
**NOTE THAT** what Mastodon delivers to clients is not actually in ActivityStreams format; this seems to be an ad-hoc hack that's just never been fixed and has therefore become a de-facto standard for communication between ActivityPub hosts and their clients.
My proposal would be to deliver exactly the same ActivityStreams format to my client as to other servers. There may be a valid reason for not doing this, but if there is I will discover it in due course.
## Proposed dog-and-duck libraries
**NOTE THAT** at the present stage all the proposed libraries are in one package, namely this package, but that it is proposed that in future they will form separate libraries in separate packages.
### Bar
Where conversations happen. Handle interactions with clients.
### Cellar
Where things are stored. Persistance for ActivityStreams objects; I may at least initially simply copy the Mastodon postgres schema, but equally I may not.
### Pantry
Where deliveries are ordered and arrive; and from where deliveries onwards are despatched. Handle interactions with peers.
### Quack
Duck-typing for ActivityStreams objects.
As of version 0.1.0, this is substantially the only part that is yet at all useful, and it is still a long way from finished or robust.
### Scratch
What the dog does when bored. Essentially, a place where I can learn how to make this stuff work, but perhaps eventually an ActivityPub server in its own right.
## Usage
At present, only the duck-typing functions work. To play with them, use
```clojure
(require '[dog-and-duck.quack.quack :as q])
```
## Testing
Prior to testing, you should clone [activitystreams-test-documents](https://github.com/w3c-social/activitystreams-test-documents) into the `resources` directory. You can then test with
```bash
lein test
```
## License
Copyright © Simon Brooke, 2022.
This program and the accompanying materials are made available under the
terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your
option) any later version.

View file

@ -0,0 +1,449 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../coverage.css"/> <title> clj_activitypub/core.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;clj-activitypub.core
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
002&nbsp;&nbsp;&nbsp;&nbsp;(:require&nbsp;[clj-activitypub.internal.crypto&nbsp;:as&nbsp;crypto]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
003&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-activitypub.internal.thread-cache&nbsp;:as&nbsp;thread-cache]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-activitypub.internal.http-util&nbsp;:as&nbsp;http]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
005&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-http.client&nbsp;:as&nbsp;client]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
006&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clojure.string&nbsp;:as&nbsp;str]))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
007&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
008&nbsp;&nbsp;(defn&nbsp;config
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
009&nbsp;&nbsp;&nbsp;&nbsp;&quot;Creates&nbsp;hash&nbsp;of&nbsp;computed&nbsp;data&nbsp;relevant&nbsp;for&nbsp;most&nbsp;ActivityPub&nbsp;utilities.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
010&nbsp;&nbsp;&nbsp;&nbsp;[{:keys&nbsp;[domain&nbsp;username&nbsp;username-route&nbsp;public-key&nbsp;private-key]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
011&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:or&nbsp;{username-route&nbsp;&quot;&#x2F;users&#x2F;&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
012&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public-key&nbsp;nil
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
013&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private-key&nbsp;nil}}]
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
014&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[base-url&nbsp;(str&nbsp;&quot;https:&#x2F;&#x2F;&quot;&nbsp;domain)]
</span><br/>
<span class="not-covered" title="0 out of 8 forms covered">
015&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:domain&nbsp;domain
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
016&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:base-url&nbsp;base-url
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
017&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:username&nbsp;username
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
018&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:user-id&nbsp;(str&nbsp;base-url&nbsp;username-route&nbsp;username)
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
019&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:public-key&nbsp;public-key
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:private-key&nbsp;(when&nbsp;private-key
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
021&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(crypto&#x2F;private-key&nbsp;private-key))}))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
022&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
023&nbsp;&nbsp;(defn&nbsp;parse-account
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
024&nbsp;&nbsp;&nbsp;&nbsp;&quot;Given&nbsp;an&nbsp;ActivityPub&nbsp;handle&nbsp;(e.g.&nbsp;@jahfer@mastodon.social),&nbsp;produces
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
025&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;map&nbsp;containing&nbsp;{:domain&nbsp;...&nbsp;:username&nbsp;...}.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
026&nbsp;&nbsp;&nbsp;&nbsp;[handle]
</span><br/>
<span class="covered" title="9 out of 9 forms covered">
027&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[[username&nbsp;domain]&nbsp;(filter&nbsp;#(not&nbsp;(str&#x2F;blank?&nbsp;%))
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
028&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(str&#x2F;split&nbsp;handle&nbsp;#&quot;@&quot;))]
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
029&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:domain&nbsp;domain&nbsp;:username&nbsp;username}))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
030&nbsp;&nbsp;
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
031&nbsp;&nbsp;(def&nbsp;^:private&nbsp;user-cache&nbsp;(thread-cache&#x2F;make))
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
032&nbsp;&nbsp;(defn&nbsp;fetch-user
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
033&nbsp;&nbsp;&nbsp;&nbsp;&quot;Fetches&nbsp;the&nbsp;customer&nbsp;account&nbsp;details&nbsp;located&nbsp;at&nbsp;user-id&nbsp;from&nbsp;a&nbsp;remote
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
034&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server.&nbsp;Will&nbsp;return&nbsp;cached&nbsp;results&nbsp;if&nbsp;they&nbsp;exist&nbsp;in&nbsp;memory.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
035&nbsp;&nbsp;&nbsp;&nbsp;[user-id]
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
036&nbsp;&nbsp;&nbsp;&nbsp;((:get-v&nbsp;user-cache)
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
037&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;user-id
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
038&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#(:body
</span><br/>
<span class="covered" title="11 out of 11 forms covered">
039&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(client&#x2F;get&nbsp;user-id&nbsp;{:as&nbsp;:json-string-keys
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
040&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:throw-exceptions&nbsp;false
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
041&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:ignore-unknown-host?&nbsp;true
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
042&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:headers&nbsp;{&quot;Accept&quot;&nbsp;&quot;application&#x2F;activity+json&quot;}}))))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
043&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
044&nbsp;&nbsp;(defn&nbsp;actor
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
045&nbsp;&nbsp;&nbsp;&nbsp;&quot;Accepts&nbsp;a&nbsp;config,&nbsp;and&nbsp;returns&nbsp;a&nbsp;map&nbsp;in&nbsp;the&nbsp;form&nbsp;expected&nbsp;by&nbsp;the&nbsp;ActivityPub
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
046&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spec.&nbsp;See&nbsp;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;activitypub&#x2F;#actor-objects&nbsp;for&nbsp;reference.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
047&nbsp;&nbsp;&nbsp;&nbsp;[{:keys&nbsp;[user-id&nbsp;username&nbsp;public-key]}]
</span><br/>
<span class="not-covered" title="0 out of 12 forms covered">
048&nbsp;&nbsp;&nbsp;&nbsp;{&quot;@context&quot;&nbsp;[&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;ns&#x2F;activitystreams&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
049&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;https:&#x2F;&#x2F;w3id.org&#x2F;security&#x2F;v1&quot;]
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
050&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:id&nbsp;user-id
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
051&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:type&nbsp;&quot;Person&quot;
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
052&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:preferredUsername&nbsp;username
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
053&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:inbox&nbsp;(str&nbsp;user-id&nbsp;&quot;&#x2F;inbox&quot;)
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
054&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:outbox&nbsp;(str&nbsp;user-id&nbsp;&quot;&#x2F;outbox&quot;)
</span><br/>
<span class="not-covered" title="0 out of 8 forms covered">
055&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:publicKey&nbsp;{:id&nbsp;(str&nbsp;user-id&nbsp;&quot;#main-key&quot;)
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
056&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:owner&nbsp;user-id
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
057&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:publicKeyPem&nbsp;(or&nbsp;public-key&nbsp;&quot;&quot;)}})
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
058&nbsp;&nbsp;
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
059&nbsp;&nbsp;(def&nbsp;signature-headers&nbsp;[&quot;(request-target)&quot;&nbsp;&quot;host&quot;&nbsp;&quot;date&quot;&nbsp;&quot;digest&quot;])
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
060&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
061&nbsp;&nbsp;(defn-&nbsp;str-for-signature&nbsp;[headers]
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
062&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[headers-xf&nbsp;(reduce-kv
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
063&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(fn&nbsp;[m&nbsp;k&nbsp;v]
</span><br/>
<span class="not-covered" title="0 out of 9 forms covered">
064&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(assoc&nbsp;m&nbsp;(str&#x2F;lower-case&nbsp;k)&nbsp;v))&nbsp;{}&nbsp;headers)]
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
065&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(-&gt;&gt;&nbsp;signature-headers
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
066&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(select-keys&nbsp;headers-xf)
</span><br/>
<span class="not-covered" title="0 out of 12 forms covered">
067&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(reduce-kv&nbsp;(fn&nbsp;[coll&nbsp;k&nbsp;v]&nbsp;(conj&nbsp;coll&nbsp;(str&nbsp;k&nbsp;&quot;:&nbsp;&quot;&nbsp;v)))&nbsp;[])
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
068&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(interpose&nbsp;&quot;\n&quot;)
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
069&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(apply&nbsp;str))))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
070&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
071&nbsp;&nbsp;(defn&nbsp;gen-signature-header
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
072&nbsp;&nbsp;&nbsp;&nbsp;&quot;Generates&nbsp;a&nbsp;HTTP&nbsp;Signature&nbsp;string&nbsp;based&nbsp;on&nbsp;the&nbsp;provided&nbsp;map&nbsp;of&nbsp;headers.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
073&nbsp;&nbsp;&nbsp;&nbsp;[config&nbsp;headers]
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
074&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[{:keys&nbsp;[user-id&nbsp;private-key]}&nbsp;config
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
075&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string-to-sign&nbsp;(str-for-signature&nbsp;headers)
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
076&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;signature&nbsp;(crypto&#x2F;base64-encode&nbsp;(crypto&#x2F;sign&nbsp;string-to-sign&nbsp;private-key))
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
077&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sig-header-keys&nbsp;{&quot;keyId&quot;&nbsp;user-id
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
078&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;headers&quot;&nbsp;(str&#x2F;join&nbsp;&quot;&nbsp;&quot;&nbsp;signature-headers)
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
079&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;signature&quot;&nbsp;signature}]
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
080&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(-&gt;&gt;&nbsp;sig-header-keys
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
081&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(reduce-kv&nbsp;(fn&nbsp;[m&nbsp;k&nbsp;v]
</span><br/>
<span class="not-covered" title="0 out of 11 forms covered">
082&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(conj&nbsp;m&nbsp;(str&nbsp;k&nbsp;&quot;=&quot;&nbsp;&quot;\&quot;&quot;&nbsp;v&nbsp;&quot;\&quot;&quot;)))&nbsp;[])
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
083&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(interpose&nbsp;&quot;,&quot;)
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
084&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(apply&nbsp;str))))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
085&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
086&nbsp;&nbsp;(defn&nbsp;auth-headers
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
087&nbsp;&nbsp;&nbsp;&nbsp;&quot;Given&nbsp;a&nbsp;config&nbsp;and&nbsp;request&nbsp;map&nbsp;of&nbsp;{:body&nbsp;...&nbsp;:headers&nbsp;...},&nbsp;returns&nbsp;the
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
088&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;original&nbsp;set&nbsp;of&nbsp;headers&nbsp;with&nbsp;Signature&nbsp;and&nbsp;Digest&nbsp;attributes&nbsp;appended.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
089&nbsp;&nbsp;&nbsp;&nbsp;[config&nbsp;{:keys&nbsp;[body&nbsp;headers]}]
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
090&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[digest&nbsp;(http&#x2F;digest&nbsp;body)
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
091&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h&nbsp;(-&gt;&nbsp;headers
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
092&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(assoc&nbsp;&quot;Digest&quot;&nbsp;digest)
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
093&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(assoc&nbsp;&quot;(request-target)&quot;&nbsp;&quot;post&nbsp;&#x2F;inbox&quot;))]
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
094&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(assoc&nbsp;headers
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
095&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Signature&quot;&nbsp;(gen-signature-header&nbsp;config&nbsp;h)
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
096&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Digest&quot;&nbsp;digest)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
097&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
098&nbsp;&nbsp;(defmulti&nbsp;obj
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
099&nbsp;&nbsp;&nbsp;&nbsp;&quot;Produces&nbsp;a&nbsp;map&nbsp;representing&nbsp;an&nbsp;ActivityPub&nbsp;object&nbsp;which&nbsp;can&nbsp;be&nbsp;serialized
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directly&nbsp;to&nbsp;JSON&nbsp;in&nbsp;the&nbsp;form&nbsp;expected&nbsp;by&nbsp;the&nbsp;ActivityStreams&nbsp;2.0&nbsp;spec.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
101&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;See&nbsp;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;activitystreams-vocabulary&#x2F;&nbsp;for&nbsp;reference.&quot;
</span><br/>
<span class="partial" title="1 out of 4 forms covered">
102&nbsp;&nbsp;&nbsp;&nbsp;(fn&nbsp;[_config&nbsp;object-data]&nbsp;(:type&nbsp;object-data)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
103&nbsp;&nbsp;
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
104&nbsp;&nbsp;(defmethod&nbsp;obj&nbsp;:note
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
105&nbsp;&nbsp;&nbsp;&nbsp;[{:keys&nbsp;[user-id]}
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
106&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:keys&nbsp;[id&nbsp;published&nbsp;inReplyTo&nbsp;content&nbsp;to]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
107&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:or&nbsp;{published&nbsp;(http&#x2F;date)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
108&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inReplyTo&nbsp;&quot;&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
109&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;ns&#x2F;activitystreams#Public&quot;}}]
</span><br/>
<span class="not-covered" title="0 out of 14 forms covered">
110&nbsp;&nbsp;&nbsp;&nbsp;{&quot;id&quot;&nbsp;(str&nbsp;user-id&nbsp;&quot;&#x2F;notes&#x2F;&quot;&nbsp;id)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
111&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;&nbsp;&quot;Note&quot;
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
112&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;published&quot;&nbsp;published
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
113&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;attributedTo&quot;&nbsp;user-id
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
114&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;inReplyTo&quot;&nbsp;inReplyTo
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
115&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;content&quot;&nbsp;content
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
116&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;to&quot;&nbsp;to})
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
117&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
118&nbsp;&nbsp;(defmulti&nbsp;activity
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
119&nbsp;&nbsp;&nbsp;&nbsp;&quot;Produces&nbsp;a&nbsp;map&nbsp;representing&nbsp;an&nbsp;ActivityPub&nbsp;activity&nbsp;which&nbsp;can&nbsp;be&nbsp;serialized
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
120&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directly&nbsp;to&nbsp;JSON&nbsp;in&nbsp;the&nbsp;form&nbsp;expected&nbsp;by&nbsp;the&nbsp;ActivityStreams&nbsp;2.0&nbsp;spec.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
121&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;See&nbsp;https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;activitystreams-vocabulary&#x2F;&nbsp;for&nbsp;reference.&quot;
</span><br/>
<span class="partial" title="1 out of 2 forms covered">
122&nbsp;&nbsp;&nbsp;&nbsp;(fn&nbsp;[_config&nbsp;activity-type&nbsp;_data]&nbsp;activity-type))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
123&nbsp;&nbsp;
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
124&nbsp;&nbsp;(defmethod&nbsp;activity&nbsp;:create&nbsp;[{:keys&nbsp;[user-id]}&nbsp;_&nbsp;data]
</span><br/>
<span class="not-covered" title="0 out of 9 forms covered">
125&nbsp;&nbsp;&nbsp;&nbsp;{&quot;@context&quot;&nbsp;[&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;ns&#x2F;activitystreams&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
126&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;https:&#x2F;&#x2F;w3id.org&#x2F;security&#x2F;v1&quot;]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
127&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;&nbsp;&quot;Create&quot;
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;actor&quot;&nbsp;user-id
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
129&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;object&quot;&nbsp;data})
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
130&nbsp;&nbsp;
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
131&nbsp;&nbsp;(defmethod&nbsp;activity&nbsp;:delete&nbsp;[{:keys&nbsp;[user-id]}&nbsp;_&nbsp;data]
</span><br/>
<span class="not-covered" title="0 out of 9 forms covered">
132&nbsp;&nbsp;&nbsp;&nbsp;{&quot;@context&quot;&nbsp;[&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;ns&#x2F;activitystreams&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
133&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;https:&#x2F;&#x2F;w3id.org&#x2F;security&#x2F;v1&quot;]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
134&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;&nbsp;&quot;Delete&quot;
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
135&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;actor&quot;&nbsp;user-id
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
136&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;object&quot;&nbsp;data})
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
137&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
138&nbsp;&nbsp;(defn&nbsp;with-config
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
139&nbsp;&nbsp;&nbsp;&nbsp;&quot;Returns&nbsp;curried&nbsp;forms&nbsp;of&nbsp;the&nbsp;#activity&nbsp;and&nbsp;#obj&nbsp;multimethods&nbsp;in&nbsp;the&nbsp;form
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
140&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:activity&nbsp;...&nbsp;:obj&nbsp;...},&nbsp;with&nbsp;the&nbsp;initial&nbsp;parameter&nbsp;set&nbsp;to&nbsp;config.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
141&nbsp;&nbsp;&nbsp;&nbsp;[config]
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
142&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[f&nbsp;(juxt
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
143&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#(partial&nbsp;activity&nbsp;%)
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
144&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#(partial&nbsp;obj&nbsp;%))
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
145&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[activity-fn&nbsp;obj-fn]&nbsp;(f&nbsp;config)]
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
146&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:activity&nbsp;activity-fn
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
147&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:obj&nbsp;obj-fn}))
</span><br/>
</body>
</html>

View file

@ -0,0 +1,116 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../coverage.css"/> <title> clj_activitypub/internal/crypto.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;clj-activitypub.internal.crypto
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
002&nbsp;&nbsp;&nbsp;&nbsp;(:require&nbsp;[clojure.java.io&nbsp;:as&nbsp;io])
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
003&nbsp;&nbsp;&nbsp;&nbsp;(:import&nbsp;(java.util&nbsp;Base64)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(java.security&nbsp;MessageDigest&nbsp;SecureRandom&nbsp;Signature)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
005&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
006&nbsp;&nbsp;(java.security.Security&#x2F;addProvider
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
007&nbsp;&nbsp;&nbsp;(org.bouncycastle.jce.provider.BouncyCastleProvider.))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
008&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
009&nbsp;&nbsp;(defn-&nbsp;keydata&nbsp;[reader]
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
010&nbsp;&nbsp;&nbsp;&nbsp;(-&gt;&gt;&nbsp;reader
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
011&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(org.bouncycastle.openssl.PEMParser.)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
012&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.readObject)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
013&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
014&nbsp;&nbsp;(defn-&nbsp;pem-string-&gt;key-pair&nbsp;[string]
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
015&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[kd&nbsp;(keydata&nbsp;(io&#x2F;reader&nbsp;(.getBytes&nbsp;string)))]
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
016&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.getKeyPair&nbsp;(org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter.)&nbsp;kd)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
017&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
018&nbsp;&nbsp;(defn&nbsp;private-key&nbsp;[private-pem-str]
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
019&nbsp;&nbsp;&nbsp;&nbsp;(-&gt;&nbsp;private-pem-str
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(pem-string-&gt;key-pair)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
021&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.getPrivate)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
022&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
023&nbsp;&nbsp;(defn&nbsp;base64-encode&nbsp;[bytes]
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
024&nbsp;&nbsp;&nbsp;&nbsp;(.encodeToString&nbsp;(Base64&#x2F;getEncoder)&nbsp;bytes))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
025&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
026&nbsp;&nbsp;(defn&nbsp;sha256-base64&nbsp;[data]
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
027&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[digest&nbsp;(.digest&nbsp;(MessageDigest&#x2F;getInstance&nbsp;&quot;SHA-256&quot;)&nbsp;(.getBytes&nbsp;data))]
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
028&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(base64-encode&nbsp;digest)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
029&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
030&nbsp;&nbsp;(defn&nbsp;sign&nbsp;[data&nbsp;private-key]&nbsp;
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
031&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[bytes&nbsp;(.getBytes&nbsp;data)
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;signer&nbsp;(doto&nbsp;(Signature&#x2F;getInstance&nbsp;&quot;SHA256withRSA&quot;)
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
033&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.initSign&nbsp;private-key&nbsp;(SecureRandom.))
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
034&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.update&nbsp;bytes))]
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
035&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.sign&nbsp;signer)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
036&nbsp;&nbsp;
</span><br/>
</body>
</html>

View file

@ -0,0 +1,83 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../coverage.css"/> <title> clj_activitypub/internal/http_util.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;clj-activitypub.internal.http-util
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
002&nbsp;&nbsp;&nbsp;&nbsp;(:require&nbsp;[clj-activitypub.internal.crypto&nbsp;:as&nbsp;crypto])
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
003&nbsp;&nbsp;&nbsp;&nbsp;(:import&nbsp;(java.net&nbsp;URLEncoder)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(java.time&nbsp;OffsetDateTime&nbsp;ZoneOffset)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
005&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(java.time.format&nbsp;DateTimeFormatter)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
006&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
007&nbsp;&nbsp;(defn&nbsp;encode-url-params&nbsp;[params]
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
008&nbsp;&nbsp;&nbsp;&nbsp;(-&gt;&gt;&nbsp;params
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
009&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(reduce-kv
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
010&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(fn&nbsp;[coll&nbsp;k&nbsp;v]
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
011&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(conj&nbsp;coll
</span><br/>
<span class="covered" title="11 out of 11 forms covered">
012&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(str&nbsp;(URLEncoder&#x2F;encode&nbsp;(name&nbsp;k))&nbsp;&quot;=&quot;&nbsp;(URLEncoder&#x2F;encode&nbsp;(str&nbsp;v)))))
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
013&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[])
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
014&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(interpose&nbsp;&quot;&amp;&quot;)
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
015&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(apply&nbsp;str)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
016&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
017&nbsp;&nbsp;(defn&nbsp;date&nbsp;[]
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
018&nbsp;&nbsp;&nbsp;&nbsp;(-&gt;&nbsp;(OffsetDateTime&#x2F;now&nbsp;(ZoneOffset&#x2F;UTC))
</span><br/>
<span class="not-covered" title="0 out of 1 forms covered">
019&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(.format&nbsp;DateTimeFormatter&#x2F;RFC_1123_DATE_TIME)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
020&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
021&nbsp;&nbsp;(defn&nbsp;digest
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
022&nbsp;&nbsp;&nbsp;&nbsp;&quot;Accepts&nbsp;body&nbsp;from&nbsp;HTTP&nbsp;request&nbsp;and&nbsp;generates&nbsp;string
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
023&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;use&nbsp;in&nbsp;HTTP&nbsp;`Digest`&nbsp;request&nbsp;header.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
024&nbsp;&nbsp;&nbsp;&nbsp;[body]
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
025&nbsp;&nbsp;&nbsp;&nbsp;(str&nbsp;&quot;sha-256=&quot;&nbsp;(crypto&#x2F;sha256-base64&nbsp;body)))
</span><br/>
</body>
</html>

View file

@ -0,0 +1,140 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../coverage.css"/> <title> clj_activitypub/internal/thread_cache.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;clj-activitypub.internal.thread-cache)
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
002&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
003&nbsp;&nbsp;(defn-&nbsp;current-time&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&quot;Returns&nbsp;current&nbsp;time&nbsp;using&nbsp;UNIX&nbsp;epoch.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
005&nbsp;&nbsp;&nbsp;&nbsp;[]
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
006&nbsp;&nbsp;&nbsp;&nbsp;(System&#x2F;currentTimeMillis))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
007&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
008&nbsp;&nbsp;(defn-&nbsp;update-read-at&nbsp;[store&nbsp;k&nbsp;v]
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
009&nbsp;&nbsp;&nbsp;&nbsp;(dosync
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
010&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(commute&nbsp;store&nbsp;assoc&nbsp;k
</span><br/>
<span class="covered" title="7 out of 7 forms covered">
011&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(merge&nbsp;v&nbsp;{:read-at&nbsp;(current-time)}))))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
012&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
013&nbsp;&nbsp;(defn&nbsp;make&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
014&nbsp;&nbsp;&nbsp;&nbsp;&quot;Creates&nbsp;a&nbsp;thread-local&nbsp;cache.&quot;
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
015&nbsp;&nbsp;&nbsp;&nbsp;([]&nbsp;(make&nbsp;false))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
016&nbsp;&nbsp;&nbsp;&nbsp;([cache-if-nil]
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
017&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[store&nbsp;(ref&nbsp;{})]
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
018&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(letfn&nbsp;[(cache-kv&nbsp;([k&nbsp;v]
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
019&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(dosync
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(commute&nbsp;store&nbsp;assoc&nbsp;k
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
021&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:write-at&nbsp;(current-time)&nbsp;
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
022&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:read-at&nbsp;(current-time)&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
023&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:value&nbsp;v})
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
024&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v)))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
025&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(get-v&nbsp;([k]
</span><br/>
<span class="covered" title="11 out of 11 forms covered">
026&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(when-let&nbsp;[data&nbsp;(get&nbsp;@store&nbsp;k)]
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
027&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(update-read-at&nbsp;store&nbsp;k&nbsp;data)
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
028&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(:value&nbsp;data)))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
029&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;([k&nbsp;compute-fn]
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
030&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[storage&nbsp;@store]
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
031&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(if&nbsp;(contains?&nbsp;storage&nbsp;k)
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(get-v&nbsp;k)
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
033&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[v&nbsp;(compute-fn)]
</span><br/>
<span class="partial" title="11 out of 12 forms covered">
034&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(when&nbsp;(or&nbsp;(not&nbsp;(nil?&nbsp;v))&nbsp;cache-if-nil)
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
035&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(cache-kv&nbsp;k&nbsp;v)
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
036&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(get-v&nbsp;k)))))))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
037&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(lru&nbsp;([]
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
038&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(mapv
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
039&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(fn&nbsp;[[k&nbsp;v]]&nbsp;[k&nbsp;(:value&nbsp;v)])
</span><br/>
<span class="not-covered" title="0 out of 12 forms covered">
040&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(sort-by&nbsp;#(-&gt;&nbsp;%&nbsp;val&nbsp;:read-at)&nbsp;&lt;&nbsp;@store))))]
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
041&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{:cache-kv&nbsp;cache-kv&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
042&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:get-v&nbsp;get-v
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
043&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:cache-if-nil&nbsp;cache-if-nil
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
044&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:lru&nbsp;lru}))))
</span><br/>
</body>
</html>

View file

@ -0,0 +1,104 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../coverage.css"/> <title> clj_activitypub/webfinger.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;clj-activitypub.webfinger
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
002&nbsp;&nbsp;&nbsp;&nbsp;(:require&nbsp;[clj-http.client&nbsp;:as&nbsp;client]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
003&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-activitypub.internal.http-util&nbsp;:as&nbsp;http]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-activitypub.internal.thread-cache&nbsp;:as&nbsp;thread-cache]))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
005&nbsp;&nbsp;
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
006&nbsp;&nbsp;(def&nbsp;remote-uri-path&nbsp;&quot;&#x2F;.well-known&#x2F;webfinger&quot;)
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
007&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
008&nbsp;&nbsp;(defn-&nbsp;resource-str&nbsp;[domain&nbsp;username]
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
009&nbsp;&nbsp;&nbsp;&nbsp;(str&nbsp;&quot;acct:&quot;&nbsp;username&nbsp;&quot;@&quot;&nbsp;domain))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
010&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
011&nbsp;&nbsp;(defn&nbsp;resource-url
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
012&nbsp;&nbsp;&nbsp;&nbsp;&quot;Builds&nbsp;a&nbsp;URL&nbsp;pointing&nbsp;to&nbsp;the&nbsp;user&#x27;s&nbsp;account&nbsp;on&nbsp;the&nbsp;remote&nbsp;server.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
013&nbsp;&nbsp;&nbsp;&nbsp;[domain&nbsp;username&nbsp;&amp;&nbsp;[params]]
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
014&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[resource&nbsp;(resource-str&nbsp;domain&nbsp;username)
</span><br/>
<span class="covered" title="8 out of 8 forms covered">
015&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;query-str&nbsp;(http&#x2F;encode-url-params&nbsp;(merge&nbsp;params&nbsp;{:resource&nbsp;resource}))]
</span><br/>
<span class="covered" title="7 out of 7 forms covered">
016&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(str&nbsp;&quot;https:&#x2F;&#x2F;&quot;&nbsp;domain&nbsp;remote-uri-path&nbsp;&quot;?&quot;&nbsp;query-str)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
017&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
018&nbsp;&nbsp;(def&nbsp;^:private&nbsp;user-id-cache
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
019&nbsp;&nbsp;&nbsp;&nbsp;(thread-cache&#x2F;make))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
020&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
021&nbsp;&nbsp;(defn&nbsp;fetch-user-id
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
022&nbsp;&nbsp;&nbsp;&nbsp;&quot;Follows&nbsp;the&nbsp;webfinger&nbsp;request&nbsp;to&nbsp;a&nbsp;remote&nbsp;domain,&nbsp;retrieving&nbsp;the&nbsp;ID&nbsp;of&nbsp;the&nbsp;requested
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
023&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;account.&nbsp;Typically&nbsp;returns&nbsp;a&nbsp;string&nbsp;in&nbsp;the&nbsp;form&nbsp;of&nbsp;a&nbsp;URL.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
024&nbsp;&nbsp;&nbsp;&nbsp;[domain&nbsp;username]
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
025&nbsp;&nbsp;&nbsp;&nbsp;((:get-v&nbsp;user-id-cache)
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
026&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(str&nbsp;domain&nbsp;&quot;@&quot;&nbsp;username)&nbsp;;;&nbsp;cache&nbsp;key
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
027&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(fn&nbsp;[]
</span><br/>
<span class="partial" title="15 out of 16 forms covered">
028&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[response&nbsp;(some-&gt;&nbsp;(resource-url&nbsp;domain&nbsp;username&nbsp;{:rel&nbsp;&quot;self&quot;})
</span><br/>
<span class="covered" title="8 out of 8 forms covered">
029&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(client&#x2F;get&nbsp;{:as&nbsp;:json&nbsp;:throw-exceptions&nbsp;false&nbsp;:ignore-unknown-host?&nbsp;true}))]
</span><br/>
<span class="partial" title="27 out of 31 forms covered">
030&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(some-&gt;&gt;&nbsp;response&nbsp;:body&nbsp;:links
</span><br/>
<span class="covered" title="12 out of 12 forms covered">
031&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(some&nbsp;#(when&nbsp;(=&nbsp;(:type&nbsp;%)&nbsp;&quot;application&#x2F;activity+json&quot;)&nbsp;%))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:href)))))
</span><br/>
</body>
</html>

View file

@ -0,0 +1,54 @@
{"coverage":
{"dog_and_duck/quack/quack.clj":
[null, 1, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, 1, null,
null, null, null, null, null, null, null, null, null, null, null,
17, null, 1, null, null, null, null, null, true, 5, null, null, 1,
null, 1, null, null, null, null, 1, null, null, null, null, null, 1,
null, null, 4, null, 1, null, null, null, null, 1, null, null, null,
null, 1, null, null, 4, null, 1, null, null, null, null, 1, null,
null, null, null, null, null, true, 10, 9, true, 2, null, null,
null, true, 2, null, 1, null, null, true, 2, 2, 0, 0, 0, null, null,
1, null, null, 0, 0, 0, 0, 0, 0, 0, null, null, null, 1, null, null,
0, 0, 0, null, null, 1, null, null, null, null, null, 0, 0, 0, null,
null, 1, null, null, null, null, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
null, null, 0, 0, null, 1, null, null, 0, null, 1, null, null, 0,
null, 1, null, null, 0, null, 1, null, null, 0, null, null],
"clj_activitypub/internal/http_util.clj":
[null, 1, null, null, null, null, null, 1, 1, 1, 1, 2, 2, 1, 1, 1,
null, 1, 0, 0, null, 1, null, null, null, 0],
"clj_activitypub/internal/thread_cache.clj":
[null, 1, null, 1, null, null, 8, null, 1, 4, 4, 4, null, 1, null, 2,
null, 2, 2, 2, 2, 2, 2, 2, 2, null, 4, 4, 4, null, 4, 4, 2, 2, true,
2, 2, null, 0, 0, 0, 2, 2, 2, 2],
"dog_and_duck/scratch/parser.clj":
[null, 1, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null,
null, 1, null, null, null, 7, 7, 7, 7, 7, true, 0, null, 1, null, 1,
0, 0, 0, 0, 0, 0, 1],
"clj_activitypub/core.clj":
[null, 1, null, null, null, null, null, null, 1, null, null, null,
null, null, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null, null, null, 6, 2,
2, null, 1, 1, null, null, null, 1, 1, 1, 1, null, null, 1, null, 1,
null, null, null, 0, null, 0, null, 0, 0, 0, 0, 0, 0, null, 1, null,
1, 0, 0, 0, 0, 0, 0, 0, 0, null, 1, null, null, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, null, 1, null, null, null, 0, 0, 0, 0, 0, 0, 0, null, 1,
null, null, null, true, null, 1, null, null, null, null, null, 0,
null, 0, 0, 0, 0, 0, null, 1, null, null, null, true, null, 1, 0,
null, null, 0, 0, null, 1, 0, null, null, 0, 0, null, 1, null, null,
null, 0, 0, 0, 0, 0, 0],
"clj_activitypub/internal/crypto.clj":
[null, 1, null, null, null, null, 1, 1, null, 1, 0, 0, null, null, 1,
0, 0, null, 1, 0, 0, null, null, 1, 0, null, 1, 0, 0, null, 1, 0, 0,
0, 0, 0, null],
"dog_and_duck/scratch/core.clj":[null, 1, null, 1, null, null, 0],
"clj_activitypub/webfinger.clj":
[null, 1, null, null, null, null, 1, null, 1, 1, null, 1, null, null,
1, 1, 1, null, 1, 1, null, 1, null, null, null, 3, 3, 3, true, 1,
true, 2, null],
"dog_and_duck/scratch/scratch.clj":
[null, 1, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, 1, null, 1, 1, 1, null, null, null,
null, 1, null, 1, 1, 1, 1, null, null, 1, null, null, 1, 1, null,
null, null, null, 1, 1, 1, 1, 1, 1, null]}}

View file

@ -0,0 +1,40 @@
.covered {
font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
background-color: #558B55;
}
.not-covered {
font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
background-color: red;
}
.partial {
font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
background-color: orange;
}
.not-tracked {
font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
}
.blank {
font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
}
td {
padding-right: 10px;
}
td.with-bar {
width: 250px;
text-align: center;
}
td.with-number {
text-align: right;
}
td.ns-name {
min-width: 150px;
padding-right: 25px;
}

View file

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><report><stats><packages value="9"/><methods value="1223"/><srcfiles value="9"/><srclines value="284"/></stats><data><all name="total"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="52% (631/1223)"/><coverage type="line, %" value="54% (153/284)"/><package name="dog-and-duck.scratch.scratch"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="100% (75/75)"/><coverage type="line, %" value="100% (19/19)"/></package><package name="clj-activitypub.internal.thread-cache"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="83% (105/126)"/><coverage type="line, %" value="88% (30/34)"/></package><package name="clj-activitypub.internal.crypto"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="19% (9/48)"/><coverage type="line, %" value="39% (9/23)"/></package><package name="dog-and-duck.quack.quack"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="44% (199/448)"/><coverage type="line, %" value="46% (31/68)"/></package><package name="clj-activitypub.webfinger"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="96% (107/112)"/><coverage type="line, %" value="89% (16/18)"/></package><package name="clj-activitypub.internal.http-util"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="74% (29/39)"/><coverage type="line, %" value="80% (12/15)"/></package><package name="dog-and-duck.scratch.core"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="33% (2/6)"/><coverage type="line, %" value="67% (2/3)"/></package><package name="dog-and-duck.scratch.parser"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="50% (34/68)"/><coverage type="line, %" value="56% (10/18)"/></package><package name="clj-activitypub.core"><coverage type="class, %" value="0% (0/1)"/><coverage type="method, %" value="0% (0/1)"/><coverage type="block, %" value="24% (71/301)"/><coverage type="line, %" value="28% (24/86)"/></package></all></data></report>

View file

@ -0,0 +1,569 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../coverage.css"/> <title> dog_and_duck/quack/quack.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;dog-and-duck.quack.quack
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
002&nbsp;&nbsp;&nbsp;&nbsp;&quot;Validator&nbsp;for&nbsp;ActivityPub&nbsp;objects:&nbsp;if&nbsp;it&nbsp;walks&nbsp;like&nbsp;a&nbsp;duck,&nbsp;and&nbsp;it&nbsp;quacks&nbsp;like&nbsp;a&nbsp;duck...&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
003&nbsp;&nbsp;&nbsp;&nbsp;;;(:require&nbsp;[clojure.spec.alpha&nbsp;as&nbsp;s])
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;(:import&nbsp;[java.net&nbsp;URI&nbsp;URISyntaxException]))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
005&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
006&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copyright&nbsp;(C)&nbsp;Simon&nbsp;Brooke,&nbsp;2022
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
007&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
008&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;program&nbsp;is&nbsp;free&nbsp;software;&nbsp;you&nbsp;can&nbsp;redistribute&nbsp;it&nbsp;and&#x2F;or
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
009&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modify&nbsp;it&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
010&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;published&nbsp;by&nbsp;the&nbsp;Free&nbsp;Software&nbsp;Foundation;&nbsp;either&nbsp;version&nbsp;2
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
011&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;the&nbsp;License,&nbsp;or&nbsp;(at&nbsp;your&nbsp;option)&nbsp;any&nbsp;later&nbsp;version.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
012&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
013&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;program&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
014&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
015&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;See&nbsp;the
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
016&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
017&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
018&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
019&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;along&nbsp;with&nbsp;this&nbsp;program;&nbsp;if&nbsp;not,&nbsp;write&nbsp;to&nbsp;the&nbsp;Free&nbsp;Software
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
020&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Foundation,&nbsp;Inc.,&nbsp;51&nbsp;Franklin&nbsp;Street,&nbsp;Fifth&nbsp;Floor,&nbsp;Boston,&nbsp;MA&nbsp;&nbsp;02110-1301,&nbsp;USA.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
021&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
022&nbsp;&nbsp;(defn&nbsp;object?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
023&nbsp;&nbsp;&nbsp;&nbsp;&quot;Returns&nbsp;`true`&nbsp;iff&nbsp;`x`&nbsp;is&nbsp;recognisably&nbsp;an&nbsp;ActivityStreams&nbsp;object.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
024&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
025&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**NOTE&nbsp;THAT**&nbsp;The&nbsp;ActivityStreams&nbsp;spec&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
026&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[says](https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;activitystreams-core&#x2F;#object):
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
027&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
028&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;&nbsp;All&nbsp;properties&nbsp;are&nbsp;optional&nbsp;(including&nbsp;the&nbsp;id&nbsp;and&nbsp;type)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
029&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
030&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;But&nbsp;we&nbsp;are&nbsp;*just&nbsp;not&nbsp;having&nbsp;that*,&nbsp;because&nbsp;otherwise&nbsp;we&#x27;re&nbsp;flying&nbsp;blind.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
031&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;We&nbsp;*shall*&nbsp;reject&nbsp;objects&nbsp;lacking&nbsp;at&nbsp;least&nbsp;`:type`.&nbsp;Missing&nbsp;`:id`&nbsp;keys&nbsp;are
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tolerable&nbsp;because&nbsp;they&nbsp;represent&nbsp;transient&nbsp;objects,&nbsp;which&nbsp;we&nbsp;expect&nbsp;to&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
033&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handle.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
034&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="covered" title="15 out of 15 forms covered">
035&nbsp;&nbsp;&nbsp;&nbsp;(and&nbsp;(map?&nbsp;x)&nbsp;(:type&nbsp;x)&nbsp;true))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
036&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
037&nbsp;&nbsp;(defn&nbsp;persistent-object?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
038&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;is&nbsp;a&nbsp;persistent&nbsp;object.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
039&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
040&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Transient&nbsp;objects&nbsp;in&nbsp;ActivityPub&nbsp;are&nbsp;not&nbsp;required&nbsp;to&nbsp;have&nbsp;an&nbsp;`id`&nbsp;key,&nbsp;but&nbsp;persistent
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
041&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ones&nbsp;must&nbsp;have&nbsp;a&nbsp;key,&nbsp;and&nbsp;it&nbsp;must&nbsp;be&nbsp;an&nbsp;IRI&nbsp;(but&nbsp;normally&nbsp;a&nbsp;URI).&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
042&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="partial" title="1 out of 2 forms covered">
043&nbsp;&nbsp;&nbsp;&nbsp;(try
</span><br/>
<span class="covered" title="13 out of 13 forms covered">
044&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(and&nbsp;(object?&nbsp;x)&nbsp;(uri?&nbsp;(URI.&nbsp;(:id&nbsp;x))))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
045&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(catch&nbsp;URISyntaxException&nbsp;_&nbsp;false)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
046&nbsp;&nbsp;
</span><br/>
<span class="covered" title="7 out of 7 forms covered">
047&nbsp;&nbsp;(persistent-object?&nbsp;{:type&nbsp;&quot;test&quot;&nbsp;:id&nbsp;&quot;https:&#x2F;&#x2F;mastodon.scot&#x2F;@barfilfarm&quot;})
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
048&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
049&nbsp;&nbsp;(def&nbsp;^:const&nbsp;actor-types
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
050&nbsp;&nbsp;&nbsp;&nbsp;&quot;The&nbsp;set&nbsp;of&nbsp;types&nbsp;we&nbsp;will&nbsp;accept&nbsp;as&nbsp;actors.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
051&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
052&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;There&#x27;s&nbsp;an&nbsp;[explicit&nbsp;set&nbsp;of&nbsp;allowed&nbsp;actor&nbsp;types]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
053&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;activitystreams-vocabulary&#x2F;#actor-types).&quot;
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
054&nbsp;&nbsp;&nbsp;&nbsp;#{&quot;Application&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
055&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Group&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
056&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Organization&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
057&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Person&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
058&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Service&quot;})
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
059&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
060&nbsp;&nbsp;(defn&nbsp;actor-type?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
061&nbsp;&nbsp;&nbsp;&nbsp;;;&nbsp;TODO:&nbsp;better&nbsp;as&nbsp;a&nbsp;macro
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
062&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
063&nbsp;&nbsp;&nbsp;&nbsp;(if&nbsp;(actor-types&nbsp;x)&nbsp;true&nbsp;false))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
064&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
065&nbsp;&nbsp;(def&nbsp;^:const&nbsp;verb-types
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
066&nbsp;&nbsp;&nbsp;&nbsp;&quot;The&nbsp;set&nbsp;of&nbsp;types&nbsp;we&nbsp;will&nbsp;accept&nbsp;as&nbsp;verbs.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
067&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
068&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;There&#x27;s&nbsp;an&nbsp;[explicit&nbsp;set&nbsp;of&nbsp;allowed&nbsp;verb&nbsp;types]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
069&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;activitystreams-vocabulary&#x2F;#activity-types).&quot;
</span><br/>
<span class="covered" title="29 out of 29 forms covered">
070&nbsp;&nbsp;&nbsp;&nbsp;#{&quot;Accept&quot;&nbsp;&quot;Add&quot;&nbsp;&quot;Announce&quot;&nbsp;&quot;Arrive&quot;&nbsp;&quot;Block&quot;&nbsp;&quot;Create&quot;&nbsp;&quot;Delete&quot;&nbsp;&quot;Dislike&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
071&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Flag&quot;&nbsp;&quot;Follow&quot;&nbsp;&quot;Ignore&quot;&nbsp;&quot;Invite&quot;&nbsp;&quot;Join&quot;&nbsp;&quot;Leave&quot;&nbsp;&quot;Like&quot;&nbsp;&quot;Listen&quot;&nbsp;&quot;Move&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
072&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Offer&quot;&nbsp;&quot;Question&quot;&nbsp;&quot;Reject&quot;&nbsp;&quot;Read&quot;&nbsp;&quot;Remove&quot;&nbsp;&quot;TentativeAccept&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
073&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;TentativeReject&quot;&nbsp;&quot;Travel&quot;&nbsp;&quot;Undo&quot;&nbsp;&quot;Update&quot;&nbsp;&quot;View&quot;})
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
074&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
075&nbsp;&nbsp;(defn&nbsp;verb-type?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
076&nbsp;&nbsp;&nbsp;&nbsp;;;&nbsp;TODO:&nbsp;better&nbsp;as&nbsp;a&nbsp;macro
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
077&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
078&nbsp;&nbsp;&nbsp;&nbsp;(if&nbsp;(verb-types&nbsp;x)&nbsp;true&nbsp;false))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
079&nbsp;&nbsp;
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
080&nbsp;&nbsp;(def&nbsp;^:const&nbsp;activitystreams-context-uri
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
081&nbsp;&nbsp;&nbsp;&nbsp;&quot;The&nbsp;URI&nbsp;of&nbsp;the&nbsp;context&nbsp;of&nbsp;an&nbsp;ActivityStreams&nbsp;object&nbsp;is&nbsp;expected&nbsp;to&nbsp;be&nbsp;this
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
082&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;literal&nbsp;string.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
083&nbsp;&nbsp;&nbsp;&nbsp;&quot;https:&#x2F;&#x2F;www.w3.org&#x2F;ns&#x2F;activitystreams&quot;)
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
084&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
085&nbsp;&nbsp;(defn&nbsp;context?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
086&nbsp;&nbsp;&nbsp;&nbsp;&quot;Returns&nbsp;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;an&nbsp;ActivityStreams&nbsp;context,&nbsp;else&nbsp;false.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
087&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
088&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A&nbsp;context&nbsp;is&nbsp;either
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
089&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp;the&nbsp;URI&nbsp;(actually&nbsp;an&nbsp;IRI)&nbsp;`activitystreams-context-uri`,&nbsp;or
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
090&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;a&nbsp;collection&nbsp;comprising&nbsp;that&nbsp;URI&nbsp;and&nbsp;a&nbsp;map.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
091&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="partial" title="4 out of 6 forms covered">
092&nbsp;&nbsp;&nbsp;&nbsp;(cond
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
093&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(nil?&nbsp;x)&nbsp;false
</span><br/>
<span class="covered" title="11 out of 11 forms covered">
094&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(string?&nbsp;x)&nbsp;(and&nbsp;(=&nbsp;x&nbsp;activitystreams-context-uri)&nbsp;true)
</span><br/>
<span class="partial" title="19 out of 20 forms covered">
095&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(coll?&nbsp;x)&nbsp;(and&nbsp;(context?&nbsp;(first&nbsp;(remove&nbsp;map?&nbsp;x)))&nbsp;
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
096&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(=&nbsp;(count&nbsp;x)&nbsp;2)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
097&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
098&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:else&nbsp;false))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
099&nbsp;&nbsp;
</span><br/>
<span class="partial" title="40 out of 42 forms covered">
100&nbsp;&nbsp;(defmacro&nbsp;has-context?&nbsp;[x]
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
101&nbsp;&nbsp;&nbsp;&nbsp;`(context?&nbsp;((keyword&nbsp;&quot;@context&quot;)&nbsp;~x)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
102&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
103&nbsp;&nbsp;(defn&nbsp;actor?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
104&nbsp;&nbsp;&nbsp;&nbsp;&quot;Returns&nbsp;`true`&nbsp;if&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;an&nbsp;actor,&nbsp;else&nbsp;false.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
105&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="partial" title="7 out of 21 forms covered">
106&nbsp;&nbsp;&nbsp;&nbsp;(and
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
107&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(object?&nbsp;x)
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
108&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(has-context?&nbsp;x)
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
109&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(uri?&nbsp;(URI.&nbsp;(:inbox&nbsp;x)))
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
110&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(uri?&nbsp;(URI.&nbsp;(:outbox&nbsp;x)))
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
111&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(actor-type?&nbsp;(:type&nbsp;x))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
112&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
113&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
114&nbsp;&nbsp;(defn&nbsp;activity?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
115&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;an&nbsp;activity,&nbsp;else&nbsp;false.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
116&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
117&nbsp;&nbsp;&nbsp;&nbsp;(try
</span><br/>
<span class="not-covered" title="0 out of 28 forms covered">
118&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(and&nbsp;(object?&nbsp;x)
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
119&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(has-context?&nbsp;x)
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
120&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(string?&nbsp;(:summary&nbsp;x))
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
121&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(actor?&nbsp;(:actor&nbsp;x))
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
122&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(verb-type?&nbsp;(:type&nbsp;x))
</span><br/>
<span class="not-covered" title="0 out of 15 forms covered">
123&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(or&nbsp;(object?&nbsp;(:object&nbsp;x))&nbsp;(uri?&nbsp;(URI.&nbsp;(:object&nbsp;x))))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
124&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true)
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
125&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(catch&nbsp;URISyntaxException&nbsp;_&nbsp;false)))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
126&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
127&nbsp;&nbsp;(defn&nbsp;link?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
128&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;a&nbsp;link,&nbsp;else&nbsp;false.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
129&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 16 forms covered">
130&nbsp;&nbsp;&nbsp;&nbsp;(and&nbsp;(object?&nbsp;x)
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
131&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(=&nbsp;(:type&nbsp;x)&nbsp;&quot;Link&quot;)
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
132&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(uri?&nbsp;(URI.&nbsp;(:href&nbsp;x)))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
133&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
134&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
135&nbsp;&nbsp;(defn&nbsp;link-or-uri?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
136&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;is&nbsp;either&nbsp;a&nbsp;URI&nbsp;or&nbsp;a&nbsp;link,&nbsp;else&nbsp;false.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
137&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
138&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;There&nbsp;are&nbsp;several&nbsp;points&nbsp;in&nbsp;the&nbsp;specification&nbsp;where&nbsp;e.g.&nbsp;the&nbsp;`:image`
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
139&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;property&nbsp;(if&nbsp;present)&nbsp;may&nbsp;be&nbsp;either&nbsp;a&nbsp;link&nbsp;or&nbsp;a&nbsp;URI.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
140&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
141&nbsp;&nbsp;&nbsp;&nbsp;(and
</span><br/>
<span class="not-covered" title="0 out of 9 forms covered">
142&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(cond&nbsp;(string?&nbsp;x)&nbsp;(uri?&nbsp;(URI.&nbsp;x))
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
143&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:else&nbsp;(link?&nbsp;x))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
144&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
145&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
146&nbsp;&nbsp;(defn&nbsp;collection?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
147&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;a&nbsp;collection&nbsp;of&nbsp;type&nbsp;`type`,&nbsp;else&nbsp;`false`.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
148&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
149&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;With&nbsp;one&nbsp;argument,&nbsp;will&nbsp;recognise&nbsp;plain&nbsp;collections&nbsp;and&nbsp;ordered&nbsp;collections,
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
150&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;(currently)&nbsp;not&nbsp;collection&nbsp;pages.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
151&nbsp;&nbsp;&nbsp;&nbsp;([x&nbsp;type]
</span><br/>
<span class="not-covered" title="0 out of 11 forms covered">
152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[items&nbsp;(or&nbsp;(:items&nbsp;x)&nbsp;(:orderedItems&nbsp;x))]
</span><br/>
<span class="not-covered" title="0 out of 25 forms covered">
153&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(and
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
154&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(cond
</span><br/>
<span class="not-covered" title="0 out of 8 forms covered">
155&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(:items&nbsp;x)&nbsp;(nil?&nbsp;(:orderedItems&nbsp;x))
</span><br/>
<span class="not-covered" title="0 out of 8 forms covered">
156&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(:orderedItems&nbsp;x)&nbsp;(nil?&nbsp;(:items&nbsp;x)))&nbsp;;;&nbsp;can&#x27;t&nbsp;have&nbsp;both&nbsp;properties
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
157&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(object?&nbsp;x)
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(=&nbsp;(:type&nbsp;x)&nbsp;type)
</span><br/>
<span class="not-covered" title="0 out of 3 forms covered">
159&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(coll?&nbsp;items)
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
160&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(every?&nbsp;object?&nbsp;items)
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
161&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(integer?&nbsp;(:totalItems&nbsp;x))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
162&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true)))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
163&nbsp;&nbsp;&nbsp;&nbsp;([x]
</span><br/>
<span class="not-covered" title="0 out of 10 forms covered">
164&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(or&nbsp;(collection?&nbsp;x&nbsp;&quot;Collection&quot;)
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
165&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(collection?&nbsp;x&nbsp;&quot;OrderedCollection&quot;))))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
166&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
167&nbsp;&nbsp;(defn&nbsp;unordered-collection?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
168&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;an&nbsp;unordered&nbsp;collection,&nbsp;else&nbsp;`false`.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
169&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
170&nbsp;&nbsp;&nbsp;&nbsp;(collection?&nbsp;x&nbsp;&quot;Collection&quot;))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
171&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
172&nbsp;&nbsp;(defn&nbsp;ordered-collection?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
173&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;an&nbsp;ordered&nbsp;collection,&nbsp;else&nbsp;`false`.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
174&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
175&nbsp;&nbsp;&nbsp;&nbsp;(collection?&nbsp;x&nbsp;&quot;OrderedCollection&quot;))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
176&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
177&nbsp;&nbsp;(defn&nbsp;collection-page?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
178&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;a&nbsp;page&nbsp;in&nbsp;a&nbsp;paged&nbsp;collection,&nbsp;else&nbsp;`false`.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
179&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
180&nbsp;&nbsp;&nbsp;&nbsp;(collection?&nbsp;x&nbsp;&quot;CollectionPage&quot;))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
181&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
182&nbsp;&nbsp;(defn&nbsp;ordered-collection-page?
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
183&nbsp;&nbsp;&nbsp;&nbsp;&quot;`true`&nbsp;iff&nbsp;`x`&nbsp;quacks&nbsp;like&nbsp;a&nbsp;page&nbsp;in&nbsp;an&nbsp;ordered&nbsp;paged&nbsp;collection,&nbsp;else&nbsp;`false`.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
184&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
185&nbsp;&nbsp;&nbsp;&nbsp;(collection?&nbsp;x&nbsp;&quot;OrderedCollectionPage&quot;))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
186&nbsp;&nbsp;
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
187&nbsp;&nbsp;
</span><br/>
</body>
</html>

View file

@ -0,0 +1,26 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../coverage.css"/> <title> dog_and_duck/scratch/core.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;dog-and-duck.scratch.core)
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
002&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
003&nbsp;&nbsp;(defn&nbsp;foo
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&quot;I&nbsp;don&#x27;t&nbsp;do&nbsp;a&nbsp;whole&nbsp;lot.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
005&nbsp;&nbsp;&nbsp;&nbsp;[x]
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
006&nbsp;&nbsp;&nbsp;&nbsp;(println&nbsp;x&nbsp;&quot;Hello,&nbsp;World!&quot;))
</span><br/>
</body>
</html>

View file

@ -0,0 +1,143 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../coverage.css"/> <title> dog_and_duck/scratch/parser.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;dog-and-duck.scratch.parser
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
002&nbsp;&nbsp;&nbsp;&nbsp;(:require&nbsp;[clojure.java.io&nbsp;:refer&nbsp;[file]]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
003&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clojure.string&nbsp;:refer&nbsp;[ends-with?]]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clojure.walk&nbsp;:refer&nbsp;[keywordize-keys]]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
005&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clojure.data.json&nbsp;:as&nbsp;json]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
006&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[dog-and-duck.quack.quack&nbsp;:as&nbsp;q]))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
007&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
008&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copyright&nbsp;(C)&nbsp;Simon&nbsp;Brooke,&nbsp;2022
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
009&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
010&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;program&nbsp;is&nbsp;free&nbsp;software;&nbsp;you&nbsp;can&nbsp;redistribute&nbsp;it&nbsp;and&#x2F;or
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
011&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modify&nbsp;it&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
012&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;published&nbsp;by&nbsp;the&nbsp;Free&nbsp;Software&nbsp;Foundation;&nbsp;either&nbsp;version&nbsp;2
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
013&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;the&nbsp;License,&nbsp;or&nbsp;(at&nbsp;your&nbsp;option)&nbsp;any&nbsp;later&nbsp;version.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
014&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
015&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;program&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
016&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
017&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;See&nbsp;the
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
018&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
019&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
020&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
021&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;along&nbsp;with&nbsp;this&nbsp;program;&nbsp;if&nbsp;not,&nbsp;write&nbsp;to&nbsp;the&nbsp;Free&nbsp;Software
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
022&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Foundation,&nbsp;Inc.,&nbsp;51&nbsp;Franklin&nbsp;Street,&nbsp;Fifth&nbsp;Floor,&nbsp;Boston,&nbsp;MA&nbsp;&nbsp;02110-1301,&nbsp;USA.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
023&nbsp;&nbsp;
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
024&nbsp;&nbsp;(defn&nbsp;clean
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
025&nbsp;&nbsp;&nbsp;&nbsp;&quot;Take&nbsp;this&nbsp;`json`&nbsp;input,&nbsp;and&nbsp;return&nbsp;a&nbsp;sequence&nbsp;of&nbsp;ActivityPub&nbsp;objects&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
026&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;represented&nbsp;by&nbsp;it.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
027&nbsp;&nbsp;&nbsp;&nbsp;[json]
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
028&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[feed&nbsp;(json&#x2F;read-str&nbsp;json)]
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
029&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(map
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
030&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keywordize-keys
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
031&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(filter
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
032&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;q&#x2F;object?
</span><br/>
<span class="partial" title="9 out of 11 forms covered">
033&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(cond&nbsp;(map?&nbsp;feed)&nbsp;(list&nbsp;(keywordize-keys&nbsp;feed))
</span><br/>
<span class="not-covered" title="0 out of 7 forms covered">
034&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(coll?&nbsp;feed)&nbsp;(map&nbsp;keywordize-keys&nbsp;feed))))))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
035&nbsp;&nbsp;
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
036&nbsp;&nbsp;(clean&nbsp;(slurp&nbsp;&quot;resources&#x2F;activitystreams-test-documents&#x2F;core-ex1-jsonld.json&quot;))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
037&nbsp;&nbsp;
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
038&nbsp;&nbsp;(map
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
039&nbsp;&nbsp;&nbsp;#(when&nbsp;
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
040&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ends-with?&nbsp;(str&nbsp;%)&nbsp;&quot;.json&quot;)&nbsp;
</span><br/>
<span class="not-covered" title="0 out of 6 forms covered">
041&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[objects&nbsp;(clean&nbsp;(slurp&nbsp;%))]
</span><br/>
<span class="not-covered" title="0 out of 5 forms covered">
042&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(list&nbsp;(str&nbsp;%)&nbsp;
</span><br/>
<span class="not-covered" title="0 out of 2 forms covered">
043&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(count&nbsp;objects)&nbsp;
</span><br/>
<span class="not-covered" title="0 out of 4 forms covered">
044&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(map&nbsp;:type&nbsp;objects))))
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
045&nbsp;&nbsp;&nbsp;(file-seq&nbsp;(file&nbsp;&quot;resources&#x2F;activitystreams-test-documents&quot;)))
</span><br/>
</body>
</html>

View file

@ -0,0 +1,188 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="../../coverage.css"/> <title> dog_and_duck/scratch/scratch.clj </title>
</head>
<body>
<span class="covered" title="1 out of 1 forms covered">
001&nbsp;&nbsp;(ns&nbsp;dog-and-duck.scratch.scratch
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
002&nbsp;&nbsp;&nbsp;&nbsp;&quot;Scratchpad&nbsp;where&nbsp;I&nbsp;try&nbsp;to&nbsp;understand&nbsp;how&nbsp;to&nbsp;do&nbsp;this&nbsp;stuff.&quot;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
003&nbsp;&nbsp;&nbsp;&nbsp;(:require&nbsp;[clj-activitypub.core&nbsp;:as&nbsp;activitypub]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
004&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-activitypub.webfinger&nbsp;:as&nbsp;webfinger]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
005&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-pgp.core&nbsp;:as&nbsp;pgp]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
006&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-pgp.keyring&nbsp;:as&nbsp;keyring]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
007&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clj-pgp.generate&nbsp;:as&nbsp;pgp-gen]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
008&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clojure.walk&nbsp;:refer&nbsp;[keywordize-keys]]
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
009&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[clojure.pprint&nbsp;:refer&nbsp;[pprint]]))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
010&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
011&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copyright&nbsp;(C)&nbsp;Simon&nbsp;Brooke,&nbsp;2022
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
012&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
013&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;program&nbsp;is&nbsp;free&nbsp;software;&nbsp;you&nbsp;can&nbsp;redistribute&nbsp;it&nbsp;and&#x2F;or
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
014&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modify&nbsp;it&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
015&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;published&nbsp;by&nbsp;the&nbsp;Free&nbsp;Software&nbsp;Foundation;&nbsp;either&nbsp;version&nbsp;2
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
016&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of&nbsp;the&nbsp;License,&nbsp;or&nbsp;(at&nbsp;your&nbsp;option)&nbsp;any&nbsp;later&nbsp;version.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
017&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
018&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;program&nbsp;is&nbsp;distributed&nbsp;in&nbsp;the&nbsp;hope&nbsp;that&nbsp;it&nbsp;will&nbsp;be&nbsp;useful,
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
019&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;but&nbsp;WITHOUT&nbsp;ANY&nbsp;WARRANTY;&nbsp;without&nbsp;even&nbsp;the&nbsp;implied&nbsp;warranty&nbsp;of
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
020&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MERCHANTABILITY&nbsp;or&nbsp;FITNESS&nbsp;FOR&nbsp;A&nbsp;PARTICULAR&nbsp;PURPOSE.&nbsp;&nbsp;See&nbsp;the
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
021&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License&nbsp;for&nbsp;more&nbsp;details.
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
022&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
023&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You&nbsp;should&nbsp;have&nbsp;received&nbsp;a&nbsp;copy&nbsp;of&nbsp;the&nbsp;GNU&nbsp;General&nbsp;Public&nbsp;License
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
024&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;along&nbsp;with&nbsp;this&nbsp;program;&nbsp;if&nbsp;not,&nbsp;write&nbsp;to&nbsp;the&nbsp;Free&nbsp;Software
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
025&nbsp;&nbsp;;;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Foundation,&nbsp;Inc.,&nbsp;51&nbsp;Franklin&nbsp;Street,&nbsp;Fifth&nbsp;Floor,&nbsp;Boston,&nbsp;MA&nbsp;&nbsp;02110-1301,&nbsp;USA.
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
026&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
027&nbsp;&nbsp;;;;&nbsp;Use&nbsp;any&nbsp;ActivityPub&nbsp;account&nbsp;handle&nbsp;you&nbsp;like&nbsp;-&nbsp;for&nbsp;example,&nbsp;your&nbsp;own
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
028&nbsp;&nbsp;(def&nbsp;account-handle&nbsp;&quot;@simon_brooke@mastodon.scot&quot;)
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
029&nbsp;&nbsp;
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
030&nbsp;&nbsp;(def&nbsp;handle&nbsp;(activitypub&#x2F;parse-account&nbsp;account-handle))
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
031&nbsp;&nbsp;(webfinger&#x2F;fetch-user-id&nbsp;&quot;mastodon.scot&quot;&nbsp;&quot;simon_brooke&quot;)
</span><br/>
<span class="covered" title="9 out of 9 forms covered">
032&nbsp;&nbsp;(apply&nbsp;webfinger&#x2F;fetch-user-id&nbsp;(map&nbsp;handle&nbsp;[:domain&nbsp;:username]))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
033&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
034&nbsp;&nbsp;;;;&nbsp;Retrieve&nbsp;the&nbsp;account&nbsp;details&nbsp;from&nbsp;its&nbsp;home&nbsp;server
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
035&nbsp;&nbsp;;;;&nbsp;(`keywordize-keys`&nbsp;is&nbsp;not&nbsp;necessary&nbsp;here&nbsp;but&nbsp;produces&nbsp;a&nbsp;more&nbsp;idiomatic&nbsp;clojure
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
036&nbsp;&nbsp;;;;&nbsp;data&nbsp;structure)
</span><br/>
<span class="covered" title="1 out of 1 forms covered">
037&nbsp;&nbsp;(def&nbsp;account
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
038&nbsp;&nbsp;&nbsp;&nbsp;&quot;Fetch&nbsp;my&nbsp;account&nbsp;to&nbsp;mess&nbsp;with&quot;
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
039&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;[handle&nbsp;(activitypub&#x2F;parse-account&nbsp;account-handle)]
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
040&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(keywordize-keys
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
041&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(activitypub&#x2F;fetch-user
</span><br/>
<span class="covered" title="9 out of 9 forms covered">
042&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(apply&nbsp;webfinger&#x2F;fetch-user-id&nbsp;(map&nbsp;handle&nbsp;[:domain&nbsp;:username]))))))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
043&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
044&nbsp;&nbsp;;;;&nbsp;examine&nbsp;what&nbsp;you&nbsp;got&nbsp;back!
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
045&nbsp;&nbsp;(:outbox&nbsp;account)
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
046&nbsp;&nbsp;
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
047&nbsp;&nbsp;
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
048&nbsp;&nbsp;(def&nbsp;rsa&nbsp;(pgp-gen&#x2F;rsa-keypair-generator&nbsp;2048))
</span><br/>
<span class="covered" title="5 out of 5 forms covered">
049&nbsp;&nbsp;(def&nbsp;kp&nbsp;(pgp-gen&#x2F;generate-keypair&nbsp;rsa&nbsp;:rsa-general))
</span><br/>
<span class="blank" title="0 out of 0 forms covered">
050&nbsp;&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
051&nbsp;&nbsp;;;&nbsp;how&nbsp;we&nbsp;make&nbsp;a&nbsp;public&#x2F;private&nbsp;key&nbsp;pair.&nbsp;But&nbsp;this&nbsp;key&nbsp;pair&nbsp;is&nbsp;not&nbsp;the&nbsp;one&nbsp;
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
052&nbsp;&nbsp;;;&nbsp;known&nbsp;to&nbsp;mastodon.scot&nbsp;as&nbsp;my&nbsp;key&nbsp;pair,&nbsp;so&nbsp;that&nbsp;doesn&#x27;t&nbsp;get&nbsp;us&nbsp;very&nbsp;far...
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
053&nbsp;&nbsp;;;&nbsp;I&nbsp;think.
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
054&nbsp;&nbsp;(let&nbsp;[rsa&nbsp;(pgp-gen&#x2F;rsa-keypair-generator&nbsp;2048)
</span><br/>
<span class="covered" title="4 out of 4 forms covered">
055&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;kp&nbsp;(pgp-gen&#x2F;generate-keypair&nbsp;rsa&nbsp;:rsa-general)
</span><br/>
<span class="covered" title="2 out of 2 forms covered">
056&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;(-&gt;&nbsp;kp&nbsp;.getPublicKey&nbsp;.getEncoded)
</span><br/>
<span class="covered" title="3 out of 3 forms covered">
057&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;(-&gt;&nbsp;kp&nbsp;.getPrivateKey&nbsp;.getPrivateKeyDataPacket&nbsp;.getEncoded)]
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
058&nbsp;&nbsp;&nbsp;&nbsp;(println&nbsp;(str&nbsp;&quot;Public&nbsp;key:&nbsp;&nbsp;&quot;&nbsp;public))
</span><br/>
<span class="covered" title="6 out of 6 forms covered">
059&nbsp;&nbsp;&nbsp;&nbsp;(println&nbsp;(str&nbsp;&quot;Private&nbsp;key:&nbsp;&quot;&nbsp;private))
</span><br/>
<span class="not-tracked" title="0 out of 0 forms covered">
060&nbsp;&nbsp;&nbsp;&nbsp;)
</span><br/>
</body>
</html>

164
docs/cloverage/index.html Normal file
View file

@ -0,0 +1,164 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="./coverage.css"/>
<title>Coverage Summary</title>
</head>
<body>
<table>
<thead><tr>
<td class="ns-name"> Namespace </td>
<td class="with-bar"> Forms </td>
<td class="with-number">Forms %</td>
<td class="with-bar"> Lines </td>
<td class="with-number">Lines %</td>
<td class="with-number">Total</td><td class="with-number">Blank</td><td class="with-number">Instrumented</td>
</tr></thead>
<tr>
<td><a href="clj_activitypub/core.clj.html">clj-activitypub.core</a></td><td class="with-bar"><div class="covered"
style="width:23.588039867109636%;
float:left;"> 71 </div><div class="not-covered"
style="width:76.41196013289037%;
float:left;"> 230 </div></td>
<td class="with-number">23.59 %</td>
<td class="with-bar"><div class="covered"
style="width:27.906976744186046%;
float:left;"> 24 </div><div class="partial"
style="width:2.3255813953488373%;
float:left;"> 2 </div><div class="not-covered"
style="width:69.76744186046511%;
float:left;"> 60 </div></td>
<td class="with-number">30.23 %</td>
<td class="with-number">147</td><td class="with-number">14</td><td class="with-number">86</td>
</tr>
<tr>
<td><a href="clj_activitypub/internal/crypto.clj.html">clj-activitypub.internal.crypto</a></td><td class="with-bar"><div class="covered"
style="width:18.75%;
float:left;"> 9 </div><div class="not-covered"
style="width:81.25%;
float:left;"> 39 </div></td>
<td class="with-number">18.75 %</td>
<td class="with-bar"><div class="covered"
style="width:39.130434782608695%;
float:left;"> 9 </div><div class="not-covered"
style="width:60.869565217391305%;
float:left;"> 14 </div></td>
<td class="with-number">39.13 %</td>
<td class="with-number">36</td><td class="with-number">8</td><td class="with-number">23</td>
</tr>
<tr>
<td><a href="clj_activitypub/internal/http_util.clj.html">clj-activitypub.internal.http-util</a></td><td class="with-bar"><div class="covered"
style="width:74.35897435897436%;
float:left;"> 29 </div><div class="not-covered"
style="width:25.641025641025642%;
float:left;"> 10 </div></td>
<td class="with-number">74.36 %</td>
<td class="with-bar"><div class="covered"
style="width:80.0%;
float:left;"> 12 </div><div class="not-covered"
style="width:20.0%;
float:left;"> 3 </div></td>
<td class="with-number">80.00 %</td>
<td class="with-number">25</td><td class="with-number">3</td><td class="with-number">15</td>
</tr>
<tr>
<td><a href="clj_activitypub/internal/thread_cache.clj.html">clj-activitypub.internal.thread-cache</a></td><td class="with-bar"><div class="covered"
style="width:83.33333333333333%;
float:left;"> 105 </div><div class="not-covered"
style="width:16.666666666666668%;
float:left;"> 21 </div></td>
<td class="with-number">83.33 %</td>
<td class="with-bar"><div class="covered"
style="width:88.23529411764706%;
float:left;"> 30 </div><div class="partial"
style="width:2.9411764705882355%;
float:left;"> 1 </div><div class="not-covered"
style="width:8.823529411764707%;
float:left;"> 3 </div></td>
<td class="with-number">91.18 %</td>
<td class="with-number">44</td><td class="with-number">3</td><td class="with-number">34</td>
</tr>
<tr>
<td><a href="clj_activitypub/webfinger.clj.html">clj-activitypub.webfinger</a></td><td class="with-bar"><div class="covered"
style="width:95.53571428571429%;
float:left;"> 107 </div><div class="not-covered"
style="width:4.464285714285714%;
float:left;"> 5 </div></td>
<td class="with-number">95.54 %</td>
<td class="with-bar"><div class="covered"
style="width:88.88888888888889%;
float:left;"> 16 </div><div class="partial"
style="width:11.11111111111111%;
float:left;"> 2 </div></td>
<td class="with-number">100.00 %</td>
<td class="with-number">32</td><td class="with-number">5</td><td class="with-number">18</td>
</tr>
<tr>
<td><a href="dog_and_duck/quack/quack.clj.html">dog-and-duck.quack.quack</a></td><td class="with-bar"><div class="covered"
style="width:44.419642857142854%;
float:left;"> 199 </div><div class="not-covered"
style="width:55.580357142857146%;
float:left;"> 249 </div></td>
<td class="with-number">44.42 %</td>
<td class="with-bar"><div class="covered"
style="width:45.588235294117645%;
float:left;"> 31 </div><div class="partial"
style="width:7.352941176470588%;
float:left;"> 5 </div><div class="not-covered"
style="width:47.05882352941177%;
float:left;"> 32 </div></td>
<td class="with-number">52.94 %</td>
<td class="with-number">187</td><td class="with-number">26</td><td class="with-number">68</td>
</tr>
<tr>
<td><a href="dog_and_duck/scratch/core.clj.html">dog-and-duck.scratch.core</a></td><td class="with-bar"><div class="covered"
style="width:33.333333333333336%;
float:left;"> 2 </div><div class="not-covered"
style="width:66.66666666666667%;
float:left;"> 4 </div></td>
<td class="with-number">33.33 %</td>
<td class="with-bar"><div class="covered"
style="width:66.66666666666667%;
float:left;"> 2 </div><div class="not-covered"
style="width:33.333333333333336%;
float:left;"> 1 </div></td>
<td class="with-number">66.67 %</td>
<td class="with-number">6</td><td class="with-number">1</td><td class="with-number">3</td>
</tr>
<tr>
<td><a href="dog_and_duck/scratch/parser.clj.html">dog-and-duck.scratch.parser</a></td><td class="with-bar"><div class="covered"
style="width:50.0%;
float:left;"> 34 </div><div class="not-covered"
style="width:50.0%;
float:left;"> 34 </div></td>
<td class="with-number">50.00 %</td>
<td class="with-bar"><div class="covered"
style="width:55.55555555555556%;
float:left;"> 10 </div><div class="partial"
style="width:5.555555555555555%;
float:left;"> 1 </div><div class="not-covered"
style="width:38.888888888888886%;
float:left;"> 7 </div></td>
<td class="with-number">61.11 %</td>
<td class="with-number">45</td><td class="with-number">7</td><td class="with-number">18</td>
</tr>
<tr>
<td><a href="dog_and_duck/scratch/scratch.clj.html">dog-and-duck.scratch.scratch</a></td><td class="with-bar"><div class="covered"
style="width:100.0%;
float:left;"> 75 </div></td>
<td class="with-number">100.00 %</td>
<td class="with-bar"><div class="covered"
style="width:100.0%;
float:left;"> 19 </div></td>
<td class="with-number">100.00 %</td>
<td class="with-number">60</td><td class="with-number">9</td><td class="with-number">19</td>
</tr>
<tr><td>Totals:</td>
<td class="with-bar"></td>
<td class="with-number">51.59 %</td>
<td class="with-bar"></td>
<td class="with-number">57.75 %</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,112 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>Using ActivityPub</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Dog-and-duck</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 current"><a href="Using_ActivityPub.html"><div class="inner"><span>Using ActivityPub</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>The Old Dog and Duck</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clj-activitypub</span></div></div></li><li class="depth-2 branch"><a href="clj-activitypub.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>internal</span></div></div></li><li class="depth-3 branch"><a href="clj-activitypub.internal.crypto.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>crypto</span></div></a></li><li class="depth-3 branch"><a href="clj-activitypub.internal.http-util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http-util</span></div></a></li><li class="depth-3"><a href="clj-activitypub.internal.thread-cache.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>thread-cache</span></div></a></li><li class="depth-2"><a href="clj-activitypub.webfinger.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>webfinger</span></div></a></li><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>dog-and-duck</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>quack</span></div></div></li><li class="depth-3"><a href="dog-and-duck.quack.quack.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>quack</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>scratch</span></div></div></li><li class="depth-3 branch"><a href="dog-and-duck.scratch.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-3 branch"><a href="dog-and-duck.scratch.parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>parser</span></div></a></li><li class="depth-3"><a href="dog-and-duck.scratch.scratch.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scratch</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#using-activitypub" name="using-activitypub"></a>Using ActivityPub</h1>
<pre><code class="clojure">user=&gt; (require '[clj-activitypub.core :as activitypub])
nil
user=&gt; (require '[clj-activitypub.webfinger :as webfinger])
nil
user=&gt; (require '[clojure.walk :refer [keywordize-keys]])
nil
user=&gt; (require '[clojure.pprint :refer [pprint]])
nil
user=&gt; (def base-domain "mastodon.scot")
#'user/base-domain
user=&gt; (def account-handle "@simon_brooke@mastodon.scot")
#'user/account-handle
user=&gt; (in-ns 'user)
#object[clojure.lang.Namespace 0x525575 "user"]
user=&gt; (activitypub/parse-account account-handle )
{:domain "mastodon.scot", :username "simon_brooke"}
user=&gt; (map *1 [:domain :username])
("mastodon.scot" "simon_brooke")
user=&gt; (apply webfinger/fetch-user-id *1)
"https://mastodon.scot/users/simon_brooke"
user=&gt; (activitypub/fetch-user *1)
{"followers" "https://mastodon.scot/users/simon_brooke/followers", "inbox" "https://mastodon.scot/users/simon_brooke/inbox", "url" "https://mastodon.scot/@simon_brooke", "@context" ["https://www.w3.org/ns/activitystreams" "https://w3id.org/security/v1" {"identityKey" {"@type" "@id", "@id" "toot:identityKey"}, "EncryptedMessage" "toot:EncryptedMessage", "Ed25519Key" "toot:Ed25519Key", "devices" {"@type" "@id", "@id" "toot:devices"}, "manuallyApprovesFollowers" "as:manuallyApprovesFollowers", "schema" "http://schema.org#", "PropertyValue" "schema:PropertyValue", "Curve25519Key" "toot:Curve25519Key", "claim" {"@type" "@id", "@id" "toot:claim"}, "value" "schema:value", "Hashtag" "as:Hashtag", "movedTo" {"@id" "as:movedTo", "@type" "@id"}, "discoverable" "toot:discoverable", "messageType" "toot:messageType", "messageFranking" "toot:messageFranking", "cipherText" "toot:cipherText", "toot" "http://joinmastodon.org/ns#", "alsoKnownAs" {"@id" "as:alsoKnownAs", "@type" "@id"}, "featured" {"@id" "toot:featured", "@type" "@id"}, "featuredTags" {"@id" "toot:featuredTags", "@type" "@id"}, "Ed25519Signature" "toot:Ed25519Signature", "focalPoint" {"@container" "@list", "@id" "toot:focalPoint"}, "fingerprintKey" {"@type" "@id", "@id" "toot:fingerprintKey"}, "Device" "toot:Device", "publicKeyBase64" "toot:publicKeyBase64", "deviceId" "toot:deviceId", "suspended" "toot:suspended"}], "devices" "https://mastodon.scot/users/simon_brooke/collections/devices", "manuallyApprovesFollowers" false, "image" {"type" "Image", "mediaType" "image/jpeg", "url" "https://media.mastodon.scot/mastodon-scot-public/accounts/headers/109/252/274/874/045/781/original/e1f1823c4361fa27.jpg"}, "endpoints" {"sharedInbox" "https://mastodon.scot/inbox"}, "id" "https://mastodon.scot/users/simon_brooke", "publicKey" {"id" "https://mastodon.scot/users/simon_brooke#main-key", "owner" "https://mastodon.scot/users/simon_brooke", "publicKeyPem" "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2/6GgLJgJlPhhqFm1tUQ\noSLnWxhDwq4HlZIHrBsVjkSvUAnHKqq42Q/hta+fkWB8rmTFpmjLXDj/Fi0uejvT\nBc+KrLwfX/yR8+G87afGCRS3CaumoLJ7zkBIlsFzIKMoIke1D3QuHX95yGGXs+hp\nmyxt/+CXRyZjK7u9NG7SMRUlpwvOlpD12Aei35Nb8NSr03JvY8/WVMIbWrecyI0b\nAlwj6axxHx7J15Yo+aEtKzZ2OFKXf+sh0QF9BEnYcmVKYlR6kiOglLFHKdCBUSYi\ni9Flv00TydqlGvR5fpShBqORiy0M/FVtNXlz2sNBEsGB2meipkjh+cRLzTbYo4KL\nJwIDAQAB\n-----END PUBLIC KEY-----\n"}, "summary" "&lt;p&gt;Anarcho-syndicalist, autistic, crofter, cyclist, depressive, entrepreneur, geek, Zapatista. Politics &amp;amp; environment, especially &lt;a href=\"https://mastodon.scot/tags/LandReform\" class=\"mention hashtag\" rel=\"tag\"&gt;#&lt;span&gt;LandReform&lt;/span&gt;&lt;/a&gt;. he/him.&lt;/p&gt;&lt;p&gt;Twitter: &lt;span class=\"h-card\"&gt;&lt;a href=\"https://mastodon.scot/@simon_brooke\" class=\"u-url mention\"&gt;@&lt;span&gt;simon_brooke&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;GitHub: simon-brooke&lt;br /&gt;FetLife: Simon_Brooke&lt;/p&gt;&lt;p&gt;Credo: Life is harsh. What we can do - and what we should do - is strive to make it less harsh for the people around us.&lt;/p&gt;", "attachment" [{"type" "PropertyValue", "name" "Home Page", "value" "&lt;a href=\"https://www.journeyman.cc/~simon/\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"&gt;&lt;span class=\"invisible\"&gt;https://www.&lt;/span&gt;&lt;span class=\"\"&gt;journeyman.cc/~simon/&lt;/span&gt;&lt;span class=\"invisible\"&gt;&lt;/span&gt;&lt;/a&gt;"}], "name" "Simon Brooke", "tag" [{"type" "Hashtag", "href" "https://mastodon.scot/tags/landreform", "name" "#landreform"}], "published" "2022-10-29T00:00:00Z", "preferredUsername" "simon_brooke", "discoverable" true, "alsoKnownAs" ["https://mastodon.social/users/simon_brooke"], "featured" "https://mastodon.scot/users/simon_brooke/collections/featured", "featuredTags" "https://mastodon.scot/users/simon_brooke/collections/tags", "type" "Person", "outbox" "https://mastodon.scot/users/simon_brooke/outbox", "following" "https://mastodon.scot/users/simon_brooke/following", "icon" {"type" "Image", "mediaType" "image/png", "url" "https://media.mastodon.scot/mastodon-scot-public/accounts/avatars/109/252/274/874/045/781/original/172e8f7530627e87.png"}}
user=&gt; (def sb (keywordize-keys *1))
#'user/sb
user=&gt; (:outbox sb)
"https://mastodon.scot/users/simon_brooke/outbox"
user=&gt; (require '[clojure.data.json :as json])
nil
user=&gt; (slurp (:outbox sb))
Execution error (IOException) at sun.net.www.protocol.http.HttpURLConnection/getInputStream0 (HttpURLConnection.java:1894).
Server returned HTTP response code: 403 for URL: https://mastodon.scot/users/simon_brooke/outbox
user=&gt; (pprint sb)
{:inbox "https://mastodon.scot/users/simon_brooke/inbox",
:name "Simon Brooke",
:@context
["https://www.w3.org/ns/activitystreams"
"https://w3id.org/security/v1"
{:schema "http://schema.org#",
:messageType "toot:messageType",
:messageFranking "toot:messageFranking",
:identityKey {:@type "@id", :@id "toot:identityKey"},
:Hashtag "as:Hashtag",
:deviceId "toot:deviceId",
:publicKeyBase64 "toot:publicKeyBase64",
:value "schema:value",
:Ed25519Key "toot:Ed25519Key",
:featured {:@id "toot:featured", :@type "@id"},
:Curve25519Key "toot:Curve25519Key",
:discoverable "toot:discoverable",
:focalPoint {:@container "@list", :@id "toot:focalPoint"},
:suspended "toot:suspended",
:fingerprintKey {:@type "@id", :@id "toot:fingerprintKey"},
:Ed25519Signature "toot:Ed25519Signature",
:cipherText "toot:cipherText",
:EncryptedMessage "toot:EncryptedMessage",
:alsoKnownAs {:@id "as:alsoKnownAs", :@type "@id"},
:featuredTags {:@id "toot:featuredTags", :@type "@id"},
:devices {:@type "@id", :@id "toot:devices"},
:toot "http://joinmastodon.org/ns#",
:movedTo {:@id "as:movedTo", :@type "@id"},
:Device "toot:Device",
:PropertyValue "schema:PropertyValue",
:manuallyApprovesFollowers "as:manuallyApprovesFollowers",
:claim {:@type "@id", :@id "toot:claim"}}],
:featured
"https://mastodon.scot/users/simon_brooke/collections/featured",
:type "Person",
:discoverable true,
:icon
{:type "Image",
:mediaType "image/png",
:url
"https://media.mastodon.scot/mastodon-scot-public/accounts/avatars/109/252/274/874/045/781/original/172e8f7530627e87.png"},
:following "https://mastodon.scot/users/simon_brooke/following",
:summary
"&lt;p&gt;Anarcho-syndicalist, autistic, crofter, cyclist, depressive, entrepreneur, geek, Zapatista. Politics &amp;amp; environment, especially &lt;a href=\"https://mastodon.scot/tags/LandReform\" class=\"mention hashtag\" rel=\"tag\"&gt;#&lt;span&gt;LandReform&lt;/span&gt;&lt;/a&gt;. he/him.&lt;/p&gt;&lt;p&gt;Twitter: &lt;span class=\"h-card\"&gt;&lt;a href=\"https://mastodon.scot/@simon_brooke\" class=\"u-url mention\"&gt;@&lt;span&gt;simon_brooke&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;GitHub: simon-brooke&lt;br /&gt;FetLife: Simon_Brooke&lt;/p&gt;&lt;p&gt;Credo: Life is harsh. What we can do - and what we should do - is strive to make it less harsh for the people around us.&lt;/p&gt;",
:publicKey
{:id "https://mastodon.scot/users/simon_brooke#main-key",
:owner "https://mastodon.scot/users/simon_brooke",
:publicKeyPem
"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2/6GgLJgJlPhhqFm1tUQ\noSLnWxhDwq4HlZIHrBsVjkSvUAnHKqq42Q/hta+fkWB8rmTFpmjLXDj/Fi0uejvT\nBc+KrLwfX/yR8+G87afGCRS3CaumoLJ7zkBIlsFzIKMoIke1D3QuHX95yGGXs+hp\nmyxt/+CXRyZjK7u9NG7SMRUlpwvOlpD12Aei35Nb8NSr03JvY8/WVMIbWrecyI0b\nAlwj6axxHx7J15Yo+aEtKzZ2OFKXf+sh0QF9BEnYcmVKYlR6kiOglLFHKdCBUSYi\ni9Flv00TydqlGvR5fpShBqORiy0M/FVtNXlz2sNBEsGB2meipkjh+cRLzTbYo4KL\nJwIDAQAB\n-----END PUBLIC KEY-----\n"},
:endpoints {:sharedInbox "https://mastodon.scot/inbox"},
:preferredUsername "simon_brooke",
:id "https://mastodon.scot/users/simon_brooke",
:alsoKnownAs ["https://mastodon.social/users/simon_brooke"],
:outbox "https://mastodon.scot/users/simon_brooke/outbox",
:url "https://mastodon.scot/@simon_brooke",
:featuredTags
"https://mastodon.scot/users/simon_brooke/collections/tags",
:devices
"https://mastodon.scot/users/simon_brooke/collections/devices",
:image
{:type "Image",
:mediaType "image/jpeg",
:url
"https://media.mastodon.scot/mastodon-scot-public/accounts/headers/109/252/274/874/045/781/original/e1f1823c4361fa27.jpg"},
:tag
[{:type "Hashtag",
:href "https://mastodon.scot/tags/landreform",
:name "#landreform"}],
:followers "https://mastodon.scot/users/simon_brooke/followers",
:published "2022-10-29T00:00:00Z",
:manuallyApprovesFollowers false,
:attachment
[{:type "PropertyValue",
:name "Home Page",
:value
"&lt;a href=\"https://www.journeyman.cc/~simon/\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"&gt;&lt;span class=\"invisible\"&gt;https://www.&lt;/span&gt;&lt;span class=\"\"&gt;journeyman.cc/~simon/&lt;/span&gt;&lt;span class=\"invisible\"&gt;&lt;/span&gt;&lt;/a&gt;"}]}
</code></pre></div></div></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

551
docs/codox/css/default.css Normal file
View file

@ -0,0 +1,551 @@
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 15px;
}
pre, code {
font-family: Monaco, DejaVu Sans Mono, Consolas, monospace;
font-size: 9pt;
margin: 15px 0;
}
h1 {
font-weight: normal;
font-size: 29px;
margin: 10px 0 2px 0;
padding: 0;
}
h2 {
font-weight: normal;
font-size: 25px;
}
h5.license {
margin: 9px 0 22px 0;
color: #555;
font-weight: normal;
font-size: 12px;
font-style: italic;
}
.document h1, .namespace-index h1 {
font-size: 32px;
margin-top: 12px;
}
#header, #content, .sidebar {
position: fixed;
}
#header {
top: 0;
left: 0;
right: 0;
height: 22px;
color: #f5f5f5;
padding: 5px 7px;
}
#content {
top: 32px;
right: 0;
bottom: 0;
overflow: auto;
background: #fff;
color: #333;
padding: 0 18px;
}
.sidebar {
position: fixed;
top: 32px;
bottom: 0;
overflow: auto;
}
.sidebar.primary {
background: #e2e2e2;
border-right: solid 1px #cccccc;
left: 0;
width: 250px;
}
.sidebar.secondary {
background: #f2f2f2;
border-right: solid 1px #d7d7d7;
left: 251px;
width: 200px;
}
#content.namespace-index, #content.document {
left: 251px;
}
#content.namespace-docs {
left: 452px;
}
#content.document {
padding-bottom: 10%;
}
#header {
background: #3f3f3f;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
z-index: 100;
}
#header h1 {
margin: 0;
padding: 0;
font-size: 18px;
font-weight: lighter;
text-shadow: -1px -1px 0px #333;
}
#header h1 .project-version {
font-weight: normal;
}
.project-version {
padding-left: 0.15em;
}
#header a, .sidebar a {
display: block;
text-decoration: none;
}
#header a {
color: #f5f5f5;
}
.sidebar a {
color: #333;
}
#header h2 {
float: right;
font-size: 9pt;
font-weight: normal;
margin: 4px 3px;
padding: 0;
color: #bbb;
}
#header h2 a {
display: inline;
}
.sidebar h3 {
margin: 0;
padding: 10px 13px 0 13px;
font-size: 19px;
font-weight: lighter;
}
.sidebar h3 a {
color: #444;
}
.sidebar h3.no-link {
color: #636363;
}
.sidebar ul {
padding: 7px 0 6px 0;
margin: 0;
}
.sidebar ul.index-link {
padding-bottom: 4px;
}
.sidebar li {
display: block;
vertical-align: middle;
}
.sidebar li a, .sidebar li .no-link {
border-left: 3px solid transparent;
padding: 0 10px;
white-space: nowrap;
}
.sidebar li .no-link {
display: block;
color: #777;
font-style: italic;
}
.sidebar li .inner {
display: inline-block;
padding-top: 7px;
height: 24px;
}
.sidebar li a, .sidebar li .tree {
height: 31px;
}
.depth-1 .inner { padding-left: 2px; }
.depth-2 .inner { padding-left: 6px; }
.depth-3 .inner { padding-left: 20px; }
.depth-4 .inner { padding-left: 34px; }
.depth-5 .inner { padding-left: 48px; }
.depth-6 .inner { padding-left: 62px; }
.sidebar li .tree {
display: block;
float: left;
position: relative;
top: -10px;
margin: 0 4px 0 0;
padding: 0;
}
.sidebar li.depth-1 .tree {
display: none;
}
.sidebar li .tree .top, .sidebar li .tree .bottom {
display: block;
margin: 0;
padding: 0;
width: 7px;
}
.sidebar li .tree .top {
border-left: 1px solid #aaa;
border-bottom: 1px solid #aaa;
height: 19px;
}
.sidebar li .tree .bottom {
height: 22px;
}
.sidebar li.branch .tree .bottom {
border-left: 1px solid #aaa;
}
.sidebar.primary li.current a {
border-left: 3px solid #a33;
color: #a33;
}
.sidebar.secondary li.current a {
border-left: 3px solid #33a;
color: #33a;
}
.namespace-index h2 {
margin: 30px 0 0 0;
}
.namespace-index h3 {
font-size: 16px;
font-weight: bold;
margin-bottom: 0;
}
.namespace-index .topics {
padding-left: 30px;
margin: 11px 0 0 0;
}
.namespace-index .topics li {
padding: 5px 0;
}
.namespace-docs h3 {
font-size: 18px;
font-weight: bold;
}
.public h3 {
margin: 0;
float: left;
}
.usage {
clear: both;
}
.public {
margin: 0;
border-top: 1px solid #e0e0e0;
padding-top: 14px;
padding-bottom: 6px;
}
.public:last-child {
margin-bottom: 20%;
}
.members .public:last-child {
margin-bottom: 0;
}
.members {
margin: 15px 0;
}
.members h4 {
color: #555;
font-weight: normal;
font-variant: small-caps;
margin: 0 0 5px 0;
}
.members .inner {
padding-top: 5px;
padding-left: 12px;
margin-top: 2px;
margin-left: 7px;
border-left: 1px solid #bbb;
}
#content .members .inner h3 {
font-size: 12pt;
}
.members .public {
border-top: none;
margin-top: 0;
padding-top: 6px;
padding-bottom: 0;
}
.members .public:first-child {
padding-top: 0;
}
h4.type,
h4.dynamic,
h4.added,
h4.deprecated {
float: left;
margin: 3px 10px 15px 0;
font-size: 15px;
font-weight: bold;
font-variant: small-caps;
}
.public h4.type,
.public h4.dynamic,
.public h4.added,
.public h4.deprecated {
font-size: 13px;
font-weight: bold;
margin: 3px 0 0 10px;
}
.members h4.type,
.members h4.added,
.members h4.deprecated {
margin-top: 1px;
}
h4.type {
color: #717171;
}
h4.dynamic {
color: #9933aa;
}
h4.added {
color: #508820;
}
h4.deprecated {
color: #880000;
}
.namespace {
margin-bottom: 30px;
}
.namespace:last-child {
margin-bottom: 10%;
}
.index {
padding: 0;
font-size: 80%;
margin: 15px 0;
line-height: 16px;
}
.index * {
display: inline;
}
.index p {
padding-right: 3px;
}
.index li {
padding-right: 5px;
}
.index ul {
padding-left: 0;
}
.type-sig {
clear: both;
color: #088;
}
.type-sig pre {
padding-top: 10px;
margin: 0;
}
.usage code {
display: block;
color: #008;
margin: 2px 0;
}
.usage code:first-child {
padding-top: 10px;
}
p {
margin: 15px 0;
}
.public p:first-child, .public pre.plaintext {
margin-top: 12px;
}
.doc {
margin: 0 0 26px 0;
clear: both;
}
.public .doc {
margin: 0;
}
.namespace-index .doc {
margin-bottom: 20px;
}
.namespace-index .namespace .doc {
margin-bottom: 10px;
}
.markdown p, .markdown li, .markdown dt, .markdown dd, .markdown td {
line-height: 22px;
}
.markdown li {
padding: 2px 0;
}
.markdown h2 {
font-weight: normal;
font-size: 25px;
margin: 30px 0 10px 0;
}
.markdown h3 {
font-weight: normal;
font-size: 20px;
margin: 30px 0 0 0;
}
.markdown h4 {
font-size: 15px;
margin: 22px 0 -4px 0;
}
.doc, .public, .namespace .index {
max-width: 680px;
overflow-x: visible;
}
.markdown pre > code {
display: block;
padding: 10px;
}
.markdown pre > code, .src-link a {
border: 1px solid #e4e4e4;
border-radius: 2px;
}
.markdown code:not(.hljs), .src-link a {
background: #f6f6f6;
}
pre.deps {
display: inline-block;
margin: 0 10px;
border: 1px solid #e4e4e4;
border-radius: 2px;
padding: 10px;
background-color: #f6f6f6;
}
.markdown hr {
border-style: solid;
border-top: none;
color: #ccc;
}
.doc ul, .doc ol {
padding-left: 30px;
}
.doc table {
border-collapse: collapse;
margin: 0 10px;
}
.doc table td, .doc table th {
border: 1px solid #dddddd;
padding: 4px 6px;
}
.doc table th {
background: #f2f2f2;
}
.doc dl {
margin: 0 10px 20px 10px;
}
.doc dl dt {
font-weight: bold;
margin: 0;
padding: 3px 0;
border-bottom: 1px solid #ddd;
}
.doc dl dd {
padding: 5px 0;
margin: 0 0 5px 10px;
}
.doc abbr {
border-bottom: 1px dotted #333;
font-variant: none;
cursor: help;
}
.src-link {
margin-bottom: 15px;
}
.src-link a {
font-size: 70%;
padding: 1px 4px;
text-decoration: none;
color: #5555bb;
}

View file

@ -0,0 +1,97 @@
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
}
.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}
.hljs-string,
.hljs-doctag {
color: #d14;
}
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold;
}
.hljs-subst {
font-weight: normal;
}
.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal;
}
.hljs-regexp,
.hljs-link {
color: #009926;
}
.hljs-symbol,
.hljs-bullet {
color: #990073;
}
.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}
.hljs-meta {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,3 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>dog-and-duck.scratch.core documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Dog-and-duck</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="Using_ActivityPub.html"><div class="inner"><span>Using ActivityPub</span></div></a></li><li class="depth-1 "><a href="intro.html"><div class="inner"><span>The Old Dog and Duck</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clj-activitypub</span></div></div></li><li class="depth-2 branch"><a href="clj-activitypub.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>internal</span></div></div></li><li class="depth-3 branch"><a href="clj-activitypub.internal.crypto.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>crypto</span></div></a></li><li class="depth-3 branch"><a href="clj-activitypub.internal.http-util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http-util</span></div></a></li><li class="depth-3"><a href="clj-activitypub.internal.thread-cache.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>thread-cache</span></div></a></li><li class="depth-2"><a href="clj-activitypub.webfinger.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>webfinger</span></div></a></li><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>dog-and-duck</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>quack</span></div></div></li><li class="depth-3"><a href="dog-and-duck.quack.quack.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>quack</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>scratch</span></div></div></li><li class="depth-3 branch current"><a href="dog-and-duck.scratch.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-3 branch"><a href="dog-and-duck.scratch.parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>parser</span></div></a></li><li class="depth-3"><a href="dog-and-duck.scratch.scratch.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scratch</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="dog-and-duck.scratch.core.html#var-foo"><div class="inner"><span>foo</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">dog-and-duck.scratch.core</h1><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p></div></div><div class="public anchor" id="var-foo"><h3>foo</h3><div class="usage"><code>(foo x)</code></div><div class="doc"><div class="markdown"><p>I dont do a whole lot.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/dog-and-duck/blob/master/src/dog_and_duck/scratch/core.clj#L3">view source</a></div></div></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
docs/codox/index.html Normal file

File diff suppressed because one or more lines are too long

46
docs/codox/intro.html Normal file
View file

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>The Old Dog and Duck</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Dog-and-duck</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="Using_ActivityPub.html"><div class="inner"><span>Using ActivityPub</span></div></a></li><li class="depth-1 current"><a href="intro.html"><div class="inner"><span>The Old Dog and Duck</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clj-activitypub</span></div></div></li><li class="depth-2 branch"><a href="clj-activitypub.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>internal</span></div></div></li><li class="depth-3 branch"><a href="clj-activitypub.internal.crypto.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>crypto</span></div></a></li><li class="depth-3 branch"><a href="clj-activitypub.internal.http-util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http-util</span></div></a></li><li class="depth-3"><a href="clj-activitypub.internal.thread-cache.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>thread-cache</span></div></a></li><li class="depth-2"><a href="clj-activitypub.webfinger.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>webfinger</span></div></a></li><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>dog-and-duck</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>quack</span></div></div></li><li class="depth-3"><a href="dog-and-duck.quack.quack.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>quack</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>scratch</span></div></div></li><li class="depth-3 branch"><a href="dog-and-duck.scratch.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-3 branch"><a href="dog-and-duck.scratch.parser.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>parser</span></div></a></li><li class="depth-3"><a href="dog-and-duck.scratch.scratch.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scratch</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#the-old-dog-and-duck" name="the-old-dog-and-duck"></a>The Old Dog and Duck</h1>
<p>A Clojure library designed to implement the ActivityPub protocol, obviously.</p>
<h2><a href="#introduction" name="introduction"></a>Introduction</h2>
<p>The Old Dog and Duck is clearly a pub, and its a pub related to an activity; to whit, hunting ducks with dogs. Yes, of course one could also hunt dogs with ducks, but in practice that doesnt work so well. The point isnt whether or not I approve of hunting ducks with dogs (or vice versa); to be clear, I dont. The point is that its a pub related to an activity, and is therefore an <a href="https://www.w3.org/TR/activitypub/">ActivityPub</a>.</p>
<p>Are we clear?</p>
<p>Good.</p>
<p>Let us proceed.</p>
<p><strong>The Old Dog and Duck</strong> is intended to be a set of libraries to enable people to build stuff which interacts with ActivityPub. It isnt intended to be a replacement for, or clone of, Mastodon. I do think I might implement my own ActivityPub server on top of The Old Dog and Duck, that specifically might allow for user-pluggable feed-sorting algorithms and with my own user interface/user experience take, but that project is not (yet, at any rate) this project.</p>
<h2><a href="#status" name="status"></a>Status</h2>
<p>This is a long way pre-alpha. Everything will change. Feel free to play, but do so at your own risk. Contributions welcome.</p>
<h2><a href="#architecture" name="architecture"></a>Architecture</h2>
<p>There are a number of separate concerns required to implement ActivityPub. They include</p>
<ol>
<li>Parsing ActivityStreams messages received from peers and from clients;</li>
<li>Persisting ActivityStreams objects;</li>
<li>Delivering ActivityStreams objects to peers;</li>
<li>Delivering ActivityStreams objects to clients.</li>
</ol>
<p><strong>NOTE THAT</strong> what Mastodon delivers to clients is not actually in ActivityStreams format; this seems to be an ad-hoc hack thats just never been fixed and has therefore become a de-facto standard for communication between ActivityPub hosts and their clients.</p>
<p>My proposal would be to deliver exactly the same ActivityStreams format to my client as to other servers. There may be a valid reason for not doing this, but if there is I will discover it in due course.</p>
<h2><a href="#proposed-dog-and-duck-libraries" name="proposed-dog-and-duck-libraries"></a>Proposed dog-and-duck libraries</h2>
<p><strong>NOTE THAT</strong> at the present stage all the proposed libraries are in one package, namely this package, but that it is proposed that in future they will form separate libraries in separate packages.</p>
<h3><a href="#bar" name="bar"></a>Bar</h3>
<p>Where conversations happen. Handle interactions with clients.</p>
<h3><a href="#cellar" name="cellar"></a>Cellar</h3>
<p>Where things are stored. Persistance for ActivityStreams objects; I may at least initially simply copy the Mastodon postgres schema, but equally I may not.</p>
<h3><a href="#pantry" name="pantry"></a>Pantry</h3>
<p>Where deliveries are ordered and arrive; and from where deliveries onwards are despatched. Handle interactions with peers.</p>
<h3><a href="#quack" name="quack"></a>Quack</h3>
<p>Duck-typing for ActivityStreams objects.</p>
<p>As of version 0.1.0, this is substantially the only part that is yet at all useful, and it is still a long way from finished or robust.</p>
<h3><a href="#scratch" name="scratch"></a>Scratch</h3>
<p>What the dog does when bored. Essentially, a place where I can learn how to make this stuff work, but perhaps eventually an ActivityPub server in its own right.</p>
<h2><a href="#usage" name="usage"></a>Usage</h2>
<p>At present, only the duck-typing functions work. To play with them, use</p>
<pre><code class="clojure">(require '[dog-and-duck.quack.quack :as q])
</code></pre>
<h2><a href="#testing" name="testing"></a>Testing</h2>
<p>Prior to testing, you should clone <a href="https://github.com/w3c-social/activitystreams-test-documents">activitystreams-test-documents</a> into the <code>resources</code> directory. You can then test with</p>
<pre><code class="bash">lein test
</code></pre>
<h2><a href="#license" name="license"></a>License</h2>
<p>Copyright © Simon Brooke, 2022.</p>
<p>This program and the accompanying materials are made available under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.</p></div></div></div></body></html>

2
docs/codox/js/highlight.min.js vendored Normal file

File diff suppressed because one or more lines are too long

4
docs/codox/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,112 @@
function visibleInParent(element) {
var position = $(element).position().top
return position > -50 && position < ($(element).offsetParent().height() - 50)
}
function hasFragment(link, fragment) {
return $(link).attr("href").indexOf("#" + fragment) != -1
}
function findLinkByFragment(elements, fragment) {
return $(elements).filter(function(i, e) { return hasFragment(e, fragment)}).first()
}
function scrollToCurrentVarLink(elements) {
var elements = $(elements);
var parent = elements.offsetParent();
if (elements.length == 0) return;
var top = elements.first().position().top;
var bottom = elements.last().position().top + elements.last().height();
if (top >= 0 && bottom <= parent.height()) return;
if (top < 0) {
parent.scrollTop(parent.scrollTop() + top);
}
else if (bottom > parent.height()) {
parent.scrollTop(parent.scrollTop() + bottom - parent.height());
}
}
function setCurrentVarLink() {
$('.secondary a').parent().removeClass('current')
$('.anchor').
filter(function(index) { return visibleInParent(this) }).
each(function(index, element) {
findLinkByFragment(".secondary a", element.id).
parent().
addClass('current')
});
scrollToCurrentVarLink('.secondary .current');
}
var hasStorage = (function() { try { return localStorage.getItem } catch(e) {} }())
function scrollPositionId(element) {
var directory = window.location.href.replace(/[^\/]+\.html$/, '')
return 'scroll::' + $(element).attr('id') + '::' + directory
}
function storeScrollPosition(element) {
if (!hasStorage) return;
localStorage.setItem(scrollPositionId(element) + "::x", $(element).scrollLeft())
localStorage.setItem(scrollPositionId(element) + "::y", $(element).scrollTop())
}
function recallScrollPosition(element) {
if (!hasStorage) return;
$(element).scrollLeft(localStorage.getItem(scrollPositionId(element) + "::x"))
$(element).scrollTop(localStorage.getItem(scrollPositionId(element) + "::y"))
}
function persistScrollPosition(element) {
recallScrollPosition(element)
$(element).scroll(function() { storeScrollPosition(element) })
}
function sidebarContentWidth(element) {
var widths = $(element).find('.inner').map(function() { return $(this).innerWidth() })
return Math.max.apply(Math, widths)
}
function calculateSize(width, snap, margin, minimum) {
if (width == 0) {
return 0
}
else {
return Math.max(minimum, (Math.ceil(width / snap) * snap) + (margin * 2))
}
}
function resizeSidebars() {
var primaryWidth = sidebarContentWidth('.primary')
var secondaryWidth = 0
if ($('.secondary').length != 0) {
secondaryWidth = sidebarContentWidth('.secondary')
}
// snap to grid
primaryWidth = calculateSize(primaryWidth, 32, 13, 160)
secondaryWidth = calculateSize(secondaryWidth, 32, 13, 160)
$('.primary').css('width', primaryWidth)
$('.secondary').css('width', secondaryWidth).css('left', primaryWidth + 1)
if (secondaryWidth > 0) {
$('#content').css('left', primaryWidth + secondaryWidth + 2)
}
else {
$('#content').css('left', primaryWidth + 1)
}
}
$(window).ready(resizeSidebars)
$(window).ready(setCurrentVarLink)
$(window).ready(function() { persistScrollPosition('.primary')})
$(window).ready(function() {
$('#content').scroll(setCurrentVarLink)
$(window).resize(setCurrentVarLink)
})

14
docs/index.html Normal file
View file

@ -0,0 +1,14 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>The Old Dog and Duck: Documentation</title>
<link rel="stylesheet" type="text/css" href="codox/css/default.css" />
</head>
<body>
<h1>The Old Dog and Duck: Documentation</h1>
<ul>
<li><a href="codox/index.html">Primary documentaion</a></li>
<li><a href="cloverage/index.html">Test coverage</a></li>
</ul>
</body>
</html>

View file

@ -1,9 +1,14 @@
(defproject dog-and-duck "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.10.3"]
:cloverage {:output "docs/cloverage"
:codecov? true
:emma-xml? true}
:codox {:metadata {:doc "**TODO**: write docs"
:doc/format :markdown}
:output-path "docs/codox"
:source-uri "https://github.com/simon-brooke/dog-and-duck/blob/master/{filepath}#L{line}"}
:description "A Clojure library designed to implement the ActivityPub protocol."
:dependencies [[org.clojure/clojure "1.11.1"]
[org.clojure/data.json "2.4.0"]
[org.clojure/math.numeric-tower "0.0.5"]
[org.clojure/spec.alpha "0.3.218"]
@ -12,4 +17,9 @@
[clj-http "3.12.3"] ;; required by clj-activitypub
[cheshire "5.11.0"] ;; if this is not present, clj-http/client errors with 'json-enabled?'
]
:repl-options {:init-ns dog-and-duck.scratch.core})
:license {:name "GPL-2.0-or-later"
:url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
:plugins [[lein-cloverage "1.2.2"]
[lein-codox "0.10.7"]]
:repl-options {:init-ns dog-and-duck.scratch.core}
:url "http://example.com/FIXME")

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -1,4 +1,7 @@
(ns clj-activitypub.internal.crypto
"copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
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."
(:require [clojure.java.io :as io])
(:import (java.util Base64)
(java.security MessageDigest SecureRandom Signature)))
@ -30,7 +33,7 @@
(defn sign [data private-key]
(let [bytes (.getBytes data)
signer (doto (Signature/getInstance "SHA256withRSA")
(.initSign private-key (SecureRandom.))
(.update bytes))]
(.initSign private-key (SecureRandom.))
(.update bytes))]
(.sign signer)))

View file

@ -1,4 +1,7 @@
(ns clj-activitypub.internal.http-util
"copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
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."
(:require [clj-activitypub.internal.crypto :as crypto])
(:import (java.net URLEncoder)
(java.time OffsetDateTime ZoneOffset)

View file

@ -1,4 +1,7 @@
(ns clj-activitypub.internal.thread-cache)
(ns clj-activitypub.internal.thread-cache
"copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
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.")
(defn- current-time
"Returns current time using UNIX epoch."
@ -26,14 +29,14 @@
(when-let [data (get @store k)]
(update-read-at store k data)
(:value data)))
([k compute-fn]
(let [storage @store]
(if (contains? storage k)
(get-v k)
(let [v (compute-fn)]
(when (or (not (nil? v)) cache-if-nil)
(cache-kv k v)
(get-v k)))))))
([k compute-fn]
(let [storage @store]
(if (contains? storage k)
(get-v k)
(let [v (compute-fn)]
(when (or (not (nil? v)) cache-if-nil)
(cache-kv k v)
(get-v k)))))))
(lru ([]
(mapv
(fn [[k v]] [k (:value v)])