diff options
author | Marc Coquand <marc@mccd.space> | 2023-12-20 20:46:00 -0600 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2023-12-25 18:22:59 -0600 |
commit | 262f161f42c4e59beec41c6f440336c38385426a (patch) | |
tree | 6491c9b661a0b5a14c9a30ecf25e036f8762239d /lib/user.ml | |
parent | cc783c157f31e7e713c8b83be67449b1859dac27 (diff) | |
download | fixgen-262f161f42c4e59beec41c6f440336c38385426a.tar.gz fixgen-262f161f42c4e59beec41c6f440336c38385426a.tar.bz2 fixgen-262f161f42c4e59beec41c6f440336c38385426a.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | lib/user.ml | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/lib/user.ml b/lib/user.ml deleted file mode 100644 index ba802c0..0000000 --- a/lib/user.ml +++ /dev/null @@ -1,31 +0,0 @@ -open Ppx_yojson_conv_lib.Yojson_conv.Primitives -open Cohttp -open Cohttp_lwt_unix -open Lwt - -type public_key = { - id : string; - owner : string; - public_key_pem : string; [@key "publicKeyPem"] -} -[@@deriving yojson] [@@yojson.allow_extra_fields] - -type t = { name : string; public_key : public_key [@key "publicKey"] } -[@@deriving yojson] [@@yojson.allow_extra_fields] - -let activity_header = - Some (Header.of_list [ ("Accept", "application/activity+json") ]) - -let get_user actor_url = - let%lwt _, body = - Client.get ?headers:activity_header (Uri.of_string actor_url) - in - body |> Cohttp_lwt.Body.to_string >|= fun body -> - let body = Yojson.Safe.from_string body |> t_of_yojson in - body - -let get_public_pem user = - user.public_key.public_key_pem |> Cstruct.of_string - |> X509.Public_key.decode_pem - -let name user = user.name |