The ssl module is deprecated (unfortunately the docs don't mention that). The docs also don't mention how to do SSL with sockets properly which is another problem... (help in improving this would be very much appreciated :))
But basically, SSL in Nim is similar to Python's. The net module contains two important SSL procedures:
All you need to do is create a new context, then after creating a new socket with newSocket simply call context.wrapSocket(socket) and you should be good to go. You can take a look at how httpclient does it to get a better idea as well: https://github.com/nim-lang/Nim/blob/devel/lib/pure/httpclient.nim#L422
Hope this helps!
Oh okay I figured it out. With XMPP we first need to init a stream (see RFC for the particular case) and, in general, with STARTTLS we do so. So I needed to do the wrapSocket stuff after the starttls initiation and I had to do handshake. Let me illustrate it with a short example so others who will be in the same bought can get an idea:
s.connect(server,Port(5222),timeout=5000)
echo s.startStream(server) # startstream is my proc that just sends initial message and returns server's reply
let ctx = newContext(protVersion = protTLSv1, verifyMode = CVerifyNone)
ctx.wrapSocket(s)
echo s.handshake()
echo s.startStream(server) #once again as per RFC)