aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-06-10 17:59:04 +0200
committerClombrong <cromblong@egregore.fun>2025-06-10 17:59:04 +0200
commit1fe377f51442cd5ff5113147fd8451e749558689 (patch)
tree3ff0ba4468171565446f973a19185b17feec971d
parentcef7a98c4414816ea719ae58c3848d09d4367bb6 (diff)
feat(auth): introduce not-authorized sasl error
-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)