You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const config = {
paths: [
{
path: "/resource",
toEncrypt: [
{
/* path to element to be encrypted in request json body /
element: "path.to.foo",
/ path to object where to store encryption fields in request json body /
obj: "path.to.encryptedFoo"
}],
toDecrypt: [
{
/ path to element where to store decrypted fields in response object /
element: "path.to.encryptedFoo",
/ path to object with encryption fields */
obj: "path.to.foo"
}
]
}
],
ivFieldName: 'iv',
encryptedKeyFieldName: 'encryptedKey',
encryptedValueFieldName: 'encryptedData',
dataEncoding: 'hex',
encryptionCertificate: './certificate.pem',
publicKeyFingerprintType: "certificate",
oaepPaddingDigestAlgorithm: 'SHA-256'
// privateKey: '',
// ivHeaderName: "x-iv",
// EncryptedKeyHeaderName: "x-encrypted-key"
};
const payload =
{
"path": {
"to": {
"foo": {
"sensitive": "this is a secret!"
}
}
}
};
const fle = new clientEncryption.FieldLevelEncryption(config);
console.log(fle)
let responsePayload = fle.encrypt("/resource1", payload);
console.log(responsePayload)
The text was updated successfully, but these errors were encountered:
The response payload is returning a body that is
undefined
.In the code snippet, after calling fle.ecrypt(), when i log the variable to the console:
let responsePayload = fle.encrypt("/resource1", payload);
console.log(responsePayload)
it displays the following:
``` { header: { path: { to: [Object] } }, body: undefined } ````
Below is the code - any help is much appreciated.thanks !
const clientEncryption = require('mastercard-client-encryption');
const config = {
paths: [
{
path: "/resource",
toEncrypt: [
{
/* path to element to be encrypted in request json body /
element: "path.to.foo",
/ path to object where to store encryption fields in request json body /
obj: "path.to.encryptedFoo"
}],
toDecrypt: [
{
/ path to element where to store decrypted fields in response object /
element: "path.to.encryptedFoo",
/ path to object with encryption fields */
obj: "path.to.foo"
}
]
}
],
ivFieldName: 'iv',
encryptedKeyFieldName: 'encryptedKey',
encryptedValueFieldName: 'encryptedData',
dataEncoding: 'hex',
encryptionCertificate: './certificate.pem',
publicKeyFingerprintType: "certificate",
oaepPaddingDigestAlgorithm: 'SHA-256'
// privateKey: '',
// ivHeaderName: "x-iv",
// EncryptedKeyHeaderName: "x-encrypted-key"
};
const payload =
{
"path": {
"to": {
"foo": {
"sensitive": "this is a secret!"
}
}
}
};
const fle = new clientEncryption.FieldLevelEncryption(config);
console.log(fle)
let responsePayload = fle.encrypt("/resource1", payload);
console.log(responsePayload)
The text was updated successfully, but these errors were encountered: