Base64-encoded HMAC-SHA256 signature?

It would be interesting to see how you guys used went about integrating block spring. Any chance of a brief write-up for the community?

I can try to write something tomorrow.

But again I have to say all the credit goes to Airdev. I can only recommend to contact them to outsource some of the more difficult parts of app development.

3 Likes

Trying to do a similar thing with HMAC-SHA256 - is Blockspring still the best solution?

yep afaik

Hello Pat, I would greatly appreciate your help with this. I need to create a HMAC-SHA256 signature with a couple more parameters, I am pretty lost on how to do this, it seems I have to do it through a Workflow+Blockspring and then send it to the api? How do I do this?.

Thank you for your time!

You can use the plugin ToolBox. It’s got a workflow action called ‘Server script’, with which you can use Node.js’s built-in modules ‘crypto’ and ‘buffers’:

var crypto = require('crypto')
                  , text = 'I love cupcakes'
                  , key = 'abcdeghi'
                  , hash;

var hash = crypto.createHmac('sha256', key).update(text).digest('hex');

var base64 = Buffer.from(hash).toString('base64');

base64;
5 Likes

Hi @miguel

I tried the your mentioned script above in Toolbox’s server script (first time trying server script), but getting a bubble server error. Below is the screen shot of what I’ve entered. I have the data being displayed as a result in a group. What am I missing or doing wrong for this static example?

thx

1 Like

I think you need to type base 64; in a separate line at the end, because that’s what the script will return.

I will update the script I posted.

Let me know if it helped.

1 Like

Hey @miguel can you help me with the code to just convert an image to base64? We’re trying to integrate Onfido Api and they require the images to be sent in base64 format in the API. I’ve been struggling finding the solution an finally came across this thread.

Need your help bro. Want set up the MWS API.

Yeah, that worked, thank you!

1 Like

Used the above script to encrypt the text, Can you give the code to decrypt the same. Im building a publically accessible DB table for searching

1 Like

Hey @prajnyabaliga3186, did you ever find a solution for this? I’m in need of the same functionality…

Hey @mike2

We recently built a similar plug-in for a client. We are happy to help you setup the same. If your interested please direct message me

It was pretty simple, when you upload an image in bubble, you have it’s base64 value available. Since it is a very big balue, you cannot see it in text form in the frontend, but can use in workflows.

Just in case anyone ever finds this post like I did looking for a way to encode a username + API key in base64 to send in an API call with Basic Auth. A big thanks to @miguel for the code. I’m not a javascripter at all so this was a massive help!

In my case, I didn’t need the sha256 encoding, just basic base64 encoding for Basic Auth. My code in the “Service Script” workflow step looks like this:

var base64 = Buffer.from("your_api_username:your_api_key").toString('base64');

base64;

Worked like a charm. Thanks again!

3 Likes

Bubble does have a server side function to sign SHA-256 and base64 encode it. If anyone is still looking for that solution.

IGNORE THE VALUES IN THE IMAGE.

4 Likes

Hey @FlipList , This looks great. My signature requires a “key” and a “value”, do you know how I would go about this?


Endpoint security type – Binance API Documentation (binance-docs.github.io)

I’ve been really stuck on this, as I’m not sure how to generate the signature. Will appreciate some help enormously.

Thanks

Hi @agoo7714 ,

I’m not familiar with this api.

check out this forum post, looks like they’re setting up a call that requires a signature…

1 Like

Hey pat, how did you manage to initialise the API if the timestamp is included in the signature string. My API returns an error if the signature is not correct.

1 Like