Skip to content

Commit

Permalink
Add revoke token feature (#238)
Browse files Browse the repository at this point in the history
* revoke token

* PubNub SDK v4.37.0 release.

Co-authored-by: Client Engineering Bot <60980775+Client Engineering Bot@users.noreply.github.com>
  • Loading branch information
raipubnub and Client Engineering Bot authored Dec 16, 2021
1 parent dce2a24 commit 5a5acfc
Show file tree
Hide file tree
Showing 29 changed files with 504 additions and 126 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ coverage/
*.iml
dist/web/stats.json
dist/titanium/stats.json
dist/contract
dist/cucumber

# GitHub Actions #
##################
Expand Down
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
changelog:
- date: 2021-12-16
version: v4.37.0
changes:
- type: feature
text: "Add revoke token feature."
- date: 2021-12-09
version: v4.36.0
changes:
Expand Down Expand Up @@ -1086,7 +1091,7 @@ supported-platforms:
- "Ubuntu 14.04 and up"
- "Windows 7 and up"
version: "Pubnub Javascript for Node"
version: "4.36.0"
version: "4.37.0"
sdks:
-
full-name: PubNub Javascript SDK
Expand All @@ -1105,7 +1110,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v4.36.0.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v4.37.0.zip
requires:
-
name: "agentkeepalive"
Expand Down Expand Up @@ -1869,7 +1874,7 @@ sdks:
distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v4.36.0/pubnub.4.36.0.js
location: https://github.com/pubnub/javascript/releases/download/v4.37.0/pubnub.4.37.0.js
requires:
-
name: "agentkeepalive"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v4.37.0
December 16 2021

#### Added
- Add revoke token feature.

## v4.36.0
December 09 2021

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ You will need the publish and subscribe keys to authenticate your app. Get your
npm install pubnub
```
* or download one of our builds from our CDN:
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.36.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.36.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.37.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.37.0.min.js
2. Configure your keys:
Expand Down
124 changes: 97 additions & 27 deletions dist/titanium/pubnub.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! 4.36.0 / Consumer */
/*! 4.37.0 / Consumer */
exports["PubNub"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
Expand Down Expand Up @@ -166,7 +166,8 @@ var _default = {
PNRemoveChannelsFromGroupOperation: 'PNRemoveChannelsFromGroupOperation',
PNAccessManagerGrant: 'PNAccessManagerGrant',
PNAccessManagerGrantToken: 'PNAccessManagerGrantToken',
PNAccessManagerAudit: 'PNAccessManagerAudit'
PNAccessManagerAudit: 'PNAccessManagerAudit',
PNAccessManagerRevokeToken: 'PNAccessManagerRevokeToken'
};
exports["default"] = _default;
module.exports = exports.default;
Expand Down Expand Up @@ -588,7 +589,7 @@ var _default = function () {
}, {
key: "getVersion",
value: function getVersion() {
return '4.36.0';
return '4.37.0';
}
}, {
key: "_addPnsdkSuffix",
Expand Down Expand Up @@ -1624,13 +1625,13 @@ var _cborSync = _interopRequireDefault(__webpack_require__(24));

var _pubnubCommon = _interopRequireDefault(__webpack_require__(25));

var _networking = _interopRequireDefault(__webpack_require__(113));
var _networking = _interopRequireDefault(__webpack_require__(114));

var _common = _interopRequireDefault(__webpack_require__(114));
var _common = _interopRequireDefault(__webpack_require__(115));

var _common2 = _interopRequireDefault(__webpack_require__(115));
var _common2 = _interopRequireDefault(__webpack_require__(116));

var _titanium = __webpack_require__(116);
var _titanium = __webpack_require__(117);

var _flow_interfaces = __webpack_require__(2);

Expand Down Expand Up @@ -2459,21 +2460,23 @@ var grantEndpointConfig = _interopRequireWildcard(__webpack_require__(104));

var grantTokenEndpointConfig = _interopRequireWildcard(__webpack_require__(105));

var publishEndpointConfig = _interopRequireWildcard(__webpack_require__(106));
var _revoke_token = _interopRequireDefault(__webpack_require__(106));

var signalEndpointConfig = _interopRequireWildcard(__webpack_require__(107));
var publishEndpointConfig = _interopRequireWildcard(__webpack_require__(107));

var historyEndpointConfig = _interopRequireWildcard(__webpack_require__(108));
var signalEndpointConfig = _interopRequireWildcard(__webpack_require__(108));

var deleteMessagesEndpointConfig = _interopRequireWildcard(__webpack_require__(109));
var historyEndpointConfig = _interopRequireWildcard(__webpack_require__(109));

var messageCountsEndpointConfig = _interopRequireWildcard(__webpack_require__(110));
var deleteMessagesEndpointConfig = _interopRequireWildcard(__webpack_require__(110));

var fetchMessagesEndpointConfig = _interopRequireWildcard(__webpack_require__(111));
var messageCountsEndpointConfig = _interopRequireWildcard(__webpack_require__(111));

var fetchMessagesEndpointConfig = _interopRequireWildcard(__webpack_require__(112));

var timeEndpointConfig = _interopRequireWildcard(__webpack_require__(20));

var subscribeEndpointConfig = _interopRequireWildcard(__webpack_require__(112));
var subscribeEndpointConfig = _interopRequireWildcard(__webpack_require__(113));

var _operations = _interopRequireDefault(__webpack_require__(1));

Expand Down Expand Up @@ -2516,6 +2519,7 @@ var _default = function () {
(0, _defineProperty2["default"])(this, "grant", void 0);
(0, _defineProperty2["default"])(this, "grantToken", void 0);
(0, _defineProperty2["default"])(this, "audit", void 0);
(0, _defineProperty2["default"])(this, "revokeToken", void 0);
(0, _defineProperty2["default"])(this, "subscribe", void 0);
(0, _defineProperty2["default"])(this, "signal", void 0);
(0, _defineProperty2["default"])(this, "presence", void 0);
Expand Down Expand Up @@ -2660,6 +2664,7 @@ var _default = function () {
this.grant = _endpoint["default"].bind(this, modules, grantEndpointConfig);
this.grantToken = _endpoint["default"].bind(this, modules, grantTokenEndpointConfig);
this.audit = _endpoint["default"].bind(this, modules, auditEndpointConfig);
this.revokeToken = _endpoint["default"].bind(this, modules, _revoke_token["default"]);
this.publish = _endpoint["default"].bind(this, modules, publishEndpointConfig);

this.fire = function (args, callback) {
Expand Down Expand Up @@ -4852,7 +4857,8 @@ var _default = function () {
break;

case _operations["default"].PNAccessManagerGrantToken:
operation = 'pam3';
case _operations["default"].PNAccessManagerRevokeToken:
operation = 'pamv3';
break;

default:
Expand Down Expand Up @@ -12530,6 +12536,70 @@ function handleResponse(modules, response) {
"use strict";


var _interopRequireDefault = __webpack_require__(0);

Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;

var _operations = _interopRequireDefault(__webpack_require__(1));

var _utils = _interopRequireDefault(__webpack_require__(3));

var endpoint = {
getOperation: function getOperation() {
return _operations["default"].PNAccessManagerRevokeToken;
},
validateParams: function validateParams(modules, token) {
var secretKey = modules.config.secretKey;

if (!secretKey) {
return 'Missing Secret Key';
}

if (!token) {
return "token can't be empty";
}
},
getURL: function getURL(_ref, token) {
var config = _ref.config;
return "/v3/pam/".concat(config.subscribeKey, "/grant/").concat(_utils["default"].encodeString(token));
},
useDelete: function useDelete() {
return true;
},
getRequestTimeout: function getRequestTimeout(_ref2) {
var config = _ref2.config;
return config.getTransactionTimeout();
},
isAuthSupported: function isAuthSupported() {
return false;
},
prepareParams: function prepareParams(_ref3) {
var config = _ref3.config;
return {
uuid: config.getUUID()
};
},
handleResponse: function handleResponse(_, response) {
return {
status: response.status,
data: response.data
};
}
};
var _default = endpoint;
exports["default"] = _default;
module.exports = exports.default;

/***/ }),
/* 107 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _interopRequireDefault = __webpack_require__(0);

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -12652,7 +12722,7 @@ function handleResponse(modules, serverResponse) {
}

/***/ }),
/* 107 */
/* 108 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -12724,7 +12794,7 @@ function handleResponse(modules, serverResponse) {
}

/***/ }),
/* 108 */
/* 109 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -12835,7 +12905,7 @@ function handleResponse(modules, serverResponse) {
}

/***/ }),
/* 109 */
/* 110 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -12905,7 +12975,7 @@ function handleResponse(modules, serverResponse) {
}

/***/ }),
/* 110 */
/* 111 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -12987,7 +13057,7 @@ function handleResponse(modules, serverResponse) {
}

/***/ }),
/* 111 */
/* 112 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -13128,7 +13198,7 @@ function handleResponse(modules, serverResponse) {
}

/***/ }),
/* 112 */
/* 113 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -13247,7 +13317,7 @@ function handleResponse(modules, serverResponse) {
}

/***/ }),
/* 113 */
/* 114 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -13417,7 +13487,7 @@ exports["default"] = _default;
module.exports = exports.default;

/***/ }),
/* 114 */
/* 115 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -13461,7 +13531,7 @@ exports["default"] = _default;
module.exports = exports.default;

/***/ }),
/* 115 */
/* 116 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down Expand Up @@ -13520,7 +13590,7 @@ exports["default"] = _default;
module.exports = exports.default;

/***/ }),
/* 116 */
/* 117 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand All @@ -13536,7 +13606,7 @@ exports.post = post;

var _flow_interfaces = __webpack_require__(2);

var _utils = __webpack_require__(117);
var _utils = __webpack_require__(118);

function log(url, qs, res) {
var _pickLogger = function _pickLogger() {
Expand Down Expand Up @@ -13634,7 +13704,7 @@ function del(params, endpoint, callback) {
}

/***/ }),
/* 117 */
/* 118 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
Expand Down
4 changes: 2 additions & 2 deletions dist/titanium/pubnub.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5a5acfc

Please sign in to comment.