@pageproof/sdk-pr 388.0.1638934769121 → 389.0.1639006259393
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/api/Accounts.d.ts +7 -0
- package/lib/api/Accounts.js +1 -1
- package/lib/api/AccountsMFA.d.ts +13 -0
- package/lib/api/AccountsMFA.js +1 -0
- package/lib/api/admin/TeamFeatures.d.ts +0 -2
- package/lib/api/admin/TeamFeatures.js +0 -3
- package/lib/models/TeamEmailFeatures.d.ts +0 -6
- package/lib/models/TeamEmailFeatures.js +1 -1
- package/lib/network/endpoints.json +5 -1
- package/lib/pageproof.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -286,6 +286,7 @@ Name | Namespace | Description | Admin-only | Stability
|
|
|
286
286
|
--- | --- | --- | --- | ---
|
|
287
287
|
[Accounts API](./class/src/api/Accounts.js~Accounts.html) | `accounts` | Used to create accounts, activate and login. | No | Stable
|
|
288
288
|
[Accounts SSO API](./class/src/api/AccountsSSO.js~AccountsSSO.html) | `accounts.sso` | Used to login using a SSO provider. | No | Experimental
|
|
289
|
+
[Accounts MFA API](./class/src/api/AccountsMFA.js~AccountsMFA.html) | `accounts.mfa` | Used to activate, de-activate and enable user mfa login. | No | experimental
|
|
289
290
|
[Comments API](./class/src/api/Comments.js~Comments.html) | `comments` | Used to load comments. | No | Stable
|
|
290
291
|
[Dashboard API](./class/src/api/Dashboard.js~Dashboard.html) | `dashboard` | Used to load the authenticated user's dashboard & search for/filter proofs. | No | Stable
|
|
291
292
|
[Dashboard Groups API](./class/src/api/DashboardGroups.js~DashboardGroups.html) | `dashboard.groups` | Used to load proof groups | No | Experimental
|
package/lib/api/Accounts.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ declare class Accounts extends API {
|
|
|
8
8
|
* @type {AccountsSSO}
|
|
9
9
|
*/
|
|
10
10
|
sso: AccountsSSO;
|
|
11
|
+
/**
|
|
12
|
+
* The Accounts MFA API.
|
|
13
|
+
*
|
|
14
|
+
* @type {AccountsMFA}
|
|
15
|
+
*/
|
|
16
|
+
mfa: AccountsMFA;
|
|
11
17
|
/** @private */
|
|
12
18
|
_generateCredentials(password: any): any;
|
|
13
19
|
/**
|
|
@@ -206,4 +212,5 @@ declare class Accounts extends API {
|
|
|
206
212
|
}
|
|
207
213
|
import API from "./API";
|
|
208
214
|
import AccountsSSO from "./AccountsSSO";
|
|
215
|
+
import AccountsMFA from "./AccountsMFA";
|
|
209
216
|
import Session from "../models/Session";
|
package/lib/api/Accounts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password){var _this5=this;var _decryptPrivateKey=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password){var _this5=this;var _decryptPrivateKey=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default AccountsMFA;
|
|
2
|
+
declare class AccountsMFA extends API {
|
|
3
|
+
constructor(client: any);
|
|
4
|
+
/**
|
|
5
|
+
* Activates the user MFA to begin setup process.
|
|
6
|
+
*
|
|
7
|
+
* returns setup secret & setup qr code image string.
|
|
8
|
+
*
|
|
9
|
+
* @returns {Promise}
|
|
10
|
+
*/
|
|
11
|
+
setup(): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
import API from "./API";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var AccountsMFA=function(_API){_inherits(AccountsMFA,_API);function AccountsMFA(){_classCallCheck(this,AccountsMFA);return _possibleConstructorReturn(this,_API.apply(this,arguments))}AccountsMFA.prototype.setup=function setup(){return this.client.request("mfa.setup").then(function(response){return response.data})};return AccountsMFA}(_API3.default);exports.default=AccountsMFA;
|
|
@@ -24,7 +24,6 @@ declare class TeamFeatures extends API {
|
|
|
24
24
|
* @param {object} options.emails The emails features
|
|
25
25
|
* @param {boolean} options.emails.displayComments Whether the comment should display in emails or not
|
|
26
26
|
* @param {boolean} options.emails.displayTeamName Whether using the team name or ’PageProof Team’ as the ‘from’ name in Email.
|
|
27
|
-
* @param {string} options.emails.customSenderEmail The custom sender email address of the team notification.
|
|
28
27
|
* @param {object} options.comments The comments features
|
|
29
28
|
* @param {boolean} options.comments.editComments Whether the comments/replies can be edited by other users or not
|
|
30
29
|
* @param {ProofStatus|Array<ProofStatus>} options.comments.disableReplyingToCommentsInStatuses The proof status or array of proof status to disable the replies to comments (by reviewers).
|
|
@@ -39,7 +38,6 @@ declare class TeamFeatures extends API {
|
|
|
39
38
|
emails: {
|
|
40
39
|
displayComments: boolean;
|
|
41
40
|
displayTeamName: boolean;
|
|
42
|
-
customSenderEmail: string;
|
|
43
41
|
};
|
|
44
42
|
comments: {
|
|
45
43
|
editComments: boolean;
|
|
@@ -62,7 +62,6 @@ var TeamFeatures = function (_API) {
|
|
|
62
62
|
* @param {object} options.emails The emails features
|
|
63
63
|
* @param {boolean} options.emails.displayComments Whether the comment should display in emails or not
|
|
64
64
|
* @param {boolean} options.emails.displayTeamName Whether using the team name or ’PageProof Team’ as the ‘from’ name in Email.
|
|
65
|
-
* @param {string} options.emails.customSenderEmail The custom sender email address of the team notification.
|
|
66
65
|
* @param {object} options.comments The comments features
|
|
67
66
|
* @param {boolean} options.comments.editComments Whether the comments/replies can be edited by other users or not
|
|
68
67
|
* @param {ProofStatus|Array<ProofStatus>} options.comments.disableReplyingToCommentsInStatuses The proof status or array of proof status to disable the replies to comments (by reviewers).
|
|
@@ -82,7 +81,6 @@ var TeamFeatures = function (_API) {
|
|
|
82
81
|
|
|
83
82
|
var displayComments = emails && emails.displayComments;
|
|
84
83
|
var displayTeamName = emails && emails.displayTeamName;
|
|
85
|
-
var customSenderEmail = emails && emails.customSenderEmail;
|
|
86
84
|
var editComments = comments && comments.editComments;
|
|
87
85
|
var disableReplyingToCommentsInStatuses = comments && comments.disableReplyingToCommentsInStatuses && [].concat(comments.disableReplyingToCommentsInStatuses);
|
|
88
86
|
var proofReference = proofs && proofs.reference;
|
|
@@ -92,7 +90,6 @@ var TeamFeatures = function (_API) {
|
|
|
92
90
|
return this.client.request('admin.team.features.update', {
|
|
93
91
|
displayComments: displayComments,
|
|
94
92
|
displayTeamName: displayTeamName,
|
|
95
|
-
customSenderEmail: customSenderEmail,
|
|
96
93
|
editComments: editComments,
|
|
97
94
|
disableReplyingToCommentsInStatuses: disableReplyingToCommentsInStatuses,
|
|
98
95
|
proofReference: proofReference,
|
|
@@ -14,12 +14,6 @@ declare class TeamEmailFeatures {
|
|
|
14
14
|
* @type {boolean}
|
|
15
15
|
*/
|
|
16
16
|
displayTeamName: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The custom sender email address of the team notification.
|
|
19
|
-
*
|
|
20
|
-
* @type {string}
|
|
21
|
-
*/
|
|
22
|
-
customSenderEmail: string;
|
|
23
17
|
/** @private */
|
|
24
18
|
fromTeamEmailFeatures(teamEmailFeaturesData: any): TeamEmailFeatures;
|
|
25
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var TeamEmailFeatureSchema={displayComments:"DisplayComments",displayTeamName:"DisplayTeamName"
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var TeamEmailFeatureSchema={displayComments:"DisplayComments",displayTeamName:"DisplayTeamName"};var TeamEmailFeatures=function(){function TeamEmailFeatures(){_classCallCheck(this,TeamEmailFeatures)}TeamEmailFeatures.prototype.fromTeamEmailFeatures=function fromTeamEmailFeatures(teamEmailFeaturesData){(0,_transform2.default)(this,TeamEmailFeatureSchema,teamEmailFeaturesData);return this};return TeamEmailFeatures}();exports.default=TeamEmailFeatures;
|
|
@@ -835,7 +835,7 @@
|
|
|
835
835
|
"version": 2,
|
|
836
836
|
"method": "POST",
|
|
837
837
|
"path": "/api/admin/settings",
|
|
838
|
-
"body": ["displayComments", "editComments", "proofReference", "displayTeamName", "disableReplyingToCommentsInStatuses", "publicProofs", "defaultProofIsPublic", "messageToOwners"
|
|
838
|
+
"body": ["displayComments", "editComments", "proofReference", "displayTeamName", "disableReplyingToCommentsInStatuses", "publicProofs", "defaultProofIsPublic", "messageToOwners"]
|
|
839
839
|
},
|
|
840
840
|
"integrations.get-setup-url": {
|
|
841
841
|
"method": "GET",
|
|
@@ -939,6 +939,10 @@
|
|
|
939
939
|
"body": ["email"],
|
|
940
940
|
"anonymous": true
|
|
941
941
|
},
|
|
942
|
+
"mfa.setup": {
|
|
943
|
+
"method": "POST",
|
|
944
|
+
"path": "/api/users/mfa/setup"
|
|
945
|
+
},
|
|
942
946
|
"reminders.add": {
|
|
943
947
|
"version": 2,
|
|
944
948
|
"method": "POST",
|