@pageproof/sdk-pr 92.0.1530833367136 → 92.0.1532904992987
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/CHANGELOG.md +6 -0
- package/lib/adapters/ICryptoAdapter.js +1 -1
- package/lib/adapters/SchedulerCryptoAdapter.js +1 -1
- package/lib/adapters/SyncCryptoAdapter.js +1 -1
- package/lib/api/Comments.js +1 -1
- package/lib/api/Dashboard.js +1 -1
- package/lib/api/DashboardGroups.js +1 -0
- package/lib/api/ProofsGroups.js +1 -1
- package/lib/api/admin/Admin.js +5 -1
- package/lib/api/admin/Team.js +5 -1
- package/lib/api/admin/TeamUsers.js +5 -1
- package/lib/crypto/encryptComment.js +1 -0
- package/lib/crypto/index.js +1 -1
- package/lib/index.js +5 -1
- package/lib/models/Comment.js +1 -1
- package/lib/network/endpoints.json +5 -0
- package/lib/pageproof.js +2 -2
- package/lib/sync-crypto-adapter.js +1 -1
- package/lib/types/EncryptedComment.js +1 -0
- package/lib/util/comment.js +1 -0
- package/lib/util/constants.js +1 -1
- package/lib/util/creationToken.js +1 -0
- package/lib/util/throttle.js +1 -0
- package/lib/worker-crypto-adapter.js +1 -1
- package/lib/{worker.434ad608.js → worker.35eb8871.js} +2 -2
- package/lib/xhr-request-adapter.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.46
|
|
4
|
+
|
|
5
|
+
Released on the 27th of July 2018.
|
|
6
|
+
|
|
7
|
+
- [[#94](https://github.com/PageProofCom/sdk/pull/94)] Support for creating comments and replies (`Comments.create`), parsing `@everyone` and `@all` mentions in comments, as well as some new options that can be used to help throttle how often callbacks are invoked (`onDecryptComments` and `onDecryptCommentsThrottleMs`) when decrypting comments, and catching decryption failures (`onDecryptError`). See [Comments.create](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Comments.js~Comments.html#instance-method-create) and [Comments.load](https://docs.pageproof.tech/@pageproof/sdk/beta/class/src/api/Comments.js~Comments.html#instance-method-load).
|
|
8
|
+
|
|
3
9
|
## 2.0.0-beta.45
|
|
4
10
|
|
|
5
11
|
Released on the 5th of July 2018.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _class,_temp;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function notImplementedStub(name){return new Error(name+" is not implemented on ICryptoAdapter.")}var ICryptoAdapter=(_temp=_class=function(){function ICryptoAdapter(){_classCallCheck(this,ICryptoAdapter)}ICryptoAdapter.prototype.decryptComment=function decryptComment(){throw notImplementedStub("decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(){throw notImplementedStub("decryptFileBlock(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptImage=function decryptImage(){throw notImplementedStub("decryptImage(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(){throw notImplementedStub("decryptPrivateKey(privateKey$: string, password: string): Promise<string>")};ICryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(){throw notImplementedStub("encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(){throw notImplementedStub("encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>")};ICryptoAdapter.prototype.envelopeSeal=function envelopeSeal(){throw notImplementedStub("envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string>")};ICryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(){throw notImplementedStub("envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(){throw notImplementedStub("generateAuthorizationHeaders(method: string, path: string, session: Session): Promise<Object<string, string>>")};ICryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){throw notImplementedStub("generateKeyIV(): Promise<{KeyIV}>")};ICryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){throw notImplementedStub("generateKeyPair(): Promise<{KeyPair}>")};ICryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(){throw notImplementedStub("generatePasswordHash(password: string): Promise<string>")};ICryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(){throw notImplementedStub("generateWrappedSymmetricKey(serverPublicKeyPEM: string): Promise<WrappedSymmetricKey>")};ICryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(){throw notImplementedStub("decryptManagedPrivateKey(privateKey$: string, keyBase64: string): Promise<string>")};return ICryptoAdapter}(),_class.__adapter__="ICryptoAdapter",_temp);exports.default=ICryptoAdapter;
|
|
1
|
+
"use strict";exports.__esModule=true;var _class,_temp;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function notImplementedStub(name){return new Error(name+" is not implemented on ICryptoAdapter.")}var ICryptoAdapter=(_temp=_class=function(){function ICryptoAdapter(){_classCallCheck(this,ICryptoAdapter)}ICryptoAdapter.prototype.decryptComment=function decryptComment(){throw notImplementedStub("decryptComment(comment$: string, envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(){throw notImplementedStub("decryptFileBlock(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptImage=function decryptImage(){throw notImplementedStub("decryptImage(data$: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(){throw notImplementedStub("decryptPrivateKey(privateKey$: string, password: string): Promise<string>")};ICryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(){throw notImplementedStub("encryptFileBlock(keyIV: {key: string, iv: string}, fileBlockBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(){throw notImplementedStub("encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>")};ICryptoAdapter.prototype.envelopeSeal=function envelopeSeal(){throw notImplementedStub("envelopeSeal(secret: string, publicKeyPEMs: Array<string>): Promise<string>")};ICryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(){throw notImplementedStub("envelopeUnseal(envelope: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(){throw notImplementedStub("generateAuthorizationHeaders(method: string, path: string, session: Session): Promise<Object<string, string>>")};ICryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){throw notImplementedStub("generateKeyIV(): Promise<{KeyIV}>")};ICryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){throw notImplementedStub("generateKeyPair(): Promise<{KeyPair}>")};ICryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(){throw notImplementedStub("generatePasswordHash(password: string): Promise<string>")};ICryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(){throw notImplementedStub("generateWrappedSymmetricKey(serverPublicKeyPEM: string): Promise<WrappedSymmetricKey>")};ICryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(){throw notImplementedStub("decryptManagedPrivateKey(privateKey$: string, keyBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptComment=function encryptComment(){throw notImplementedStub("encryptComment(comment: string, publicKeyPEMs: Array<string>): Promise<EncryptedComment>")};return ICryptoAdapter}(),_class.__adapter__="ICryptoAdapter",_temp);exports.default=ICryptoAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _Scheduler=require("../util/Scheduler");var _Scheduler2=_interopRequireDefault(_Scheduler);var _ICryptoAdapter2=require("./ICryptoAdapter");var _ICryptoAdapter3=_interopRequireDefault(_ICryptoAdapter2);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 SchedulerCryptoAdapter=function(_ICryptoAdapter){_inherits(SchedulerCryptoAdapter,_ICryptoAdapter);function SchedulerCryptoAdapter(options){_classCallCheck(this,SchedulerCryptoAdapter);var _this=_possibleConstructorReturn(this,_ICryptoAdapter.call(this));_this.scheduler=new _Scheduler2.default(options);return _this}SchedulerCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEM){return this.scheduler.send({type:"decryptComment",args:[comment$,envelope,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(data$,privateKeyPEM){return this.scheduler.send({type:"decryptFileBlock",args:[data$,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEM){return this.scheduler.send({type:"decryptImage",args:[data$,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return this.scheduler.send({type:"decryptPrivateKey",args:[privateKey$,password]})};SchedulerCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlockBase64){return this.scheduler.send({type:"encryptFileBlock",args:[keyIV,fileBlockBase64]})};SchedulerCryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(privateKeyPEM,password){return this.scheduler.send({type:"encryptPrivateKey",args:[privateKeyPEM,password]})};SchedulerCryptoAdapter.prototype.envelopeSeal=function envelopeSeal(secret,publicKeyPEMs){return this.scheduler.send({type:"envelopeSeal",args:[secret,publicKeyPEMs]})};SchedulerCryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(envelope,privateKeyPEM){return this.scheduler.send({type:"envelopeUnseal",args:[envelope,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(method,path,session){return this.scheduler.send({type:"generateAuthorizationHeaders",args:[method,path,session]})};SchedulerCryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){return this.scheduler.send({type:"generateKeyIV"})};SchedulerCryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){return this.scheduler.send({type:"generateKeyPair"})};SchedulerCryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(password){return this.scheduler.send({type:"generatePasswordHash",args:[password]})};SchedulerCryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(serverPublicKeyPEM){return this.scheduler.send({type:"generateWrappedSymmetricKey",args:[serverPublicKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(privateKey$,keyBase64){return this.scheduler.send({type:"decryptManagedPrivateKey",args:[privateKey$,keyBase64]})};return SchedulerCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SchedulerCryptoAdapter;
|
|
1
|
+
"use strict";exports.__esModule=true;var _Scheduler=require("../util/Scheduler");var _Scheduler2=_interopRequireDefault(_Scheduler);var _ICryptoAdapter2=require("./ICryptoAdapter");var _ICryptoAdapter3=_interopRequireDefault(_ICryptoAdapter2);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 SchedulerCryptoAdapter=function(_ICryptoAdapter){_inherits(SchedulerCryptoAdapter,_ICryptoAdapter);function SchedulerCryptoAdapter(options){_classCallCheck(this,SchedulerCryptoAdapter);var _this=_possibleConstructorReturn(this,_ICryptoAdapter.call(this));_this.scheduler=new _Scheduler2.default(options);return _this}SchedulerCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEM){return this.scheduler.send({type:"decryptComment",args:[comment$,envelope,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(data$,privateKeyPEM){return this.scheduler.send({type:"decryptFileBlock",args:[data$,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEM){return this.scheduler.send({type:"decryptImage",args:[data$,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return this.scheduler.send({type:"decryptPrivateKey",args:[privateKey$,password]})};SchedulerCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlockBase64){return this.scheduler.send({type:"encryptFileBlock",args:[keyIV,fileBlockBase64]})};SchedulerCryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(privateKeyPEM,password){return this.scheduler.send({type:"encryptPrivateKey",args:[privateKeyPEM,password]})};SchedulerCryptoAdapter.prototype.envelopeSeal=function envelopeSeal(secret,publicKeyPEMs){return this.scheduler.send({type:"envelopeSeal",args:[secret,publicKeyPEMs]})};SchedulerCryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(envelope,privateKeyPEM){return this.scheduler.send({type:"envelopeUnseal",args:[envelope,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(method,path,session){return this.scheduler.send({type:"generateAuthorizationHeaders",args:[method,path,session]})};SchedulerCryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){return this.scheduler.send({type:"generateKeyIV"})};SchedulerCryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){return this.scheduler.send({type:"generateKeyPair"})};SchedulerCryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(password){return this.scheduler.send({type:"generatePasswordHash",args:[password]})};SchedulerCryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(serverPublicKeyPEM){return this.scheduler.send({type:"generateWrappedSymmetricKey",args:[serverPublicKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(privateKey$,keyBase64){return this.scheduler.send({type:"decryptManagedPrivateKey",args:[privateKey$,keyBase64]})};SchedulerCryptoAdapter.prototype.encryptComment=function encryptComment(comment,publicKeyPEMs){return this.scheduler.send({type:"encryptComment",args:[comment,publicKeyPEMs]})};return SchedulerCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SchedulerCryptoAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _ICryptoAdapter2=require("./ICryptoAdapter");var _ICryptoAdapter3=_interopRequireDefault(_ICryptoAdapter2);var _crypto=require("../crypto");var crypto=_interopRequireWildcard(_crypto);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}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 SyncCryptoAdapter=function(_ICryptoAdapter){_inherits(SyncCryptoAdapter,_ICryptoAdapter);function SyncCryptoAdapter(){_classCallCheck(this,SyncCryptoAdapter);return _possibleConstructorReturn(this,_ICryptoAdapter.apply(this,arguments))}SyncCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEM){return crypto.decryptComment(comment$,envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEM){return crypto.decryptImage(data$,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return crypto.decryptPrivateKey(privateKey$,password)};SyncCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlockBase64){return crypto.encryptFileBlock(keyIV,fileBlockBase64)};SyncCryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(privateKeyPEM,password){return crypto.encryptPrivateKey(privateKeyPEM,password)};SyncCryptoAdapter.prototype.envelopeSeal=function envelopeSeal(secret,publicKeyPEMs){return crypto.envelopeSeal(secret,publicKeyPEMs)};SyncCryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(envelope,privateKeyPEM){return crypto.envelopeUnseal(envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(method,path,session){return crypto.generateAuthorizationHeaders(method,path,session)};SyncCryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){return crypto.generateKeyIV()};SyncCryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){return crypto.generateKeyPair()};SyncCryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(password){return crypto.generatePasswordHash(password)};SyncCryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(serverPublicKeyPEM){return crypto.generateWrappedSymmetricKey(serverPublicKeyPEM)};SyncCryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(privateKey$,keyBase64){return crypto.decryptManagedPrivateKey(privateKey$,keyBase64)};return SyncCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SyncCryptoAdapter;
|
|
1
|
+
"use strict";exports.__esModule=true;var _ICryptoAdapter2=require("./ICryptoAdapter");var _ICryptoAdapter3=_interopRequireDefault(_ICryptoAdapter2);var _crypto=require("../crypto");var crypto=_interopRequireWildcard(_crypto);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}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 SyncCryptoAdapter=function(_ICryptoAdapter){_inherits(SyncCryptoAdapter,_ICryptoAdapter);function SyncCryptoAdapter(){_classCallCheck(this,SyncCryptoAdapter);return _possibleConstructorReturn(this,_ICryptoAdapter.apply(this,arguments))}SyncCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEM){return crypto.decryptComment(comment$,envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEM){return crypto.decryptImage(data$,privateKeyPEM)};SyncCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return crypto.decryptPrivateKey(privateKey$,password)};SyncCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlockBase64){return crypto.encryptFileBlock(keyIV,fileBlockBase64)};SyncCryptoAdapter.prototype.encryptPrivateKey=function encryptPrivateKey(privateKeyPEM,password){return crypto.encryptPrivateKey(privateKeyPEM,password)};SyncCryptoAdapter.prototype.envelopeSeal=function envelopeSeal(secret,publicKeyPEMs){return crypto.envelopeSeal(secret,publicKeyPEMs)};SyncCryptoAdapter.prototype.envelopeUnseal=function envelopeUnseal(envelope,privateKeyPEM){return crypto.envelopeUnseal(envelope,privateKeyPEM)};SyncCryptoAdapter.prototype.generateAuthorizationHeaders=function generateAuthorizationHeaders(method,path,session){return crypto.generateAuthorizationHeaders(method,path,session)};SyncCryptoAdapter.prototype.generateKeyIV=function generateKeyIV(){return crypto.generateKeyIV()};SyncCryptoAdapter.prototype.generateKeyPair=function generateKeyPair(){return crypto.generateKeyPair()};SyncCryptoAdapter.prototype.generatePasswordHash=function generatePasswordHash(password){return crypto.generatePasswordHash(password)};SyncCryptoAdapter.prototype.generateWrappedSymmetricKey=function generateWrappedSymmetricKey(serverPublicKeyPEM){return crypto.generateWrappedSymmetricKey(serverPublicKeyPEM)};SyncCryptoAdapter.prototype.decryptManagedPrivateKey=function decryptManagedPrivateKey(privateKey$,keyBase64){return crypto.decryptManagedPrivateKey(privateKey$,keyBase64)};SyncCryptoAdapter.prototype.encryptComment=function encryptComment(comment,publicKeyPEMs){return crypto.encryptComment(comment,publicKeyPEMs)};return SyncCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SyncCryptoAdapter;
|
package/lib/api/Comments.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");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}function getCommentDataFromPages(pages){var comments=[];Object.keys(pages).forEach(function(pageNumber){pages[pageNumber].Comments.forEach(function(commentData){comments.push(commentData)})});return comments}var _sortPages=(0,_sort.sortObjectsByKey)("pageNumber");var _sortCreatedDateDESC=(0,_sort.sortObjectsByKey)("createdDate",true);var _sortCreatedDateASC=(0,_sort.sortObjectsByKey)("createdDate",false);var sortComments=(0,_sort.combineSort)(_sortPages,_sortCreatedDateDESC);var sortReplies=(0,_sort.combineSort)(_sortPages,_sortCreatedDateASC);function mapComments(commentsData){var comments=[];var replies=[];commentsData.forEach(function(commentData){var entity=(new _Comment2.default).fromComment(commentData);if(entity.parentCommentId){replies.push(entity)}else{comments.push(entity)}});comments.sort(sortComments);var commentIds=comments.map(function(c){return c.id});var sortByParentCommentIndex=(0,_sort.sortObjectsBy)(function(r){return commentIds.indexOf(r.parentCommentId)},true);replies.sort((0,_sort.combineSort)(sortReplies,sortByParentCommentIndex));return comments.concat(replies)}var Comments=function(_API){_inherits(Comments,_API);function Comments(){_classCallCheck(this,Comments);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Comments.prototype._mark=function _mark(commentId,state,value){var _data;var field=void 0;switch(state){case _CommentState2.default.TODO:{field="change";break}case _CommentState2.default.DONE:{field="done";break}default:{throw new Error('Cannot mark comment state "'+state+'".')}}var data=(_data={commentId:commentId},_data[field]=value?1:0,_data);return this.client.request("comments.state.update",data).then(function(){return null})};Comments.prototype.mark=function mark(commentId,state){return this._mark(commentId,state,true)};Comments.prototype.unmark=function unmark(commentId,state){return this._mark(commentId,state,false)};Comments.prototype.load=function load(_options){var _this2=this;var options=typeof _options==="string"?{proofId:_options}:_options;var proofId=options.proofId,_options$pageNumber=options.pageNumber,pageNumber=_options$pageNumber===undefined?null:_options$pageNumber,_options$sinceDate=options.sinceDate,sinceDate=_options$sinceDate===undefined?null:_options$sinceDate,_options$async=options.async,async=_options$async===undefined?false:_options$async,_options$decrypt=options.decrypt,decrypt=_options$decrypt===undefined?true:_options$decrypt,onDecryptComment=options.onDecryptComment;var sinceDateISO=sinceDate?sinceDate.toISOString().match(_constants.ISO_REGEX)[0]:_constants.DEFAULT_ISO_DATE;var payload={proofId:proofId,page:pageNumber,timestamp:sinceDateISO};return this.client.request(pageNumber!==null?"comments.load-page":"comments.load-all",payload).then(function(response){var comments=mapComments(response.data.Pages?getCommentDataFromPages(response.data.Pages):response.data);var wait=Promise.resolve();if(decrypt){var scheduled=[];var cached=Promise.all(comments.map(function(comment){return _this2.client.cache.auto(_constants.COMMENT_CACHE_PREFIX+comment.comment$,function(resolve){scheduled.push({comment:comment,resolve:resolve})}).then(function(rawComment){if(rawComment){comment.fromRawComment(rawComment)}return comment})}));wait=wait.then(function(){return cached});wait=wait.then(function(){var decrypted=scheduled.map(function(_ref){var comment=_ref.comment,resolve=_ref.resolve;return _this2.client.crypto().decryptComment(comment.comment$,comment.envelope,_this2.client.session.privateKeyPEM).then(function(rawComment){comment.fromRawComment(rawComment);resolve(rawComment);if(onDecryptComment){onDecryptComment(comment)}})});if(!async){return Promise.all(decrypted)}return null})}return wait.then(function(){return comments})})};return Comments}(_API3.default);exports.default=Comments;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Comment=require("../models/Comment");var _Comment2=_interopRequireDefault(_Comment);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _constants=require("../util/constants");var _sort=require("../util/sort");var _comment=require("../util/comment");var _creationToken=require("../util/creationToken");var _throttle=require("../util/throttle");var _throttle2=_interopRequireDefault(_throttle);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}function getCommentDataFromPages(pages){var comments=[];Object.keys(pages).forEach(function(pageNumber){pages[pageNumber].Comments.forEach(function(commentData){comments.push(commentData)})});return comments}var _sortPages=(0,_sort.sortObjectsByKey)("pageNumber");var _sortCreatedDateDESC=(0,_sort.sortObjectsByKey)("createdDate",true);var _sortCreatedDateASC=(0,_sort.sortObjectsByKey)("createdDate",false);var sortComments=(0,_sort.combineSort)(_sortPages,_sortCreatedDateDESC);var sortReplies=(0,_sort.combineSort)(_sortPages,_sortCreatedDateASC);function mapComments(commentsData){var comments=[];var replies=[];commentsData.forEach(function(commentData){var entity=(new _Comment2.default).fromComment(commentData);if(entity.parentCommentId){replies.push(entity)}else{comments.push(entity)}});comments.sort(sortComments);var commentIds=comments.map(function(c){return c.id});var sortByParentCommentIndex=(0,_sort.sortObjectsBy)(function(r){return commentIds.indexOf(r.parentCommentId)},true);replies.sort((0,_sort.combineSort)(sortReplies,sortByParentCommentIndex));return comments.concat(replies)}var Comments=function(_API){_inherits(Comments,_API);function Comments(){_classCallCheck(this,Comments);return _possibleConstructorReturn(this,_API.apply(this,arguments))}Comments.prototype._mark=function _mark(commentId,state,value){var _data;var field=void 0;switch(state){case _CommentState2.default.TODO:{field="change";break}case _CommentState2.default.DONE:{field="done";break}default:{throw new Error('Cannot mark comment state "'+state+'".')}}var data=(_data={commentId:commentId},_data[field]=value?1:0,_data);return this.client.request("comments.state.update",data).then(function(){return null})};Comments.prototype.mark=function mark(commentId,state){return this._mark(commentId,state,true)};Comments.prototype.unmark=function unmark(commentId,state){return this._mark(commentId,state,false)};Comments.prototype.load=function load(_options){var _this2=this;var options=typeof _options==="string"?{proofId:_options}:_options;var proofId=options.proofId,_options$pageNumber=options.pageNumber,pageNumber=_options$pageNumber===undefined?null:_options$pageNumber,_options$sinceDate=options.sinceDate,sinceDate=_options$sinceDate===undefined?null:_options$sinceDate,_options$async=options.async,async=_options$async===undefined?false:_options$async,_options$decrypt=options.decrypt,decrypt=_options$decrypt===undefined?true:_options$decrypt,onDecryptComment=options.onDecryptComment,onDecryptComments=options.onDecryptComments,_options$onDecryptCom=options.onDecryptCommentsThrottleMs,onDecryptCommentsThrottleMs=_options$onDecryptCom===undefined?1e3:_options$onDecryptCom,onDecryptError=options.onDecryptError;var sinceDateISO=sinceDate?sinceDate.toISOString().match(_constants.ISO_REGEX)[0]:_constants.DEFAULT_ISO_DATE;var payload={proofId:proofId,page:pageNumber,timestamp:sinceDateISO};return this.client.request(pageNumber!==null?"comments.load-page":"comments.load-all",payload).then(function(response){var comments=mapComments(response.data.Pages?getCommentDataFromPages(response.data.Pages):response.data);var wait=Promise.resolve();if(decrypt){var scheduled=[];var pendingBatch=[];var scheduleOnDecryptComments=onDecryptComments?(0,_throttle2.default)(function(){if(pendingBatch.length){onDecryptComments(pendingBatch);pendingBatch=[]}},onDecryptCommentsThrottleMs):function(){};var cached=Promise.all(comments.map(function(comment){return _this2.client.cache.auto(_constants.COMMENT_CACHE_PREFIX+comment.comment$,function(resolve){scheduled.push({comment:comment,resolve:resolve})}).then(function(rawComment){if(rawComment){comment.fromRawComment(rawComment)}return comment})}));wait=wait.then(function(){return cached});wait=wait.then(function(){var decrypted=scheduled.map(function(_ref){var comment=_ref.comment,resolve=_ref.resolve;return _this2.client.crypto().decryptComment(comment.comment$,comment.envelope,_this2.client.session.privateKeyPEM).then(function(rawComment){comment.fromRawComment(rawComment);resolve(rawComment);if(onDecryptComment){onDecryptComment(comment)}pendingBatch.push(comment);scheduleOnDecryptComments()}).catch(function(err){if(onDecryptError){onDecryptError(err,comment)}if(!async){return Promise.reject(err)}return undefined})});if(!async){return Promise.all(decrypted)}return null})}return wait.then(function(){return comments})})};Comments.prototype.create=function create(_ref2){var _this3=this;var raw=_ref2.raw,proofId=_ref2.proofId,_ref2$pageNumber=_ref2.pageNumber,pageNumber=_ref2$pageNumber===undefined?1:_ref2$pageNumber,pin=_ref2.pin,mediaTime=_ref2.mediaTime,mediaDuration=_ref2.mediaDuration,parentCommentId=_ref2.parentCommentId,metadata=_ref2.metadata,state=_ref2.state,retryCreationToken=_ref2.creationToken;var mentions=(0,_comment.getCommentMentions)(raw);var creationToken=retryCreationToken||(0,_creationToken.generateCreationToken)();return this.client.crypto().encryptComment(raw,[this.client.session.serverPublicKeyPEM,this.client.session.publicKeyPEM]).then(function(_ref3){var envelope=_ref3.envelope,comment$=_ref3.comment$;return{proofId:proofId,page:parentCommentId?undefined:pageNumber,envelope:envelope,encryptedComment:comment$,xy:JSON.stringify({x:pin&&typeof pin.x==="number"?pin.x:null,y:pin&&typeof pin.y==="number"?pin.y:null,x2:pin&&typeof pin.x2==="number"?pin.x2:null,y2:pin&&typeof pin.y2==="number"?pin.y2:null,time:typeof mediaTime==="number"?mediaTime:null,duration:typeof mediaDuration==="number"?mediaDuration:null}),parent:parentCommentId||undefined,mentions:mentions.map(function(m){return m.id}).join(","),metadata:metadata?JSON.stringify(metadata):"{}",creationToken:creationToken,change:state===_CommentState2.default.TODO?"1":undefined,done:state===_CommentState2.default.DONE?"1":undefined}}).then(function(requestData){return _this3.client.request("comments.create",requestData).then(function(response){return(new _Comment2.default).fromComment(response.data).fromRawComment(raw)})}).catch(function(err){if(err){err.creationToken=creationToken}return Promise.reject(err)})};return Comments}(_API3.default);exports.default=Comments;
|
package/lib/api/Dashboard.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);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 TABS={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"};function transformTabs(data){var tabs={};Object.keys(TABS).forEach(function(name){tabs[name]=data[TABS[name]]});return tabs}function transformProofs(proofs){return(proofs||[]).map(function(proofData){return(new _Proof2.default).fromProof(proofData)})}var Dashboard=function(_API){_inherits(Dashboard,_API);function Dashboard(){_classCallCheck(this,Dashboard);
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _DashboardGroups=require("./DashboardGroups");var _DashboardGroups2=_interopRequireDefault(_DashboardGroups);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 TABS={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox"};function transformTabs(data){var tabs={};Object.keys(TABS).forEach(function(name){tabs[name]=data[TABS[name]]});return tabs}function transformProofs(proofs){return(proofs||[]).map(function(proofData){return(new _Proof2.default).fromProof(proofData)})}var Dashboard=function(_API){_inherits(Dashboard,_API);function Dashboard(client){_classCallCheck(this,Dashboard);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.groups=new _DashboardGroups2.default(client);return _this}Dashboard.prototype.inbox=function inbox(){return this._loadSingleTabProofs("inbox")};Dashboard.prototype.sent=function sent(){return this._loadSingleTabProofs("sent")};Dashboard.prototype.outbox=function outbox(){return this._loadSingleTabProofs("outbox")};Dashboard.prototype._loadSingleTabProofs=function _loadSingleTabProofs(name){return this.client.request("dashboard."+name).then(function(response){return transformTabs(response.data)}).then(function(dashboard){return dashboard[name]}).then(transformProofs)};Dashboard.prototype.search=function search(query){return this._loadSearchProofs({query:query})};Dashboard.prototype.everything=function everything(){return this._loadSearchProofs({all:1})};Dashboard.prototype.approved=function approved(){return this._loadSearchProofs({filterBy:70})};Dashboard.prototype.archived=function archived(){return this._loadSearchProofs({filterBy:100})};Dashboard.prototype._loadSearchProofs=function _loadSearchProofs(params){return this.client.request("dashboard.search",params).then(function(response){return transformProofs(response.data.Proofs)})};return Dashboard}(_API3.default);exports.default=Dashboard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);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}function transformGroups(groups){return(groups||[]).map(function(groupData){return(new _ProofGroup2.default).fromProofGroup(groupData)})}var DashboardGroups=function(_API){_inherits(DashboardGroups,_API);function DashboardGroups(){_classCallCheck(this,DashboardGroups);return _possibleConstructorReturn(this,_API.apply(this,arguments))}DashboardGroups.prototype._loadGroups=function _loadGroups(filterBy){return this.client.request("dashboard.groups.filter-by",{filterBy:filterBy}).then(function(response){return transformGroups(response.data)})};DashboardGroups.prototype.current=function current(){return this._loadGroups("current")};return DashboardGroups}(_API3.default);exports.default=DashboardGroups;
|
package/lib/api/ProofsGroups.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);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}function mapResponseToGroup(response){return(new _ProofGroup2.default).fromProofGroup(response.data)}var ProofsGroups=function(_API){_inherits(ProofsGroups,_API);function ProofsGroups(client){_classCallCheck(this,ProofsGroups);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _GroupsOwners2.default(client);_this.workflows=new _GroupsWorkflows2.default(client);return _this}ProofsGroups.prototype.create=function create(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},name=_ref.name;return this.client.request("proofs.groups.create",{name:name}).then(mapResponseToGroup)};ProofsGroups.prototype.load=function load(groupId){return this.client.request("proofs.groups.load",{groupId:groupId}).then(mapResponseToGroup)};ProofsGroups.prototype.ready=function ready(groupId){return this.client.request("proofs.groups.ready",{groupId:groupId})};ProofsGroups.prototype.update=function update(groupId,_ref2){var name=_ref2.name;return this.client.request("proofs.groups.update",{groupId:groupId,name:name}).then(mapResponseToGroup)};
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofGroup=require("../models/ProofGroup");var _ProofGroup2=_interopRequireDefault(_ProofGroup);var _GroupsOwners=require("./GroupsOwners");var _GroupsOwners2=_interopRequireDefault(_GroupsOwners);var _GroupsWorkflows=require("./GroupsWorkflows");var _GroupsWorkflows2=_interopRequireDefault(_GroupsWorkflows);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}function mapResponseToGroup(response){return(new _ProofGroup2.default).fromProofGroup(response.data)}var ProofsGroups=function(_API){_inherits(ProofsGroups,_API);function ProofsGroups(client){_classCallCheck(this,ProofsGroups);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _GroupsOwners2.default(client);_this.workflows=new _GroupsWorkflows2.default(client);return _this}ProofsGroups.prototype.create=function create(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},name=_ref.name;return this.client.request("proofs.groups.create",{name:name}).then(mapResponseToGroup)};ProofsGroups.prototype.load=function load(groupId){return this.client.request("proofs.groups.load",{groupId:groupId}).then(mapResponseToGroup)};ProofsGroups.prototype.ready=function ready(groupId){return this.client.request("proofs.groups.ready",{groupId:groupId})};ProofsGroups.prototype.update=function update(groupId,_ref2){var name=_ref2.name;return this.client.request("proofs.groups.update",{groupId:groupId,name:name}).then(mapResponseToGroup)};return ProofsGroups}(_API3.default);exports.default=ProofsGroups;
|
package/lib/api/admin/Admin.js
CHANGED
|
@@ -16,7 +16,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
-
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; }
|
|
19
|
+
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; } /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
|
|
20
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
21
|
+
* Proprietary and confidential.
|
|
22
|
+
*/
|
|
23
|
+
|
|
20
24
|
|
|
21
25
|
var Admin = function (_API) {
|
|
22
26
|
_inherits(Admin, _API);
|
package/lib/api/admin/Team.js
CHANGED
|
@@ -16,7 +16,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
-
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; }
|
|
19
|
+
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; } /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
|
|
20
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
21
|
+
* Proprietary and confidential.
|
|
22
|
+
*/
|
|
23
|
+
|
|
20
24
|
|
|
21
25
|
var Team = function (_API) {
|
|
22
26
|
_inherits(Team, _API);
|
|
@@ -16,7 +16,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
|
|
19
|
-
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; }
|
|
19
|
+
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; } /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
|
|
20
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
21
|
+
* Proprietary and confidential.
|
|
22
|
+
*/
|
|
23
|
+
|
|
20
24
|
|
|
21
25
|
/** @private */
|
|
22
26
|
function transformResponseUsers(response) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;var _aes=require("crypto-js/aes");var _envelopes=require("./envelopes");var _generateKeyIV=require("./generateKeyIV");var _generateKeyIV2=_interopRequireDefault(_generateKeyIV);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function encryptComment(comment,publicKeyPEMs){return(0,_generateKeyIV2.default)().then(function(_ref){var key=_ref.key,iv=_ref.iv,keyIV=_ref.keyIV;return Promise.all([key,iv,(0,_envelopes.envelopeSeal)(keyIV,publicKeyPEMs)])}).then(function(_ref2){var key=_ref2[0],iv=_ref2[1],envelope=_ref2[2];return{envelope:envelope,comment$:(0,_aes.encrypt)(comment,key,{iv:iv}).toString()}})}exports.default=encryptComment;
|
package/lib/crypto/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;exports.decryptManagedPrivateKey=exports.generateWrappedSymmetricKey=exports.generatePasswordHash=exports.generateKeyPair=exports.generateKeyIV=exports.generateAuthorizationHeaders=exports.envelopeUnseal=exports.envelopeSeal=exports.encryptPrivateKey=exports.encryptFileBlock=exports.decryptPrivateKey=exports.decryptImage=exports.decryptFileBlock=exports.decryptComment=undefined;var _decryptComment=require("./decryptComment");var _decryptComment2=_interopRequireDefault(_decryptComment);var _decryptFileBlock=require("./decryptFileBlock");var _decryptFileBlock2=_interopRequireDefault(_decryptFileBlock);var _decryptImage=require("./decryptImage");var _decryptImage2=_interopRequireDefault(_decryptImage);var _decryptPrivateKey=require("./decryptPrivateKey");var _decryptPrivateKey2=_interopRequireDefault(_decryptPrivateKey);var _encryptFileBlock=require("./encryptFileBlock");var _encryptFileBlock2=_interopRequireDefault(_encryptFileBlock);var _encryptPrivateKey=require("./encryptPrivateKey");var _encryptPrivateKey2=_interopRequireDefault(_encryptPrivateKey);var _envelopes=require("./envelopes");var _generateAuthorizationHeaders=require("./generateAuthorizationHeaders");var _generateAuthorizationHeaders2=_interopRequireDefault(_generateAuthorizationHeaders);var _generateKeyIV=require("./generateKeyIV");var _generateKeyIV2=_interopRequireDefault(_generateKeyIV);var _generateKeyPair=require("./generateKeyPair");var _generateKeyPair2=_interopRequireDefault(_generateKeyPair);var _generatePasswordHash=require("./generatePasswordHash");var _generatePasswordHash2=_interopRequireDefault(_generatePasswordHash);var _generateWrappedSymmetricKey=require("./generateWrappedSymmetricKey");var _generateWrappedSymmetricKey2=_interopRequireDefault(_generateWrappedSymmetricKey);var _decryptManagedPrivateKey=require("./decryptManagedPrivateKey");var _decryptManagedPrivateKey2=_interopRequireDefault(_decryptManagedPrivateKey);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.decryptComment=_decryptComment2.default;exports.decryptFileBlock=_decryptFileBlock2.default;exports.decryptImage=_decryptImage2.default;exports.decryptPrivateKey=_decryptPrivateKey2.default;exports.encryptFileBlock=_encryptFileBlock2.default;exports.encryptPrivateKey=_encryptPrivateKey2.default;exports.envelopeSeal=_envelopes.envelopeSeal;exports.envelopeUnseal=_envelopes.envelopeUnseal;exports.generateAuthorizationHeaders=_generateAuthorizationHeaders2.default;exports.generateKeyIV=_generateKeyIV2.default;exports.generateKeyPair=_generateKeyPair2.default;exports.generatePasswordHash=_generatePasswordHash2.default;exports.generateWrappedSymmetricKey=_generateWrappedSymmetricKey2.default;exports.decryptManagedPrivateKey=_decryptManagedPrivateKey2.default;
|
|
1
|
+
"use strict";exports.__esModule=true;exports.encryptComment=exports.decryptManagedPrivateKey=exports.generateWrappedSymmetricKey=exports.generatePasswordHash=exports.generateKeyPair=exports.generateKeyIV=exports.generateAuthorizationHeaders=exports.envelopeUnseal=exports.envelopeSeal=exports.encryptPrivateKey=exports.encryptFileBlock=exports.decryptPrivateKey=exports.decryptImage=exports.decryptFileBlock=exports.decryptComment=undefined;var _decryptComment=require("./decryptComment");var _decryptComment2=_interopRequireDefault(_decryptComment);var _decryptFileBlock=require("./decryptFileBlock");var _decryptFileBlock2=_interopRequireDefault(_decryptFileBlock);var _decryptImage=require("./decryptImage");var _decryptImage2=_interopRequireDefault(_decryptImage);var _decryptPrivateKey=require("./decryptPrivateKey");var _decryptPrivateKey2=_interopRequireDefault(_decryptPrivateKey);var _encryptFileBlock=require("./encryptFileBlock");var _encryptFileBlock2=_interopRequireDefault(_encryptFileBlock);var _encryptPrivateKey=require("./encryptPrivateKey");var _encryptPrivateKey2=_interopRequireDefault(_encryptPrivateKey);var _envelopes=require("./envelopes");var _generateAuthorizationHeaders=require("./generateAuthorizationHeaders");var _generateAuthorizationHeaders2=_interopRequireDefault(_generateAuthorizationHeaders);var _generateKeyIV=require("./generateKeyIV");var _generateKeyIV2=_interopRequireDefault(_generateKeyIV);var _generateKeyPair=require("./generateKeyPair");var _generateKeyPair2=_interopRequireDefault(_generateKeyPair);var _generatePasswordHash=require("./generatePasswordHash");var _generatePasswordHash2=_interopRequireDefault(_generatePasswordHash);var _generateWrappedSymmetricKey=require("./generateWrappedSymmetricKey");var _generateWrappedSymmetricKey2=_interopRequireDefault(_generateWrappedSymmetricKey);var _decryptManagedPrivateKey=require("./decryptManagedPrivateKey");var _decryptManagedPrivateKey2=_interopRequireDefault(_decryptManagedPrivateKey);var _encryptComment=require("./encryptComment");var _encryptComment2=_interopRequireDefault(_encryptComment);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.decryptComment=_decryptComment2.default;exports.decryptFileBlock=_decryptFileBlock2.default;exports.decryptImage=_decryptImage2.default;exports.decryptPrivateKey=_decryptPrivateKey2.default;exports.encryptFileBlock=_encryptFileBlock2.default;exports.encryptPrivateKey=_encryptPrivateKey2.default;exports.envelopeSeal=_envelopes.envelopeSeal;exports.envelopeUnseal=_envelopes.envelopeUnseal;exports.generateAuthorizationHeaders=_generateAuthorizationHeaders2.default;exports.generateKeyIV=_generateKeyIV2.default;exports.generateKeyPair=_generateKeyPair2.default;exports.generatePasswordHash=_generatePasswordHash2.default;exports.generateWrappedSymmetricKey=_generateWrappedSymmetricKey2.default;exports.decryptManagedPrivateKey=_decryptManagedPrivateKey2.default;exports.encryptComment=_encryptComment2.default;
|
package/lib/index.js
CHANGED
|
@@ -27,7 +27,11 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
30
|
-
exports.default = _PageProof2.default;
|
|
30
|
+
exports.default = _PageProof2.default; /* Copyright (C) 2018 PageProof Holdings Limited - All Rights Reserved.
|
|
31
|
+
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
|
32
|
+
* Proprietary and confidential.
|
|
33
|
+
*/
|
|
34
|
+
|
|
31
35
|
exports.Client = _PageProof2.default;
|
|
32
36
|
exports.Bluffer = _bluffer2.default;
|
|
33
37
|
exports.Enum = Enum;
|
package/lib/models/Comment.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _Pin=require("./Pin");var _Pin2=_interopRequireDefault(_Pin);var _File=require("./File");var _File2=_interopRequireDefault(_File);var _CommentState=require("../enum/CommentState");var _CommentState2=_interopRequireDefault(_CommentState);var _comment=require("../util/comment");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 commentSchema={__prepare:function __prepare(data){data._XY=_Pin2.default.parseValue(data.XY)},id:"CommentId",proofId:"ProofId",pin:function pin(data){return(new _Pin2.default).fromPin(data._XY)},user:function user(data){return(new _User2.default).fromUser(data)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function attachments(data){if(data.Attachment){return[(new _File2.default).fromCommentAttachment(data)]}return[]},agreeCount:function agreeCount(data){return data.Agrees.length},pageNumber:(0,_transform.number)("Page"),mediaTime:function mediaTime(data){return data._XY.time==null?undefined:data._XY.time},mediaDuration:function mediaDuration(data){return data._XY.duration==null?undefined:data._XY.duration},createdDate:(0,_transform.date)("Timestamp"),updatedDate:(0,_transform.date)("Updated"),parentCommentId:(0,_transform.optional)("Parent"),metadata:(0,_transform.json)("Metadata",{}),state:function state(data){return+data.Done?_CommentState2.default.DONE:+data.Change?_CommentState2.default.TODO:_CommentState2.default.COMMENT}};var Comment=function(){function Comment(){_classCallCheck(this,Comment)}Comment.prototype.fromComment=function fromComment(commentData){(0,_transform2.default)(this,commentSchema,commentData);return this};Comment.prototype.fromRawComment=function fromRawComment(rawComment){var parsed=(0,_comment.parseComment)(rawComment);this.raw=parsed.raw;this.text=parsed.text;this.html=parsed.html;this.tokens=parsed.tokens;return this};return Comment}();exports.default=Comment;
|
|
@@ -379,6 +379,11 @@
|
|
|
379
379
|
"path": "/api/proofs/comment/updatestatus",
|
|
380
380
|
"body": ["commentId", "change", "done"]
|
|
381
381
|
},
|
|
382
|
+
"comments.create": {
|
|
383
|
+
"method": "POST",
|
|
384
|
+
"path": "/api/proofs/comment/create",
|
|
385
|
+
"body": ["proofId", "page", "envelope", "encryptedComment", "xy", "parent", "mentions", "metadata", "creationToken", "change", "done"]
|
|
386
|
+
},
|
|
382
387
|
"proofs-owners.add": {
|
|
383
388
|
"version": 2,
|
|
384
389
|
"method": "POST",
|