aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sasl.ml10
-rw-r--r--lib/stream.ml4
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/sasl.ml b/lib/sasl.ml
index 81c4476..5ec6989 100644
--- a/lib/sasl.ml
+++ b/lib/sasl.ml
@@ -1,13 +1,13 @@
open Lwt.Infix
-type auth_mechanism =
+type mechanism =
| PLAIN
| Unknown of string [@@deriving show { with_path = false }]
type auth_config = {
jid : string;
password : string;
- preferred_mechanisms : auth_mechanism list;
+ preferred_mechanisms : mechanism list;
}
type sasl_error =
@@ -18,7 +18,7 @@ let unrecoverable = function
| NotAuthorized -> true
| _ -> false
-let parse_auth_mechanism = function
+let parse_mechanism = function
| "PLAIN" -> PLAIN
| other -> Unknown other
@@ -55,7 +55,7 @@ let send_auth_stanza ({stream; push; _} : Portal.t) localpart pass mechanism =
in let stanza_list = [`Start_element
((Xmlns.sasl, "auth"),
[(("", "xmlns"), Xmlns.sasl);
- (("", "mechanism"), show_auth_mechanism mechanism)]);
+ (("", "mechanism"), show_mechanism mechanism)]);
`Text [gen_auth mechanism];
`End_element]
in Some (Markup.of_list stanza_list) |> push;
@@ -65,7 +65,7 @@ let send_auth_stanza ({stream; push; _} : Portal.t) localpart pass mechanism =
let authenticate
(portal : Portal.t)
({jid; password; preferred_mechanisms} : auth_config)
- (sasl_mechanisms : auth_mechanism list) =
+ (sasl_mechanisms : mechanism list) =
(* Probably not exactly compliant with https://xmpp.org/extensions/xep-0029.html,
but it's just for simplicity's sake in alpha. *)
let localpart = match String.split_on_char '@' jid with
diff --git a/lib/stream.ml b/lib/stream.ml
index db4d5ee..aa7c3b3 100644
--- a/lib/stream.ml
+++ b/lib/stream.ml
@@ -5,7 +5,7 @@ exception ClosedStream
exception InsufficientEncryption
type feature =
- | Mechanisms of Sasl.auth_mechanism list
+ | Mechanisms of Sasl.mechanism list
| STARTTLS
| Other of Xml.element
@@ -23,7 +23,7 @@ let parse_features (stanza : Xml.element) : feature list * feature list =
let parse_single_mechanism = function
| Left {local_name = "mechanism"; children = [Right mechanism]; _} ->
- Sasl.parse_auth_mechanism mechanism
+ Sasl.parse_mechanism mechanism
| _ -> raise (InvalidStanza (element_to_string stanza))
in