TLS implementation in pure javascript