@Chris Derrell Thank you very much for your comprehensive answer to my problem. In particular I would like to thank you for your very good advice to use the md5 NPM package, instead of referring to a 3rd party API and application.
I would like to share my progress with the community following this good recommendation. When I used the md5 functionality after installation of the md5 NPM package, which I have been using in the first step only on the frontend of my client, I was able to get the expected results successfully.
Here the Code:
// Frontend only
import { getJSON } from 'wix-fetch';
var md5 = require('md5');
//The message you receive in the editor refering to "require" is a warning and can be ignored due to Corvid Team
//as seen in the corvid forum under "Help with importing npm packages"
$w.onReady(function () {
// page related code here...
$w('#UpdateLicenceKeyButton').onClick((event) => {
DetermineLicenceKey();
})});
function DetermineLicenceKey() {
let ProductKey = $w("#PRODUCTKEY").value;
let Salt = "Salz"
let ModProductKey = ProductKey + Salt;
let MyLicenceKey = md5(ModProductKey);
$w('#MyLicenceKey').value=MyLicenceKey;
}
As mentioned earlier, for security reasons the implementation of my code has to follow a backend + frontend solution. In the backend, the function to determine a LicenceKey depending on a variable ProduktKey has to be implemented. In the second step this function must be called in the frontend where the ProductKey as a variable has to be inputted to receive the LicenceKey. In the following the codes in backend and as well in the frontend are shown.
Unfortunately I receive an error “Maximum call stack size exceeded” in the line starting with “export function MyLicenceKey(ProductKey) {” .
Here I definitely need the help from the Corvid community:
// Backend Code for LicenceKey
var md5 = require('md5');
export function MyLicenceKey(ProductKey) {
let Salt= "salz";
let ModProductKey= ProductKey + Salt;
return MyLicenceKey(ProductKey).value=md5(ModProductKey).value;
}
// Frontend Code calling the required function Licencekey from // Backend
import { getJSON } from 'wix-fetch';
import {MyLicenceKey} from 'backend/MyHash';
$w.onReady(function () {
// page related code here...
$w('#UpdateLicenceKeyButton').onClick((event) => {
DetermineLicenceKey();
})});
function DetermineLicenceKey() {
let ProductKey = $w("#PRODUCTKEY").value;
$w('#MyLicenceKey').value = MyLicenceKey(ProductKey);
}
I receive an error “Maximum call stack size exceeded”, in my backend code at line 6 with the code statement “export function MyLicenceKey(ProductKey) {” for which I need the help from the Corvid community.