Skip to content

Commit

Permalink
lib and dist
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub committed Oct 5, 2023
1 parent 7cef59d commit f88042f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 38 deletions.
27 changes: 13 additions & 14 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@
this.partnerId = setup.partnerId;
this.setAuthKey(setup.authKey);
this.cryptoModule = setup.cryptoModule;
this.setCipherKey(setup.cipherKey, setup);
this.setFilterExpression(setup.filterExpression);
if (typeof setup.origin !== 'string' && !Array.isArray(setup.origin) && setup.origin !== undefined) {
throw new Error('Origin must be either undefined, a string or a list of strings.');
Expand Down Expand Up @@ -696,6 +695,7 @@
}
this.setUUID(setup.uuid);
}
this.setCipherKey(setup.cipherKey, setup);
}
// exposed setters
default_1.prototype.getAuthKey = function () {
Expand All @@ -706,11 +706,12 @@
return this;
};
default_1.prototype.setCipherKey = function (val, setup, modules) {
var _a;
this.cipherKey = val;
this.cryptoModule = setup.initCryptoModule({ cipherKey: this.cipherKey, useRandomIVs: (_a = this.useRandomIVs) !== null && _a !== void 0 ? _a : true });
if (modules)
modules.cryptoModule = this.cryptoModule;
if (this.cipherKey) {
this.cryptoModule = setup.initCryptoModule({ cipherKey: this.cipherKey, useRandomIVs: this.useRandomIVs });
if (modules)
modules.cryptoModule = this.cryptoModule;
}
return this;
};
default_1.prototype.getUUID = function () {
Expand Down Expand Up @@ -13341,15 +13342,13 @@
setup.PubNubFile = PubNubFile;
setup.cryptography = new WebCryptography();
setup.initCryptoModule = function (cryptoConfiguration) {
if (cryptoConfiguration.cipherKey) {
return new CryptoModule({
default: new LegacyCryptor({
cipherKey: cryptoConfiguration.cipherKey,
useRandomIVs: cryptoConfiguration.useRandomIVs,
}),
cryptors: [new AesCbcCryptor({ cipherKey: cryptoConfiguration.cipherKey })],
});
}
return new CryptoModule({
default: new LegacyCryptor({
cipherKey: cryptoConfiguration.cipherKey,
useRandomIVs: cryptoConfiguration.useRandomIVs,
}),
cryptors: [new AesCbcCryptor({ cipherKey: cryptoConfiguration.cipherKey })],
});
};
_this = _super.call(this, setup) || this;
if (listenToBrowserNetworkEvents) {
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions lib/core/components/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var default_1 = /** @class */ (function () {
this.partnerId = setup.partnerId;
this.setAuthKey(setup.authKey);
this.cryptoModule = setup.cryptoModule;
this.setCipherKey(setup.cipherKey, setup);
this.setFilterExpression(setup.filterExpression);
if (typeof setup.origin !== 'string' && !Array.isArray(setup.origin) && setup.origin !== undefined) {
throw new Error('Origin must be either undefined, a string or a list of strings.');
Expand Down Expand Up @@ -82,6 +81,7 @@ var default_1 = /** @class */ (function () {
}
this.setUUID(setup.uuid);
}
this.setCipherKey(setup.cipherKey, setup);
}
// exposed setters
default_1.prototype.getAuthKey = function () {
Expand All @@ -92,11 +92,12 @@ var default_1 = /** @class */ (function () {
return this;
};
default_1.prototype.setCipherKey = function (val, setup, modules) {
var _a;
this.cipherKey = val;
this.cryptoModule = setup.initCryptoModule({ cipherKey: this.cipherKey, useRandomIVs: (_a = this.useRandomIVs) !== null && _a !== void 0 ? _a : true });
if (modules)
modules.cryptoModule = this.cryptoModule;
if (this.cipherKey) {
this.cryptoModule = setup.initCryptoModule({ cipherKey: this.cipherKey, useRandomIVs: this.useRandomIVs });
if (modules)
modules.cryptoModule = this.cryptoModule;
}
return this;
};
default_1.prototype.getUUID = function () {
Expand Down
16 changes: 7 additions & 9 deletions lib/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ module.exports = /** @class */ (function (_super) {
setup.PubNubFile = node_3.default;
setup.cryptography = new node_2.default();
setup.initCryptoModule = function (cryptoConfiguration) {
if (cryptoConfiguration.cipherKey) {
return new nodeCryptoModule_1.CryptoModule({
default: new nodeCryptoModule_1.LegacyCryptor({
cipherKey: cryptoConfiguration.cipherKey,
useRandomIVs: cryptoConfiguration.useRandomIVs,
}),
cryptors: [new nodeCryptoModule_1.AesCbcCryptor({ cipherKey: cryptoConfiguration.cipherKey })],
});
}
return new nodeCryptoModule_1.CryptoModule({
default: new nodeCryptoModule_1.LegacyCryptor({
cipherKey: cryptoConfiguration.cipherKey,
useRandomIVs: cryptoConfiguration.useRandomIVs,
}),
cryptors: [new nodeCryptoModule_1.AesCbcCryptor({ cipherKey: cryptoConfiguration.cipherKey })],
});
};
if (!('ssl' in setup)) {
setup.ssl = true;
Expand Down
16 changes: 7 additions & 9 deletions lib/web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ var default_1 = /** @class */ (function (_super) {
setup.PubNubFile = web_2.default;
setup.cryptography = new web_1.default();
setup.initCryptoModule = function (cryptoConfiguration) {
if (cryptoConfiguration.cipherKey) {
return new webCryptoModule_1.CryptoModule({
default: new webCryptoModule_1.LegacyCryptor({
cipherKey: cryptoConfiguration.cipherKey,
useRandomIVs: cryptoConfiguration.useRandomIVs,
}),
cryptors: [new webCryptoModule_1.AesCbcCryptor({ cipherKey: cryptoConfiguration.cipherKey })],
});
}
return new webCryptoModule_1.CryptoModule({
default: new webCryptoModule_1.LegacyCryptor({
cipherKey: cryptoConfiguration.cipherKey,
useRandomIVs: cryptoConfiguration.useRandomIVs,
}),
cryptors: [new webCryptoModule_1.AesCbcCryptor({ cipherKey: cryptoConfiguration.cipherKey })],
});
};
_this = _super.call(this, setup) || this;
if (listenToBrowserNetworkEvents) {
Expand Down

0 comments on commit f88042f

Please sign in to comment.