HELP ME! .tostring() conversion in JS not working

Hey All,

I am trying to build a plugin, but it keeps throwing an error while I convert the var to string. I tried passing the var directly, but bubble is telling me it’s not a string! I have been stuck on this for 2 days. Any ideas?

As you can see from the screen shot the HMAC is successfully generated by the plugin but I can’t convert it to a string.

This is the code

P.S. HMAC is the same as the hash. I just used different naming in console.log()

@seanhoots and @jarrad can you guys help! Or anyone else

Hi @AliFarahat,

I don’t know if this is the problem, but the error message states that “tostring” is not a function. Have you tried “toString” (capital “S”)?

Hahaha

Now i feel silly! :stuck_out_tongue_closed_eyes:

that did it

1 Like

Glad it worked. No need to feel silly. Sometimes all it takes is another pair of eyes - especially when you’ve been staring at “code” (eeewwwww!) for a while. :wink:

2 Likes

Hi @AliFarahat, you probably already realise this, so for anyone else watching …

Generating a hash signature using the browser exposes the secret to the current user, which is fine if its already known to the user, but not great for a site-level secret.

Ya I was already aware of this. It’s fine though since I needed it to verify the current user signature. It would be interesting to see how the cryptography will evolve when we have server side code.

@AliFarahat how were you able to use cryptojs in bubble ? I thought bubble plugins couldn’t access nodeJS packages

CryptoJS is just plain JavaScript. The source can be downloaded and used anywhere there’s a JS engine - server side or client side. It’s been used in Google Apps Script, for instance.