I am a newbie trying to get going with Rapyd. I cannot generate a signature that works and I have tried the samples and code in gitHub in NodeJS, Java and Dart and have had no luck. For example, the NodeJs version is attached:
private getRapydSignature(
request: any,
method: string,
urlPath: string
): string {
console.log(π―π― getRapydSignature: ${method} ${request}
);
timestamp = (Math.floor(new Date().getTime() / 1000) - 10).toString();
salt = CryptoJS.lib.WordArray.random(12);
console.log("π―π― ..... signature timestamp: " + timestamp);
console.log("π―π― ..... signature salt: " + salt);
var body = "";
if (
JSON.stringify(request) !== "{}" &&
request !== "" &&
typeof request !== "object"
) {
body = JSON.stringify(JSON.parse(request));
}
console.log("π―π― ..... signature body: " + body);
signature =
method.toLowerCase() +
urlPath +
salt +
timestamp +
accessKey +
secretKey +
body;
console.log(
"π―π― ..... signature concatenation: π΅ π΅ " + signature + " π΅ π΅"
);
var rapydSignature = CryptoJS.enc.Hex.stringify(
CryptoJS.HmacSHA256(signature, secretKey)
);
rapydSignature = CryptoJS.enc.Base64.stringify(
CryptoJS.enc.Utf8.parse(rapydSignature)
);
console.log(
"π―π― rapyd_signature calculated: π π π " + rapydSignature + " π"
);
return rapydSignature;
}