HApp
June 29, 2022, 8:45pm
1
I tried to make hash (sha256) using this code:
const hmac = require(‘crypto-js/hmac-sha256’);
const body = {
order_id: ‘123’,
currency: ‘uah’,
wallet_type: ‘ecom’,
amount: 10,
payway: ‘card’,
// …
};
const signature = hmac(JSON.stringify(body), ‘secretKey’)
.toString();
I used Pragmaflow Java script Component.
Unfortunately simply nothing happens
Is it possible to use cryptographic functions in this component? Maybe someone knows how to do it… I need to create hashed signature to be used in API authentication process for payment provider…
Hello,
I can help you, what exactly are you asking for? a sha256 working code?
HApp
June 29, 2022, 9:57pm
3
Hi! Thanks for your reply!
Pragmaflow team released JS component for Adalo, you can find it here: https://adalo.pragmaflowservers.com/install-component
It is called Arbitrary Javascript
I tried to use it (it executes JS code), and I used the code
const hmac = require(‘crypto-js/hmac-sha256’);
const body = {
order_id: ‘123’,
currency: ‘uah’,
wallet_type: ‘ecom’,
amount: 10,
payway: ‘card’,
// …
};
const signature = hmac(JSON.stringify(body), ‘secretKey’)
.toString();
I tried to get encrypted string (sha256 or sha512) with parameters (from body).
For some reason that code did not work in the component and I don’t know the reason…
HApp
June 29, 2022, 10:00pm
4
I am trying to make encrypted auth signature for later use in API requests
Here is the API docs if you ask.
https://docs.crosspay.net
First of all it says:
Signature
How to sign?
You need to generate a signature on your side, based on request data and your secret key. We use HMAC-SHA256.
Simple JS like this component doesn’t allow you to install package; crypto-js/hmac-sha256 is an npm package, so you can’t do it this way