You are reading a single comment by @aerialist_user6911 and its replies. Click here to read the full conversation.
  • Thanks for your encouragement, Gordon!
    I gave it a go and faced that "encodeURIComponent" function is missing.

    Here's what I did:
    Copied sha1.js to Espruino Web IDE and shuffled the order of function definitions a bit, it was sent to Espruino Pico alright. Running sha1_vm_test(); on Pico returned true. Nice ;-)

    Then I added codes from oath.js. It needed minor change (move open curly bracket to the same line as function declaration). With that, it was sent to Pico alright. But running testGetSignature() returned Error: Function "encodeURIComponent" not found!

    I searched around and found that v8 implements it in javascript­ri.js

    Copied it to Web IDE but it refused to send to Pico with message:
    "A corn parse for plugin/compiler.js failed. Check the editor window for syntax errors."

    There are quite a few "!" marks and these lines are labeled "x"

    if (value < 0x10000) {
          %_TwoByteSeqStringSetChar(index++, value, result);
        } else {
          %_TwoByteSeqStringSetChar(index++, (value >> 10) + 0xd7c0, result);
          %_TwoByteSeqStringSetChar(index++, (value & 0x3ff) + 0xdc00, result);
    var result = %NewString(array.length, NEW_ONE_BYTE_STRING);
        for (var i = 0; i < array.length; i++) {
          %_OneByteSeqStringSetChar(i, array[i], result);

    I'd appreciate any advice to get encodeURIComponent working. I have no idea what these % are doing in javascript...