···11+ISC License
22+33+Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>
44+55+Permission to use, copy, modify, and distribute this software for any
66+purpose with or without fee is hereby granted, provided that the above
77+copyright notice and this permission notice appear in all copies.
88+99+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1010+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1111+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1212+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1313+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1414+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+72
README.md
···11+# apubt - ActivityPub Client Library for OCaml
22+33+An ActivityPub/ActivityStreams protocol implementation for OCaml using Eio for concurrent I/O. Provides typed representations of actors, activities, and objects with bidirectional JSON codecs.
44+55+## Key Features
66+77+- **Type-safe ActivityPub**: Full OCaml types for actors, activities, objects, and collections
88+- **JSON codecs**: Bidirectional encoding/decoding using jsont
99+- **Eio-based HTTP**: Direct-style concurrent I/O with connection pooling
1010+- **HTTP Signatures**: RFC 9421 message signatures for authenticated federation
1111+- **Webfinger**: Actor discovery via RFC 7033
1212+- **NodeInfo**: Server metadata discovery
1313+1414+## Usage
1515+1616+```ocaml
1717+open Eio.Std
1818+1919+let () = Eio_main.run @@ fun env ->
2020+ Switch.run @@ fun sw ->
2121+2222+ (* Create an ActivityPub client *)
2323+ let client = Apubt.create ~sw env in
2424+2525+ (* Discover an actor via Webfinger *)
2626+ let actor = Apubt.Actor.lookup client "user@example.com" in
2727+ Printf.printf "Found: %s\n"
2828+ (Option.value ~default:"<none>" (Apubt.Proto.Actor.name actor));
2929+3030+ (* Fetch their outbox *)
3131+ let outbox = Apubt.Actor.outbox client actor in
3232+ List.iter (fun activity ->
3333+ Printf.printf "Activity: %s\n"
3434+ (Apubt.Proto.Activity_type.to_string (Apubt.Proto.Activity.type_ activity))
3535+ ) (Option.value ~default:[] (Apubt.Proto.Collection.items outbox))
3636+```
3737+3838+### With HTTP Signatures
3939+4040+```ocaml
4141+(* Configure signing for authenticated requests *)
4242+let signing = Apubt.Signing.from_pem_exn
4343+ ~key_id:"https://example.com/users/alice#main-key"
4444+ ~pem:private_key_pem
4545+ () in
4646+let client = Apubt.create ~sw ~signing env in
4747+4848+(* Post a public note *)
4949+let _activity = Apubt.Outbox.public_note client
5050+ ~actor:my_actor
5151+ ~content:"<p>Hello from OCaml!</p>"
5252+ ()
5353+```
5454+5555+## Installation
5656+5757+```
5858+opam install apubt
5959+```
6060+6161+## Documentation
6262+6363+API documentation is available via:
6464+6565+```
6666+opam install apubt
6767+odig doc apubt
6868+```
6969+7070+## License
7171+7272+ISC
+10-2
apubt.opam
···22opam-version: "2.0"
33synopsis: "ActivityPub client library for OCaml with Eio"
44description:
55- "ActivityPub/ActivityStreams protocol implementation with jsont codecs and Eio-based HTTP client"
55+ "ActivityPub/ActivityStreams protocol implementation for OCaml. Provides typed representations of ActivityPub actors, activities, and objects with bidirectional JSON codecs using jsont. Includes an Eio-based HTTP client for federation with HTTP signature support."
66+maintainer: ["Anil Madhavapeddy <anil@recoil.org>"]
77+authors: ["Anil Madhavapeddy"]
88+license: "ISC"
99+homepage: "https://tangled.org/@anil.recoil.org/ocaml-apubt"
1010+bug-reports: "https://tangled.org/@anil.recoil.org/ocaml-apubt/issues"
611depends: [
77- "dune" {>= "3.0"}
1212+ "dune" {>= "3.20"}
813 "ocaml" {>= "5.1.0"}
914 "jsont" {>= "0.2.0"}
1015 "jsont-bytesrw"
···1419 "cmdliner" {>= "1.2.0"}
1520 "logs" {>= "0.7.0"}
1621 "fmt" {>= "0.9.0"}
2222+ "ptime"
2323+ "x509"
1724 "odoc" {with-doc}
1825]
1926build: [
···3037 "@doc" {with-doc}
3138 ]
3239]
4040+x-maintenance-intent: ["(latest)"]
+17-3
dune-project
···11-(lang dune 3.0)
11+(lang dune 3.20)
22(name apubt)
3344(generate_opam_files true)
5566+(license ISC)
77+(authors "Anil Madhavapeddy")
88+(homepage "https://tangled.org/@anil.recoil.org/ocaml-apubt")
99+(maintainers "Anil Madhavapeddy <anil@recoil.org>")
1010+(bug_reports "https://tangled.org/@anil.recoil.org/ocaml-apubt/issues")
1111+(maintenance_intent "(latest)")
1212+613(package
714 (name apubt)
815 (synopsis "ActivityPub client library for OCaml with Eio")
99- (description "ActivityPub/ActivityStreams protocol implementation with jsont codecs and Eio-based HTTP client")
1616+ (description
1717+ "ActivityPub/ActivityStreams protocol implementation for OCaml. \
1818+ Provides typed representations of ActivityPub actors, activities, \
1919+ and objects with bidirectional JSON codecs using jsont. Includes \
2020+ an Eio-based HTTP client for federation with HTTP signature support.")
1021 (depends
1122 (ocaml (>= 5.1.0))
1223 (jsont (>= 0.2.0))
···1627 (requests (>= 0.1.0))
1728 (cmdliner (>= 1.2.0))
1829 (logs (>= 0.7.0))
1919- (fmt (>= 0.9.0))))
3030+ (fmt (>= 0.9.0))
3131+ ptime
3232+ x509
3333+ (odoc :with-doc)))