Skip to content

Commit b72bfd4

Browse files
committed
Fixing broken test
Fixing broken import Adding JWE info to readme
1 parent 372e139 commit b72bfd4

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ Output:
314314
"path": {
315315
"to": {
316316
"encryptedFoo": {
317-
"encryptedValue": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw"
317+
"encryptedData": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw"
318318
}
319319
}
320320
}
@@ -334,7 +334,7 @@ response.body =
334334
" \"path\": {" +
335335
" \"to\": {" +
336336
" \"encryptedFoo\": {" +
337-
" \"encryptedValue\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"" +
337+
" \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"" +
338338
" }" +
339339
" }" +
340340
" }" +
@@ -399,7 +399,7 @@ let responsePayload = jwe.encrypt("/resource1", header, payload);
399399
Output:
400400
```json
401401
{
402-
"encryptedValue": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw"
402+
"encryptedData": "eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw"
403403
}
404404
```
405405

@@ -435,7 +435,7 @@ const config = {
435435
Example:
436436
```js
437437
const encryptedPayload = "{" +
438-
" \"encryptedValue\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"" +
438+
" \"encryptedData\": \"eyJraWQiOiI3NjFiMDAzYzFlYWRlM….Y+oPYKZEMTKyYcSIVEgtQw\"" +
439439
"}";
440440
const jwe = new (require('mastercard-client-encryption')).JweEncryption(config);
441441
let responsePayload = jwe.decrypt(encryptedPayload);

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
*/
77
module.exports = {
88
Service: require('./lib/mcapi/mcapi-service'),
9-
FieldLevelEncryption: require('./lib/mcapi/mcapi-service').FieldLevelEncryption
9+
FieldLevelEncryption: require('./lib/mcapi/mcapi-service').FieldLevelEncryption,
10+
JweEncryption: require('./lib/mcapi/mcapi-service').JweEncryption
1011
};

lib/mcapi/encryption/field-level-encryption.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Crypto = require('../crypto/field-level-crypto');
1+
const FieldLevelCrypto = require('../crypto/field-level-crypto');
22
const utils = require('../utils/utils');
33

44
/**
@@ -12,7 +12,7 @@ function FieldLevelEncryption(config) {
1212
this.encrypt = encrypt;
1313
this.decrypt = decrypt;
1414
this.config = config;
15-
this.crypto = new Crypto(config);
15+
this.crypto = new FieldLevelCrypto(config);
1616
this.isWithHeader = Object.prototype.hasOwnProperty.call(config, "ivHeaderName") &&
1717
Object.prototype.hasOwnProperty.call(config, "encryptedKeyHeaderName");
1818
this.encryptionResponseProperties = [this.config.ivFieldName, this.config.encryptedKeyFieldName,

test/jwe-encryption.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ describe("JWE Encryption", () => {
102102

103103
describe("#import JweEncryption", () => {
104104

105-
// it("from mcapi-service", () => {
106-
// const JweEncryption = require("..").JweEncryption;
107-
// assert.ok(JweEncryption);
108-
// const encryption = new JweEncryption(testConfig);
109-
// assert.ok(encryption.crypto);
110-
// });
105+
it("from mcapi-service", () => {
106+
const JweEncryption = require("..").JweEncryption;
107+
assert.ok(JweEncryption);
108+
const jwe = new JweEncryption(testConfig);
109+
assert.ok(jwe.crypto);
110+
});
111111

112112
});
113113

0 commit comments

Comments
 (0)