Protected code

Posted on
  • Hi, I'm Diego and I'm starting with espruino.
    There is a way to protect my code? if build a product I mean.

    Thank you.
    Regards.

  • You can add a password or move the interactive console away, which will stop any casual reading of the code. Your code is stored as source but is fragmented all over memory so is still pretty garbled and would be hard to read out.

    However if you then also turn on minification your code will be made pretty much unreadable. You could even use a javascript obfuscator. Add that to the way the code itself is fragmented around the memory space and it's very difficult to read out, and even when you do the result doesn't make much sense. I'd say it's on a par, if not more difficult to reconstruct than compiled code now.

  • Thank you so much Gordon.
    But, somebody still could download my code, and upload it to an identical espruino board and it will work?

    How can I stop that ?
    Thank you

  • To do that, they would have to physically connect a debugger device to it - and you have the same problems you would with any microcontroller.

    One method is to simply check the chip's serial number in your code.

    You can also turn on 'read-out protection' on the chip? Are you using Puck.js, or one of the other Espruino boards? The method for doing that would be different on different chips - it's off by default because it can make it more likely you'll make your chip unusable during development.

  • That is !! Excellent.

    Thank you so much.

    Best regards.

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

Protected code

Posted by Avatar for dieguer @dieguer

Actions