diff options
author | Clombrong <cromblong@egregore.fun> | 2025-06-24 23:18:51 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-06-24 23:20:06 +0200 |
commit | 6770a7cd102216175c278f28a5d93902a3e42409 (patch) | |
tree | 8e6cdd4a6e238d9bd0f7bccf8acb3ac242488540 /lib | |
parent | 8e2074461e01ddd4c9c8c46fdb6a7866dbb2a13a (diff) |
feat(sasl): collect stream features in authenticate function
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sasl.ml | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sasl.ml b/lib/sasl.ml index 0dc58c2..1fcd661 100644 --- a/lib/sasl.ml +++ b/lib/sasl.ml @@ -1,3 +1,4 @@ +open Lwt.Syntax open Lwt.Infix open Stream @@ -52,10 +53,12 @@ let send_auth_stanza (stream, push) localpart pass mechanism = with exn -> Lwt.fail exn let authenticate (portal : Portal.t) (config : auth_config) = - let {jid; password; _} = config + let {jid; password; _} = config in (* Probably not exactly compliant with https://xmpp.org/extensions/xep-0029.html, but it's just for simplicity's sake in alpha. *) - in let localpart = match String.split_on_char '@' jid with - | [localpart; _domain] -> localpart - | _ -> failwith "Invalid JID" - in send_auth_stanza portal localpart password PLAIN + let localpart = match String.split_on_char '@' jid with + | [localpart; _domain] -> localpart + | _ -> failwith "Invalid JID" + in + let* _features = Stream.get (fst portal) >|= Stream.parse_features + in send_auth_stanza portal localpart password PLAIN |