aboutsummaryrefslogtreecommitdiff
path: root/lib/auth.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/auth.ml')
-rw-r--r--lib/auth.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/auth.ml b/lib/auth.ml
index 75c2552..d97a8cb 100644
--- a/lib/auth.ml
+++ b/lib/auth.ml
@@ -1,5 +1,12 @@
type auth_mechanism = PLAIN [@@deriving show { with_path = false }]
+type sasl_error =
+ | NotAuthorized
+
+let read_sasl_error = function
+ | "not-authorized" -> NotAuthorized
+ | _ -> failwith "Unsupported SASL error returned by the server."
+
let send_auth_stanza (stream, push) jid pass mechanism =
let gen_auth = function
| PLAIN -> Base64.encode_exn ("\x00" ^ jid ^ "\x00" ^ pass)