Dinovore Dinovore - 1 year ago 75
Javascript Question

How to set a licence-type authorization to a JS file?

I know this is not the right "use" of Javascript. But my company wants to give access to a Javascript file to only particular client (for example clients who subscribe to a special plan). For exemple, if we provide a script to a client and 5 users can access to it, how can i authorize the access to only 5 users and not more?
Because if we don't restrain the access, the client can take the script and give it to anyone (and we will loose a lot of money, because we are selling our knowledge, and our knowledge is this script)

For now the only way to secure our code is by using NodeJS, so the client can't see the script because he only see the generated html page. But we can have the case which the whole server is hosted by the client. So anyone can access to the script, and we want to prevent this case.

So, is there any way to setup a server licence-like for a web application?
(I already know about JS minimizer, and obfuscator, but this is not the kind of things I m looking for)

Thanks in advance

Answer Source

JavaScript is a client side script language, that means it's hard to protect your knowledge.

Even if you minimize or obfuscate your script, people can send it to others and it'll still work.

Inspired by video protecting, I have an idea to protect your knowledge.

You can insert a log script that send logs with your custom's id. If your custom share the script to others, you can know it.

Another way is to insert a fragment of useless code, which can track the custom id, like:

var userId = zo1vjiw73;

Then if you see some other website are using your code, you can easily know who shared the script.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download