diff options
author | Clombrong <cromblong@egregore.fun> | 2025-06-10 02:09:21 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-06-10 02:09:21 +0200 |
commit | f4920de85f08668b7c21617d3fcfa0082ea7885a (patch) | |
tree | 446dccf846dce68099611e952075628063f3e740 /lib/auth.ml | |
parent | af41ba0181d0f23591d7b82d3425c419c8ba73da (diff) |
feat(auth): use streams directly for send_auth_stanza
Diffstat (limited to 'lib/auth.ml')
-rw-r--r-- | lib/auth.ml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/auth.ml b/lib/auth.ml index 3287f91..75c2552 100644 --- a/lib/auth.ml +++ b/lib/auth.ml @@ -1,6 +1,6 @@ type auth_mechanism = PLAIN [@@deriving show { with_path = false }] -let send_auth_stanza (_stream, _push) jid pass mechanism = +let send_auth_stanza (stream, push) jid pass mechanism = let gen_auth = function | PLAIN -> Base64.encode_exn ("\x00" ^ jid ^ "\x00" ^ pass) in let xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" in @@ -10,4 +10,6 @@ let send_auth_stanza (_stream, _push) jid pass mechanism = (("", "mechanism"), show_auth_mechanism mechanism)]); `Text [gen_auth mechanism]; `End_element] - in Markup.(stanza_list |> of_list |> write_xml |> to_string) + in Markup.(stanza_list |> of_list |> write_xml |> to_string) |> Option.some |> push; + (* TODO: use stream result for exceptions, etc. *) + Lwt_stream.get stream |