# HG changeset patch # User Kim Alvefur # Date 1659488532 -7200 # Node ID b0c586241224545041d34d89c293f5cdf3286e9d # Parent e4391832be1e7171c7764cbb99ea7da24ca684e4 clix: Support SCRAM hashes stored as hex in config diff -r e4391832be1e -r b0c586241224 clix.lua --- a/clix.lua Wed Aug 03 03:01:26 2022 +0200 +++ b/clix.lua Wed Aug 03 03:02:12 2022 +0200 @@ -111,12 +111,22 @@ conn.connect_host = account.address; conn.connect_port = account.port; - if not account.password and opts.interactive then + if not account.password and not (account.clientkey and account.serverkey) and opts.interactive then account.password = read_password() end + + local clientkey, serverkey = account.clientkey, account.serverkey; + if clientkey and serverkey then + local hex = require "util.hex"; + clientkey = hex.from(clientkey); + serverkey = hex.from(serverkey); + elseif clientkey or serverkey then + conn:warn("Only one of 'clientkey' and 'serverkey' available, both reqired for SCRAM") + clientkey, serverkey = nil, nil; + end -- Connect! - conn:connect_client(account.jid, account.password); + conn:connect_client(account.jid, account.password, clientkey, serverkey); -- COMPAT: Tigase discards stanzas sent at the same time as local _real_close = conn.close;