3 ms·
Ask HN: How do you protect your source code?
After seeing this post [1], and old question came to mind and I finally decided to ask it: how do you protect your source code?
I like to write my games in JavaScript cause I like the language and it easy to "embedded" it into native apps. In case of Android, I can just write a JS Interface and access anything I need on the device (database, notifications...); and doing this way I have not only a web app game, but a game that with some effort could pass as native in other platforms.
So, I've been writing this game [2][3] and I want people to play it, so I can get some feedback, but if I release a browser version what would stop people from just copying the source code? Let's be honest, there's no secret algorithm or optimization in my code that is worth protecting, but its hard work. I know there's no REAL way of protecting source code, like we just saw with the source code post [1], but how would you go about protecting the code on shipping the game? Both in Android and Electron apps, the JavaScript code just sits there, anyone with a file extractor could navigate the folders and find the code.
Is that it? After I ship my game people with enough resource could just "own" the code? Should I just accept this and move on? Would you release alpha version of a project (web app in this case) knowing that if people just right click they can get the code?
1 - https://news.ycombinator.com/item?id=30346414
2 - https://www.youtube.com/watch?v=x--liapcOMw
3 - https://twitter.com/HoboHeroTheGame
- gus_massa 5y agoIn case nobody else makes a suggestion, try https://www.google.com/search?q=javascript+obfuscation https://www.google.com/search?q=javascript+obfuscation
- atum47 5y agoYeah, I know about this tricks and all, but as I said people can easily decompile code; they can easily deobfuscate js... I guess what I was expecting people to say is that's impossible to protect source code and just accept it and move on...
- jka 5y agoI'm beginning to lean in the opposite direction: perhaps making my application's JavaScript (well, compiled TypeScript) less obfuscated for users could make sense. Enabling sourcemaps, perhaps? Copyright and license information seems worth keeping -- but if anyone is curious and technical enough to look at the code, I'll take the risk that they'll dig further and perhaps file a bug report or provide a patch (unlikely, but marginally less unlikely than that they'll go to the effort of de-obfuscating, I'd guess -- and perhaps they'll appreciate the timesaver).