aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/auth.ml9
-rw-r--r--lib/dune3
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/auth.ml b/lib/auth.ml
index dfe5cfb..3287f91 100644
--- a/lib/auth.ml
+++ b/lib/auth.ml
@@ -3,4 +3,11 @@ type auth_mechanism = PLAIN [@@deriving show { with_path = false }]
let send_auth_stanza (_stream, _push) jid pass mechanism =
let gen_auth = function
| PLAIN -> Base64.encode_exn ("\x00" ^ jid ^ "\x00" ^ pass)
- in gen_auth mechanism
+ in let xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" in
+ let stanza_list = [`Start_element
+ ((xmlns, "auth"),
+ [(("", "xmlns"), xmlns);
+ (("", "mechanism"), show_auth_mechanism mechanism)]);
+ `Text [gen_auth mechanism];
+ `End_element]
+ in Markup.(stanza_list |> of_list |> write_xml |> to_string)
diff --git a/lib/dune b/lib/dune
index 645b8b9..15220c8 100644
--- a/lib/dune
+++ b/lib/dune
@@ -3,5 +3,6 @@
(libraries
lwt
base64
- portal)
+ portal
+ markup)
(preprocess (pps ppx_deriving.show)))