2

Ok guys. I've built a web application with some friends that is somehow complex and took us some time to built. It is entirely built using JavaScript

Now the application has some functions which we don't want to readily share with the world(view-source).

The application works by sending an input to an algorithm and receiving the output from that algorithm and displays it on a canvas. (Thats how all functions work anyway:) )

Okay i don't know much about node.js but from what i've heard its server-side JavaScript. Does that mean that i can transfer the function server-side and using POST-GET to send an input and receive an output? All without having the source code of that particular function readily visible to anyone?

Please don't get started about how i should be more worried about doing things better rather than worrying about the safety of our work. I already know that so consider my question as a complimentary safeguard, at least for the time being.

Obfuscation is not a very concrete option since many developers de-obfuscate code just for fun.

This application is not like a hen with a golden egg and i am not being grandiose about this, but i was just having this question in my mind for some time now so i just shoot it here to know in the future how things work.

Thanks guys!

2
  • Google is actually working on something for v8 but I can't remember what it was called. Not a high priority for most JS devs. Commented Jun 13, 2013 at 7:06
  • When you do remember please come back if you have time and tell me what it is. I tried to found out through Google myself but i can't seem to find something. Commented Jun 13, 2013 at 7:48

1 Answer 1

6

If you're worried about protecting your ultra sweet super secret codes, you could host your app and use a little something called RPC. Remote. Procedure. Calls.

Check out this little guy
https://github.com/deoxxa/pillion

Easy as 1-2-3 or A-B-C or cake or strippers or whatever else is easy

% npm install pillion burro && echo omg that was so easy

DISCLAIMER

I'm about to reveal a super secret greeting function that says hello to our clients. This is ultra secret intellectual IP properties and should not be shared with anyone on the internets.


You could provide the function calls you need using something like this on the server

// server.js
var net = require("net"),
    burro = require("burro"),
    pillion = require("pillion");

var server = net.createServer(function(_socket) {
  var socket = burro.wrap(_socket),
      rpc = new pillion(socket);

  rpc.provide("greet", function(name, cb) {
    cb("hi there, " + name);
  });
});

server.listen(3000);

Then on the client side

// client.js
var net = require("net"),
    burro = require("burro"),
    pillion = require("pillion");

var _socket = net.connect(3000),
    socket = burro.wrap(_socket),
    rpc = new pillion(socket);

rpc.callRemote("greet", "friend", function(res) {
  console.log(res); // prints "hi there, friend"
});
Sign up to request clarification or add additional context in comments.

5 Comments

This uses node.js right? Sorry if i sound like a moron but i have never used it or saw example code of it.
just read this question again, are we on Stack Humorflow? Maybe you should consider a career in stand down comedy
You're right; there's nothing informative about the answer above. Learning should be stale and unexciting.
ps. I'm never sarcastic.
Yep exciting and offending is the same thing in my dictionary and i consider myself a sadomasochist. Thanks for the answer, really informative. ps: sarcasm and i go separate ways as well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.