How do I authenticate socks agent?

  node.js, question

I have built an ss server and can already run through it. In a closer step, I want to use it on my iphone, so I studied pac automatic proxy and also ran through it. However, for such proxy, anyone can use it just by scanning the port. How should I add a layer of authentication in the middle?

// pac
 function FindProxyForURL(url, host) {
 return 'SOCKS5;  SOCKS'

Does the iphone support socks5 authentication?

You can deploy socks5 on a local machine, deploy ss on a remote server, and then connect the local machine with ss to act as socks5 proxy. The iphone accesses the proxy service provided by the local machine.

Pac generation, can use: