Disable dump()?

Posted on
  • Is there a way to disable dump()? I want to protect my code from download; just reasonable precautions, not trying to make it cybersecure. It seems all of the methods of save leave the ability to dump out the js code.

    I'd want it to be reenabled with any method of clearing flash...

    @Gordon?

    Thanks!
    Bill

  • The closest you can get is global.dump=function(){};E.dumpStr=funct­ion(){};, but there are ways around that. Also if someone has command-line access to Espruino then they may well be able to pull something out.

    Probably your best bet is one of:

    • E.setPassword to put a password lock on the REPL
    • Disable the REPL completely - I'm not sure what board you're using but if you let me know I could give you some advice.
    • Minify your code, which will make it pretty unreadable. You could go further and use some other tools to really try and obscure your code if you want to.
  • Thanks @Gordon! That's good enough.

    Bill

  • No problem. There's a bit more detail here if you need it: http://www.espruino.com/Puck.js+Security­

  • @Gordon thanks! I'd suggest you add the dump() disable method. It is really handy for distribution.

    global.dump=function(){};E.dumpStr=funct­ion(){};

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Disable dump()?

Posted by Avatar for billsalt @billsalt

Actions