ECMABytes - A javascript space to hang out!

Project URL: https://ecmabytes.glitch.me

ECMABytes

A space where JavaScript coders can play and create challenges.

Features

:spider_web: Lightweight and fast rendering based on Vue.js

:spider_web: 1990’s Retro UI

:spider_web: Strong authorization system, username (unique) and password (encoded) and a SECRET (check localStorage)

:spider_web: Fast and efficient data transfer due to remote sqlite database

:spider_web: Not open-source

:spider_web: Mini user tab on top-right corner, keeping record of eXperiencePoints and Likes

:spider_web: Codes as an attempt are privately stored, only code length is public

Instructions for challenges

  1. Start by typing in fx = args => { ... } for ES6, or function fx(args) { ... } for ES5. Note that function name must be fx
  2. Once your function definition is done, you can hit check syntax to verify
  3. After that, you can move on to the sample test cases designed by the author of the challenge
  4. If your function passes every tests, you are free to make a final submit

In case if you reloaded the page, it’s no problem. Your last code will be saved on every “Check syntax” hit :wink:

Instructions for adding tests cases

  1. Test cases exists in (input, output) pair
  2. You must add a minimum of 5 test cases
  3. Format for test values: "string", [a,r,r,a,y], 123
  4. You must add a code yourself in order to cross-verify your sample tests

Note that, test cases aren’t stored locally.

6 Likes

Awww, can you at least make the Vue part open-source? Like are you using the Vue CLI or client-side Vue along with Javascript?

Also, for the “isDigit” challenge, isn’t this an ideal solution:

fx = args => {
   return isNaN(args);
}

However, the tests failed.

fx=x=>x===x+0

shortest solution but it doesn’t pass the tests somewhy :frowning:

Yeah, same here. :cry:

Hi there,
May I ask how and where you are storing user information (e.g. usernames and passwords)? I don’t really like signing up for community projects not knowing if they have put information security and privacy first.

I can’t @khalby786 as the server part contains encoding algorithm. However, you can use inspector anytime for the client side vue code. :slight_smile:
Also, I’m not using Vue on server-side

1 Like

Note that isNaN checks if it is not a number.

Is this “isDigit” challenge?

yeah, !isNaN should be here

2 Likes

Ok, didn’t realize that until now.

Well @EddiesTech, I store the usernames and passwords in sqlite db. The passwords are encoded first and then stored. The encoding isn’t as simple as atob / btoa encoding.

Can you let us know the exact method? As we have said many times on this forum, you should be using a hashing and salting methods. I assume you are doing so.

I’m not using hashing / salting, as I was not aware of the fact that it is compulsory. Perhaps, I’m not much active on the forum. I think, I must implement it.
However, I’m using many cycles (~50) of encoding and string manipulation.

It’s not compulsory, but it’s the best method and really simple to set up (e.g. bcrypt uses hashing and salting) or you could use @ihack2712’s own library which supports a wide variety of methods :slight_smile:

4 Likes

See: A secure-, idiot proof hashing module

4 Likes

encoding doesn’t really help as it can be decoded. Encoding is even less secure than encryption (which btw shouldn’t be used either). Encoding and decoding happens without a key.

Hashing and salting should be used, as Eddie recommended your can use either bcrypt or my very own idiot proof hashing library:

const { hash, test } = require("ihacks-hash");

const passwordHash = hash("sha512", "my password", undefined, 1000);
const isPasswordValid = test(passwordHash, "my password");

if (isPasswordValid) console.log("Password is valid!");
else console.log("Password isn't valid!");

I agree with all the things you and @EddiesTech had said, but I can’t find some quickest way to update passwords in table. Do I have to use update command for taht?

Can you elaborate? 

Where do you save the passwords currently? A file? You should be using a database (MongoDB Atlas, deta are a few free examples)

How come you thought I’m using a file @EddiesTech ? A file can be easily viewed like “example.glitch.com/filename.txt”. :joy:
I’m using sqlite3 npm module. And, now I want to know how to update the passwords (encoded -> hashed), apart from using update sql cmd?

Like updating the encoded passwords to use hashed passwords instead?

Yes, that’s exactly what I meant.

Ahh… makes more sense. I don’t really know why I assumed you were using a file :joy:

I’m pretty trash at JavaScript but this seems very cool. Thanks!

2 Likes

Glad to know that :smile: @RiversideRocks

const { hash, verify } = require("ihacks-hash")

db.all("SELECT password from Users", (err, passwords =>
  passwords.forEach(user =>
    db.run("UPDATE Users SET password=? WHERE password=?", hash("sha256", user.password, undefined, 1000), user.password)
  )
)

You probably have to change on it a little bit.

1 Like

Thanks for your help @ihack2712 . I’m currently working on an unstable beta version (which is preview of future updates) and I’m going to check this out there. I’m pretty sure this will do the job :slightly_smiling_face:

I wrote out an amazing test but I can’t post it since there’s no post button on the create page!

Hey @rnss, I forgot to mention that you’ve to add a solution yourself to cross-verify your tests. Without the code, you would not be able to see the submit button.

The power of Vue…:grin: :

1 Like

UPDATE!!

ecmabytes got a new update.

  • fixed user authorization issues, removed form element, added vue checks
  • added a leaderboard
  • added info page
  • added encryption instead of encoding
  • works on mobile devices too

Any bugs / feedbacks are welcomed!

EDIT: Found a bug on mobile devices on login page, caused due to event.submitter property during submit event.

3 Likes

:new_moon: dark mode is live…

1 Like

It doesn’t really look good with the contact form - the text is black and background is black @vrintle

Have a look now @anon69241012

@vrintle whoa…

1 Like

@anon69241012, due to this error:

Can't read property `code` of undefined

inside vuejs template, the execution stopped. But, it wasn’t for me, so I misunderstood you!

1 Like

Version 3, major updates, security fixes.

ECMAbytes got a security update just now!
Thanks to a user lololol.

This user has pointed out some loopholes in the server, which were very important to be fixed.

Note: I will try to restore a toggle theme mode button, which was reverted by Glitch.

Love the simple design - not too bad!

1 Like