Skip to content

Commit

Permalink
fix(encryptedvaluefieldname): change encryptedProperty to encryptedVa…
Browse files Browse the repository at this point in the history
…lueFieldName

changed environment  variable encryptedProperty to encryptedValueFieldName so it matches with the
configuration field name in client-encryption-nodejs
  • Loading branch information
joseph-neeraj committed Nov 14, 2023
1 parent 9775a8a commit 67b07b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/jwe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function jweEncryption(pm) {
const reqBody = JSON.parse(pm.request.body.raw);
const pathToRawData = pm.environment.get('pathToRawData');
const pathToEncryptedData = pm.environment.get('pathToEncryptedData');
const encryptedProperty = 'encryptedData';
const encryptedValueFieldName = pm.environment.get('encryptedValueFieldName') ?? 'encryptedData';
const publicKeyFingerprint = pm.environment.get('publicKeyFingerprint');
const encryptionCertificate = pm.environment.get('encryptionCert');

Expand Down Expand Up @@ -39,9 +39,9 @@ function jweEncryption(pm) {
})
.then((encrypted) => {
const encryptedReqBody = EncryptionUtils.addEncryptedDataToBody(
encrypted,
{ [encryptedValueFieldName]: encrypted },
{ element: pathToRawData, obj: pathToEncryptedData },
encryptedProperty,
encryptedValueFieldName,
reqBody,
);
resolve(encryptedReqBody);
Expand Down
4 changes: 2 additions & 2 deletions test/jwe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe(`Tests for ${jweEncryption.name}()`, () => {
const environment = {
pathToRawData: '$',
pathToEncryptedData: '$',
encryptedProperty: 'encryptedData',
encryptedValueFieldName: 'encryptedData',
encryptionCert,
publicKeyFingerprint: 'abcdef',
};
Expand All @@ -21,7 +21,7 @@ describe(`Tests for ${jweEncryption.name}()`, () => {

test('Encrypts a request object when the encryption path is the root of the request object', async () => {
pm.environment.set('pathToRawData', '$');
pm.environment.set('pathToEncryptedData', 'encryptedData');
pm.environment.set('pathToEncryptedData', '$');

pm.request.body.raw = JSON.stringify({
a: 'b',
Expand Down

0 comments on commit 67b07b0

Please sign in to comment.