hey Bubblers!
we have published a new plugin - Hash & HMAC Encryptor
Hash & HMAC generator for encrypting text strings using one of the following encryption methods: SHA-1,SHA-224,SHA3-224,SHA-256,SHA3-256,SHA-384,SHA3-384,SHA-512,SHA3-512,SHAKE128,SHAKE256
here is the plugin page:
Unfortunately this is not supported right now, and might be a long time before we implement it due to a large backlog of things in progress
sorry about that
@eren, if you need to run something server side, without user interation, you could try webtask.io combined with an API setup in Bubble. This is some code I’ve used in the past to pass details to webtask.io to create the encryption and then pass back to Bubble for use. Depending on your needs it may need slight modifications.
/**
* @param context {WebtaskContext}
*/
module.exports = function(context, req, res) {
var crypto = require('crypto');
var secret = context.data.secret;
var timestamp = context.data.timestamp;
var requestPath = context.data.requestPath;
var method = context.data.method;
var what = timestamp + method + requestPath;
var key = Buffer(secret, 'base64');
var hmac = crypto.createHmac('sha256', key);
var message = hmac.update(what).digest('base64');
var getMessageObj = {
// having to combine the timestamp and message. I'm using regex find/replace in Bubble to split these into the two fields
"result": message
};
res.writeHead(200, {'Content-Type' : 'application/json'});
switch(req.method){
case 'GET':
res.end(JSON.stringify(getMessageObj));
break;
case 'POST':
res.end(JSON.stringify(postMessageObj));
break;
}
res.end(message);
};
Here’s an example for MD5.
/**
* @param context {WebtaskContext}
*/
module.exports = function(context, req, res) {
var crypto = require('crypto');
var nonce = Math.floor(new Date().getTime() / 1000);
var key = context.data.key;
var secret = context.data.secret;
var api_method = context.data.apimethod;
var uri = 'https://www.cryptopia.co.nz/api/' + api_method;
var currency = context.data.currency;
//Post Paramaters
var postParams = {
"Currency": currency,
};
// MD5 Post Paramaters
var md5 = crypto.createHash('md5').update(JSON.stringify(postParams)).digest();
//Base64 encode MD5 Post Parameters
var requestContentBase64String = md5.toString('base64');
var signature = key + "POST" + encodeURIComponent(uri).toLowerCase() + nonce + requestContentBase64String;
var hmacsignature = crypto.createHmac('sha256', new Buffer(secret, "base64")).update(signature).digest().toString('base64');
var amx = "amx " + key + ":" + hmacsignature + ":" + nonce;
var postMessageObj = {
"result": amx
};
res.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify(postMessageObj));
};
Is there any documentation or videos to show us how to use this plugin? I have subscribed already since i don’t know what to do. Once I can resolve my issue of trying to get wizIQ API to run inside of Bubble. If you know how I can do this then please inform me
Can this plugin work with API connector to encrypt key value.
This is what they need:
“jsSHA Javascript library, but any SHA library will work as long as it support SHA-1, HMAC and BASE64 encoded output”
Can you please provide more details on the feature you’re asking about? The detailed description of it will help us to investigate, if the Base64, Hash & HMAC Encryptor plugin can have such functionality.
I’m trying to connect dux-soup through API, they ask to encrypt key every time query is sending.
Standart Api connecter doesn’t allow me to do it, so I’m searching for sollutions.