Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Importing jsSHA into project

ANSWERED

Hi,

 

I'm struggling to import jsSHA into my project. I've tried several different ways and also read about how FitBit OS is far away from standard Javascript.

 

Any help would be appreciated!

 

Thanks,

JumpMaster

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

I used npm and browserify to import jsSHA. You can see the resulting file here:

 

https://github.com/Lixxia/fitbit-authenticator/blob/master/common/sha.js

 

Hope this helps!

View best answer in original post

Best Answer
0 Votes
8 REPLIES 8

Forgot to link to jsSHA and this forum has no edit button...

 

https://github.com/Caligatio/jsSHA

Best Answer
0 Votes

I used npm and browserify to import jsSHA. You can see the resulting file here:

 

https://github.com/Lixxia/fitbit-authenticator/blob/master/common/sha.js

 

Hope this helps!

Best Answer
0 Votes

That's massively helpful. I created QuickAuth for Pebble and was going to create it for FitBit.  Your app looks great.  Is the FitBit really not capable of generating the codes locally?

Best Answer
0 Votes

Awesome! I came from pebble so the missing authenticator was a big deal for me 😛

 

I originally wrote the app to keep everything on the watch, however when first testing it on a Versa the code generation (for one token) took a good 5-7 seconds if not more, freezing the watch during that time. Adding any more tokens would increase the calculation time by several additional seconds. Speaking to the devs on the discord I was informed that the device wasn't really optimized for crypto calculations like SHA/HMAC.

 

Since this is written in JS instead of C I was doubtful I could optimize the code to the point that I could leave it on the watch, so I decided to move all the calculations to the phone to keep it as snappy as possible.

 

Best Answer
0 Votes

Wow it's shocking that a watch made six years ago can out perform the Versa.  That's a shame.

 

If I find a way to do it I'll let you know but I'm not hopeful.  I copy and pasted the SHA1 code on the Pebble straight from Google last time 🙂

Best Answer
0 Votes

Agreed, it was very disappointing when I first tested it out 😞

 

Definitely keep me updated, and good luck!

Best Answer
0 Votes

Have you opened a feature request? 😛

Best Answer
0 Votes

Feature request opened here.

Best Answer