@pageproof/sdk-pr 604.0.1756853351225 → 604.0.1757897254237
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.d.ts +21 -0
- package/lib/adapters/ICryptoAdapter.js +1 -1
- package/lib/adapters/SchedulerCryptoAdapter.d.ts +18 -0
- package/lib/adapters/SchedulerCryptoAdapter.js +1 -1
- package/lib/adapters/SyncCryptoAdapter.d.ts +18 -0
- package/lib/adapters/SyncCryptoAdapter.js +1 -1
- package/lib/api/AccountsSSO.d.ts +37 -1
- package/lib/api/AccountsSSO.js +1 -1
- package/lib/api/Proofs.d.ts +2 -1
- package/lib/api/Proofs.js +1 -1
- package/lib/crypto/authServerEncryption.d.ts +21 -0
- package/lib/crypto/authServerEncryption.js +1 -0
- package/lib/crypto/index.d.ts +4 -1
- package/lib/crypto/index.js +1 -1
- package/lib/models/Proof.d.ts +6 -0
- package/lib/models/Proof.js +1 -1
- package/lib/network/endpoints.json +15 -1
- package/lib/pageproof.js +1 -1
- package/lib/sync-crypto-adapter.js +1 -1
- package/lib/types/IsolatedLoginStatusResult.d.ts +22 -0
- package/lib/types/IsolatedLoginStatusResult.js +1 -0
- package/lib/util/isolatedAuthCert.d.ts +2 -0
- package/lib/util/isolatedAuthCert.js +1 -0
- package/lib/worker-crypto-adapter.js +1 -1
- package/lib/{worker.959d0daf.js → worker.7844e467.js} +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -139,4 +139,25 @@ declare class ICryptoAdapter {
|
|
|
139
139
|
* @returns {Promise<string>} The encrypted block, base64 encoded
|
|
140
140
|
*/
|
|
141
141
|
encryptCommentImportFile(): Promise<string>;
|
|
142
|
+
/**
|
|
143
|
+
* @abstract
|
|
144
|
+
* @param {string} sessionToken The session token to encrypt
|
|
145
|
+
* @param {Object} nonce The nonce object containing key and IV
|
|
146
|
+
* @returns {Promise<string>} The encrypted session token (base64 encoded)
|
|
147
|
+
*/
|
|
148
|
+
encryptSessionToken(): Promise<string>;
|
|
149
|
+
/**
|
|
150
|
+
* @abstract
|
|
151
|
+
* @param {string} encryptedToken The encrypted session token (base64 encoded)
|
|
152
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
153
|
+
* @returns {Promise<string>} The decrypted session token
|
|
154
|
+
*/
|
|
155
|
+
decryptSessionToken(): Promise<string>;
|
|
156
|
+
/**
|
|
157
|
+
* @abstract
|
|
158
|
+
* @param {Object} encryptedData The encrypted session data (hybrid payload object)
|
|
159
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
160
|
+
* @returns {Promise<string>} The decrypted session data
|
|
161
|
+
*/
|
|
162
|
+
decryptSessionData(): Promise<string>;
|
|
142
163
|
}
|
|
@@ -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.decryptBytes=function decryptBytes(){throw notImplementedStub("decryptBytes(comment$: string, envelope$: string, privateKeyPEMs: string[], before: string[], after: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptComment=function decryptComment(){throw notImplementedStub("decryptComment(comment$: string, envelope: string, privateKeyPEMs: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptData=function decryptData(){throw notImplementedStub("decryptData(version: number, data$: string, envelope$: string, privateKeyPEMs: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(){throw notImplementedStub("decryptFileBlock(data$: string, privateKeyPEMs: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptImage=function decryptImage(){throw notImplementedStub("decryptImage(data$: string, privateKeyPEMs: 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, privateKeyPEMs: 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>")};ICryptoAdapter.prototype.generateCommentImportKey=function generateCommentImportKey(){throw notImplementedStub("generateCommentImportKey(serverPublicKeyPEM: string): Promise<{ key: string, key$: string }>")};ICryptoAdapter.prototype.encryptCommentImportFile=function encryptCommentImportFile(){throw notImplementedStub("encryptCommentImportFile(key: string, fileBase64: 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.decryptBytes=function decryptBytes(){throw notImplementedStub("decryptBytes(comment$: string, envelope$: string, privateKeyPEMs: string[], before: string[], after: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptComment=function decryptComment(){throw notImplementedStub("decryptComment(comment$: string, envelope: string, privateKeyPEMs: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptData=function decryptData(){throw notImplementedStub("decryptData(version: number, data$: string, envelope$: string, privateKeyPEMs: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(){throw notImplementedStub("decryptFileBlock(data$: string, privateKeyPEMs: string[]): Promise<string>")};ICryptoAdapter.prototype.decryptImage=function decryptImage(){throw notImplementedStub("decryptImage(data$: string, privateKeyPEMs: 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, privateKeyPEMs: 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>")};ICryptoAdapter.prototype.generateCommentImportKey=function generateCommentImportKey(){throw notImplementedStub("generateCommentImportKey(serverPublicKeyPEM: string): Promise<{ key: string, key$: string }>")};ICryptoAdapter.prototype.encryptCommentImportFile=function encryptCommentImportFile(){throw notImplementedStub("encryptCommentImportFile(key: string, fileBase64: string): Promise<string>")};ICryptoAdapter.prototype.encryptSessionToken=function encryptSessionToken(){throw notImplementedStub("encryptSessionToken(sessionToken: string, nonce: Object): Promise<string>")};ICryptoAdapter.prototype.decryptSessionToken=function decryptSessionToken(){throw notImplementedStub("decryptSessionToken(encryptedToken: string, privateKeyPEM: string): Promise<string>")};ICryptoAdapter.prototype.decryptSessionData=function decryptSessionData(){throw notImplementedStub("decryptSessionData(encryptedData: Object, privateKeyPEM: string): Promise<string>")};return ICryptoAdapter}(),_class.__adapter__="ICryptoAdapter",_temp);exports.default=ICryptoAdapter;
|
|
@@ -118,6 +118,24 @@ declare class SchedulerCryptoAdapter extends ICryptoAdapter {
|
|
|
118
118
|
* @returns {Promise<string>} The encrypted block, base64 encoded
|
|
119
119
|
*/
|
|
120
120
|
encryptCommentImportFile(key: string, fileBase64: string): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* @param {string} sessionToken The session token to encrypt
|
|
123
|
+
* @param {Object} nonce The nonce object containing key and IV
|
|
124
|
+
* @returns {Promise<string>} The encrypted session token (base64 encoded)
|
|
125
|
+
*/
|
|
126
|
+
encryptSessionToken(sessionToken: string, nonce: any): Promise<string>;
|
|
127
|
+
/**
|
|
128
|
+
* @param {string} encryptedToken The encrypted session token (base64 encoded)
|
|
129
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
130
|
+
* @returns {Promise<string>} The decrypted session token
|
|
131
|
+
*/
|
|
132
|
+
decryptSessionToken(encryptedToken: string, privateKeyPEM: string): Promise<string>;
|
|
133
|
+
/**
|
|
134
|
+
* @param {Object} encryptedData The encrypted session data (hybrid payload object)
|
|
135
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
136
|
+
* @returns {Promise<string>} The decrypted session data
|
|
137
|
+
*/
|
|
138
|
+
decryptSessionData(encryptedData: any, privateKeyPEM: string): Promise<string>;
|
|
121
139
|
}
|
|
122
140
|
import ICryptoAdapter from "./ICryptoAdapter";
|
|
123
141
|
import Scheduler from "../util/Scheduler";
|
|
@@ -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.decryptBytes=function decryptBytes(comment$,envelope$,privateKeyPEMs,before,after){return this.scheduler.send({type:"decryptBytes",args:[comment$,envelope$,privateKeyPEMs,before,after]})};SchedulerCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEMs){return this.scheduler.send({type:"decryptComment",args:[comment$,envelope,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptData=function decryptData(version,data$,envelope$,privateKeyPEMs){return this.scheduler.send({type:"decryptData",args:[version,data$,envelope$,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(data$,privateKeyPEMs){return this.scheduler.send({type:"decryptFileBlock",args:[data$,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEMs){return this.scheduler.send({type:"decryptImage",args:[data$,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return this.scheduler.send({type:"decryptPrivateKey",args:[privateKey$,password]})};SchedulerCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlock,decodeBlock){return this.scheduler.send({type:"encryptFileBlock",args:[keyIV,fileBlock,decodeBlock]})};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,privateKeyPEMs){return this.scheduler.send({type:"envelopeUnseal",args:[envelope,privateKeyPEMs]})};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]})};SchedulerCryptoAdapter.prototype.generateCommentImportKey=function generateCommentImportKey(serverPublicKeyPEM){return this.scheduler.send({type:"generateCommentImportKey",args:[serverPublicKeyPEM]})};SchedulerCryptoAdapter.prototype.encryptCommentImportFile=function encryptCommentImportFile(key,fileBase64){return this.scheduler.send({type:"encryptCommentImportFile",args:[key,fileBase64]})};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.decryptBytes=function decryptBytes(comment$,envelope$,privateKeyPEMs,before,after){return this.scheduler.send({type:"decryptBytes",args:[comment$,envelope$,privateKeyPEMs,before,after]})};SchedulerCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEMs){return this.scheduler.send({type:"decryptComment",args:[comment$,envelope,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptData=function decryptData(version,data$,envelope$,privateKeyPEMs){return this.scheduler.send({type:"decryptData",args:[version,data$,envelope$,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(data$,privateKeyPEMs){return this.scheduler.send({type:"decryptFileBlock",args:[data$,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEMs){return this.scheduler.send({type:"decryptImage",args:[data$,privateKeyPEMs]})};SchedulerCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return this.scheduler.send({type:"decryptPrivateKey",args:[privateKey$,password]})};SchedulerCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlock,decodeBlock){return this.scheduler.send({type:"encryptFileBlock",args:[keyIV,fileBlock,decodeBlock]})};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,privateKeyPEMs){return this.scheduler.send({type:"envelopeUnseal",args:[envelope,privateKeyPEMs]})};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]})};SchedulerCryptoAdapter.prototype.generateCommentImportKey=function generateCommentImportKey(serverPublicKeyPEM){return this.scheduler.send({type:"generateCommentImportKey",args:[serverPublicKeyPEM]})};SchedulerCryptoAdapter.prototype.encryptCommentImportFile=function encryptCommentImportFile(key,fileBase64){return this.scheduler.send({type:"encryptCommentImportFile",args:[key,fileBase64]})};SchedulerCryptoAdapter.prototype.encryptSessionToken=function encryptSessionToken(sessionToken,nonce){return this.scheduler.send({type:"encryptSessionToken",args:[sessionToken,nonce]})};SchedulerCryptoAdapter.prototype.decryptSessionToken=function decryptSessionToken(encryptedToken,privateKeyPEM){return this.scheduler.send({type:"decryptSessionToken",args:[encryptedToken,privateKeyPEM]})};SchedulerCryptoAdapter.prototype.decryptSessionData=function decryptSessionData(encryptedData,privateKeyPEM){return this.scheduler.send({type:"decryptSessionData",args:[encryptedData,privateKeyPEM]})};return SchedulerCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SchedulerCryptoAdapter;
|
|
@@ -101,5 +101,23 @@ declare class SyncCryptoAdapter extends ICryptoAdapter {
|
|
|
101
101
|
* @returns {Promise<EncryptedComment>} The encrypted comment and envelope
|
|
102
102
|
*/
|
|
103
103
|
encryptComment(comment: string, publicKeyPEMs: string[]): Promise<EncryptedComment>;
|
|
104
|
+
/**
|
|
105
|
+
* @param {string} sessionToken The session token to encrypt
|
|
106
|
+
* @param {Object} nonce The nonce object containing key and IV
|
|
107
|
+
* @returns {Promise<string>} The encrypted session token (base64 encoded)
|
|
108
|
+
*/
|
|
109
|
+
encryptSessionToken(sessionToken: string, nonce: any): Promise<string>;
|
|
110
|
+
/**
|
|
111
|
+
* @param {string} encryptedToken The encrypted session token (base64 encoded)
|
|
112
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
113
|
+
* @returns {Promise<string>} The decrypted session token
|
|
114
|
+
*/
|
|
115
|
+
decryptSessionToken(encryptedToken: string, privateKeyPEM: string): Promise<string>;
|
|
116
|
+
/**
|
|
117
|
+
* @param {Object} encryptedData The encrypted session data (hybrid payload object)
|
|
118
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
119
|
+
* @returns {Promise<string>} The decrypted session data
|
|
120
|
+
*/
|
|
121
|
+
decryptSessionData(encryptedData: any, privateKeyPEM: string): Promise<string>;
|
|
104
122
|
}
|
|
105
123
|
import ICryptoAdapter from "./ICryptoAdapter";
|
|
@@ -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.decryptBytes=function decryptBytes(comment$,envelope$,privateKeyPEMs,before,after){return crypto.decryptBytes(comment$,envelope$,privateKeyPEMs,before,after)};SyncCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEMs){return crypto.decryptComment(comment$,envelope,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptData=function decryptData(version,data$,envelope$,privateKeyPEMs){return crypto.decryptData(version,data$,envelope$,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(data$,privateKeyPEMs){return crypto.decryptFileBlock(data$,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEMs){return crypto.decryptImage(data$,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return crypto.decryptPrivateKey(privateKey$,password)};SyncCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlock,decodeBlock){return crypto.encryptFileBlock(keyIV,fileBlock,decodeBlock)};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,privateKeyPEMs){return crypto.envelopeUnseal(envelope,privateKeyPEMs)};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;
|
|
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.decryptBytes=function decryptBytes(comment$,envelope$,privateKeyPEMs,before,after){return crypto.decryptBytes(comment$,envelope$,privateKeyPEMs,before,after)};SyncCryptoAdapter.prototype.decryptComment=function decryptComment(comment$,envelope,privateKeyPEMs){return crypto.decryptComment(comment$,envelope,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptData=function decryptData(version,data$,envelope$,privateKeyPEMs){return crypto.decryptData(version,data$,envelope$,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptFileBlock=function decryptFileBlock(data$,privateKeyPEMs){return crypto.decryptFileBlock(data$,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptImage=function decryptImage(data$,privateKeyPEMs){return crypto.decryptImage(data$,privateKeyPEMs)};SyncCryptoAdapter.prototype.decryptPrivateKey=function decryptPrivateKey(privateKey$,password){return crypto.decryptPrivateKey(privateKey$,password)};SyncCryptoAdapter.prototype.encryptFileBlock=function encryptFileBlock(keyIV,fileBlock,decodeBlock){return crypto.encryptFileBlock(keyIV,fileBlock,decodeBlock)};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,privateKeyPEMs){return crypto.envelopeUnseal(envelope,privateKeyPEMs)};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)};SyncCryptoAdapter.prototype.encryptSessionToken=function encryptSessionToken(sessionToken,nonce){return Promise.resolve(crypto.encryptSessionToken(sessionToken,nonce))};SyncCryptoAdapter.prototype.decryptSessionToken=function decryptSessionToken(encryptedToken,privateKeyPEM){return Promise.resolve(crypto.decryptSessionToken(encryptedToken,privateKeyPEM))};SyncCryptoAdapter.prototype.decryptSessionData=function decryptSessionData(encryptedData,privateKeyPEM){return Promise.resolve(crypto.decryptSessionData(encryptedData,privateKeyPEM))};return SyncCryptoAdapter}(_ICryptoAdapter3.default);exports.default=SyncCryptoAdapter;
|
package/lib/api/AccountsSSO.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ export default AccountsSSO;
|
|
|
5
5
|
* SSO is a PageProof for Enterprise offering, but is not yet included for SDK licenses. Logging in
|
|
6
6
|
* via SSO creates sessions that can only be used in the PageProof web-app. If you need SSO, please
|
|
7
7
|
* contact us and we will assist you where we can.
|
|
8
|
+
*
|
|
9
|
+
* For device authentication flows using isolated login:
|
|
10
|
+
* - Set the ISOLATED_AUTH_PRIVATE_KEY environment variable to your RSA private certificate (PEM format, base64 encoded) - Provided by PageProof
|
|
11
|
+
* - The sessionToken from getIsolatedLoginStatus() will be automatically decrypted
|
|
12
|
+
* - The session data from getIsolatedLoginSession() will be automatically decrypted
|
|
13
|
+
* - Uses CryptoAlgorithm.RSA_OAEP for simple RSA or CryptoAlgorithm.RSA_AES_GCM for hybrid encryption
|
|
8
14
|
*/
|
|
9
15
|
declare class AccountsSSO extends API {
|
|
10
16
|
constructor(client: any);
|
|
@@ -22,7 +28,37 @@ declare class AccountsSSO extends API {
|
|
|
22
28
|
* @private
|
|
23
29
|
* @returns {Promise}
|
|
24
30
|
*/
|
|
25
|
-
initiateLogin(email: any): Promise<any>;
|
|
31
|
+
initiateLogin(email: any, sessionId: any, source: any): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Polls the status of a login using the device flow where authentication is completed via an isolated browser session.
|
|
34
|
+
* If the authentication has been completed, a session token is returned which can be used to retrieve the session data.
|
|
35
|
+
* The session token is only returned once, further polling will not return a session token.
|
|
36
|
+
* The session token is decrypted using the private key, then encrypted using the nonce provided by the server.
|
|
37
|
+
*
|
|
38
|
+
* This method requires a base64 encoded private key to be set in the `ISOLATED_AUTH_PRIVATE_KEY` environment variable.
|
|
39
|
+
* The key is provided by PageProof and is pre-registered against your source id.
|
|
40
|
+
*
|
|
41
|
+
* @private
|
|
42
|
+
* @param {string} email
|
|
43
|
+
* @param {string} sessionId - The session id of the login as a UUID
|
|
44
|
+
* @param {string} source - The source id of your application
|
|
45
|
+
* @returns {Promise<IsolatedLoginStatusResult>}
|
|
46
|
+
*/
|
|
47
|
+
getIsolatedLoginStatus(email: string, sessionId: string, applicationId: any): Promise<IsolatedLoginStatusResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves the session data for an isolated login.
|
|
50
|
+
* A session token is required to retrieve the session data. This is obtained from the {@link AccountsSSO#getIsolatedLoginStatus} method.
|
|
51
|
+
*
|
|
52
|
+
* This method requires a base64 encoded private key to be set in the `ISOLATED_AUTH_PRIVATE_KEY` environment variable.
|
|
53
|
+
* The key is provided by PageProof and is pre-registered against your source id.
|
|
54
|
+
*
|
|
55
|
+
* @private
|
|
56
|
+
* @param {string} sessionId - The session id of the login as a UUID
|
|
57
|
+
* @param {string} source - The source id of your application
|
|
58
|
+
* @param {string} encryptedSessionToken - The nonce-encrypted session token, obtained from the {@link AccountsSSO#getIsolatedLoginStatus} method
|
|
59
|
+
* @returns {Promise<Session>}
|
|
60
|
+
*/
|
|
61
|
+
getIsolatedLoginSession(sessionId: string, applicationId: any, encryptedSessionToken: string): Promise<Session>;
|
|
26
62
|
}
|
|
27
63
|
import API from "./API";
|
|
28
64
|
import Session from "../models/Session";
|
package/lib/api/AccountsSSO.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);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 AccountsSSO=function(_API){_inherits(AccountsSSO,_API);function AccountsSSO(){_classCallCheck(this,AccountsSSO);return _possibleConstructorReturn(this,_API.apply(this,arguments))}AccountsSSO.prototype.getSession=function getSession(){var _this2=this;return this.client.request("sso.get-public-key").then(function(response){return response.data.ServerPublicKey}).then(function(serverPublicKey){return _this2.client.crypto().generateWrappedSymmetricKey(serverPublicKey)}).then(function(_ref){var key=_ref.key,key$=_ref.key$;return Promise.all([key,_this2.client.request("sso.get-session",{nonce:key$})])}).then(function(_ref2){var key=_ref2[0],response=_ref2[1];var session=(new _Session2.default).fromSession(response.data);return Promise.all([session,_this2.client.crypto().decryptManagedPrivateKey(session.privateKeyPEM$,key)])}).then(function(_ref3){var session=_ref3[0],privateKeyPEM=_ref3[1];session.privateKeyPEM=privateKeyPEM;return session})};AccountsSSO.prototype.getLoginOptions=function getLoginOptions(email){return this.client.request("sso.get-login-options",{email:email}).then(function(response){return response.data})};AccountsSSO.prototype.initiateLogin=function initiateLogin(email){return this.client.request("sso.initiate-login",{email:email}).then(function(response){return response.data})};return AccountsSSO}(_API3.default);exports.default=AccountsSSO;
|
|
1
|
+
"use strict";exports.__esModule=true;var _nodeForge=require("node-forge");var forge=_interopRequireWildcard(_nodeForge);var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _isolatedAuthCert=require("../util/isolatedAuthCert");var _isolatedAuthCert2=_interopRequireDefault(_isolatedAuthCert);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}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 _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 AccountsSSO=function(_API){_inherits(AccountsSSO,_API);function AccountsSSO(){_classCallCheck(this,AccountsSSO);return _possibleConstructorReturn(this,_API.apply(this,arguments))}AccountsSSO.prototype.getSession=function getSession(){var _this2=this;return this.client.request("sso.get-public-key").then(function(response){return response.data.ServerPublicKey}).then(function(serverPublicKey){return _this2.client.crypto().generateWrappedSymmetricKey(serverPublicKey)}).then(function(_ref){var key=_ref.key,key$=_ref.key$;return Promise.all([key,_this2.client.request("sso.get-session",{nonce:key$})])}).then(function(_ref2){var key=_ref2[0],response=_ref2[1];var session=(new _Session2.default).fromSession(response.data);return Promise.all([session,_this2.client.crypto().decryptManagedPrivateKey(session.privateKeyPEM$,key)])}).then(function(_ref3){var session=_ref3[0],privateKeyPEM=_ref3[1];session.privateKeyPEM=privateKeyPEM;return session})};AccountsSSO.prototype.getLoginOptions=function getLoginOptions(email){return this.client.request("sso.get-login-options",{email:email}).then(function(response){return response.data})};AccountsSSO.prototype.initiateLogin=function initiateLogin(email,sessionId,source){return this.client.request("sso.initiate-login",{email:email,sessionId:sessionId,source:source}).then(function(response){return response.data})};AccountsSSO.prototype.getIsolatedLoginStatus=function getIsolatedLoginStatus(email,sessionId,applicationId){var _this3=this;if(!_isolatedAuthCert2.default){throw new Error("ISOLATED_AUTH_PRIVATE_KEY is not set")}if(!email||!sessionId||!applicationId){throw new Error("Missing required parameters")}return this.client.request("sso.get-isolated-login-status",{email:email,sessionId:sessionId,applicationId:applicationId}).catch(function(err){throw new Error("Error getting isolated login status: "+err.message)}).then(function(response){var data=response.data;if(data.encryptedSessionToken){var nonce=void 0;try{nonce=JSON.parse(forge.util.decode64(data.nonce))}catch(err){throw new Error("Error decoding / parsing nonce: "+err.message)}return _this3.client.crypto().decryptSessionToken(data.encryptedSessionToken,_isolatedAuthCert2.default).catch(function(err){throw new Error("Error decrypting session token: "+err.message)}).then(function(decryptedSessionToken){var encryptedSessionToken=void 0;try{encryptedSessionToken=_this3.client.crypto().encryptSessionToken(decryptedSessionToken,nonce)}catch(err){throw new Error("Error re-encrypting session token: "+err.message)}return encryptedSessionToken}).then(function(encryptedSessionToken){return{success:true,status:data.status,sessionToken:encryptedSessionToken}})}return data})};AccountsSSO.prototype.getIsolatedLoginSession=function getIsolatedLoginSession(sessionId,applicationId,encryptedSessionToken){var _this4=this;if(!_isolatedAuthCert2.default){throw new Error("ISOLATED_AUTH_PRIVATE_KEY is not set")}if(!sessionId||!applicationId||!encryptedSessionToken){throw new Error("Missing required parameters")}return this.client.request("sso.get-public-key").catch(function(err){throw new Error("Error getting public key: "+err.message)}).then(function(response){return _this4.client.crypto().generateWrappedSymmetricKey(response.data.ServerPublicKey)}).catch(function(err){throw new Error("Error generating wrapped symmetric key: "+err.message)}).then(function(_ref4){var key=_ref4.key,key$=_ref4.key$;return Promise.all([key,_this4.client.request("sso.get-isolated-login-session",{sessionId:sessionId,applicationId:applicationId,encryptedSessionToken:encryptedSessionToken,nonce:key$})])}).catch(function(err){throw new Error("Error getting isolated login session: "+err.message)}).then(function(_ref5){var key=_ref5[0],response=_ref5[1];return Promise.all([key,_this4.client.crypto().decryptSessionData(response.data.encryptedSession,_isolatedAuthCert2.default)])}).catch(function(err){throw new Error("Error decrypting session data: "+err.message)}).then(function(_ref6){var key=_ref6[0],decryptedSession=_ref6[1];var session=void 0;try{session=(new _Session2.default).fromSession(JSON.parse(decryptedSession))}catch(err){throw new Error("Error parsing session data: "+err.message)}return Promise.all([session,_this4.client.crypto().decryptManagedPrivateKey(session.privateKeyPEM$,key).catch(function(err){throw new Error("Error decrypting managed private key: "+err.message)})])}).then(function(_ref7){var session=_ref7[0],privateKeyPEM=_ref7[1];session.privateKeyPEM=privateKeyPEM;return session})};return AccountsSSO}(_API3.default);exports.default=AccountsSSO;
|
package/lib/api/Proofs.d.ts
CHANGED
|
@@ -203,9 +203,10 @@ declare class Proofs extends API {
|
|
|
203
203
|
* @param [options.start] Whether to immediately start the proof (sends invitation emails to reviewers in the workflow)
|
|
204
204
|
* @param [options.commentVisibility] Controls the visibility of comments on the proof
|
|
205
205
|
* @param [options.priority] The priority of the proof from 1 to 5. 5 is the highest priority and 1 is the lowest.
|
|
206
|
+
* @param [options.isDigitalVerificationEnabled] Whether the proof has digital verification enabled.
|
|
206
207
|
* @returns {Promise<Proof>}
|
|
207
208
|
*/
|
|
208
|
-
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, proofTemplate, checklist, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, canDownload, isPublic, start, commentVisibility, priority, }: {
|
|
209
|
+
create({ name, tags, dueDate, messageToReviewers, workflow, workflowTemplate, proofTemplate, checklist, file, group, previousProof, team, reference, customTools, integrationReferences, reminders, owners, canDownload, isPublic, start, commentVisibility, priority, isDigitalVerificationEnabled, }: {
|
|
209
210
|
name: string;
|
|
210
211
|
tags?: string[];
|
|
211
212
|
dueDate?: string | Date;
|
package/lib/api/Proofs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _ProofsDecisions=require("./ProofsDecisions");var _ProofsDecisions2=_interopRequireDefault(_ProofsDecisions);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _constants=require("../util/constants");var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);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 VIDEO_URL_TOKEN_SEPARATOR="|";function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);_this.decisions=new _ProofsDecisions2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,proofTemplate=_ref.proofTemplate,checklist=_ref.checklist,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,isPublic=_ref.isPublic,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start,_ref$commentVisibilit=_ref.commentVisibility,commentVisibility=_ref$commentVisibilit===undefined?null:_ref$commentVisibilit,priority=_ref.priority;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString?dueDate.toISOString():String(dueDate),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,proofTemplateId:proofTemplate&&proofTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,isPublic:isPublic,start:start,commentVisibility:commentVisibility,priority:priority}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofIdOrIds){return this.client.request("proofs.return",{proofIds:[].concat(proofIdOrIds)}).then(function(response){return{proofIds:response.data.ProofIds,errors:response.data.Errors.map(function(error){return{proofId:error.ProofId,errorCode:error.ErrorCode,errorMessage:error.ErrorMessage}})}})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.videoCredentials=function videoCredentials(proofId){var _this5=this;return this.client.cache.auto(_constants.VIDEO_CREDENTIALS_CACHE_PREFIX+proofId,function(){return _this5._videoCredentials(proofId)})};Proofs.prototype._videoCredentials=function _videoCredentials(proofId){var _this6=this;var bluffer=new _bluffer2.default;return this.client.request("proofs.video-credentials",{proofId:proofId}).then(function(response){return Promise.all([response.data.envelope.envelope,_this6.client.rawRequest({method:"GET",url:new _whatwgURL2.default(response.data.videoCredentials.url)}).then(function(videoCredentialsResponse){return videoCredentialsResponse.body})])}).then(function(_ref2){var envelope=_ref2[0],videoCredentials$=_ref2[1];return _this6.client.crypto().decryptImage(envelope+"-"+videoCredentials$,_this6.client.keyPairs.getPrivateKeyPEMs())}).then(function(videoCredentialsBase64){return bluffer.createBase64(videoCredentialsBase64).then(function(buffer){return bluffer.read(buffer)})}).then(function(videoCredentials){try{return JSON.parse(videoCredentials)}catch(err){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),unsafeBaseStreamingUrl=_videoCredentials$spl[0],accessToken=_videoCredentials$spl[1];return{streamingUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest(format=m3u8-aapl,encryption=cbc)",accessToken:accessToken,manifestUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest",bearerToken:accessToken}}})};Proofs.prototype._getProofSetup=function _getProofSetup(integrationKey,id){return this.client.request("integrations.get-proof-setup",{integration_key:integrationKey,id:id}).then(function(response){return{payload:response.data.payload}})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofIdOrIds,messageToReviewers){return this.client.request("proofs.set-message-to-reviewers",{proofIds:[].concat(proofIdOrIds),messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,checklist=_concat$.checklist,group=_concat$.group,proofTemplate=_concat$.proofTemplate,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start,commentVisibility=_concat$.commentVisibility,priority=_concat$.priority;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,proofTemplateId:proofTemplate&&proofTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,isPublic:isPublic,start:start,commentVisibility:commentVisibility,priority:priority}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.addWorkflow=function addWorkflow(proofIdOrIds,workflowTemplateId){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(proofIdOrIds),workflowTemplateId:workflowTemplateId})};Proofs.prototype.sendShareLink=function sendShareLink(_ref4){var proofId=_ref4.proofId,message=_ref4.message,emailAddresses=_ref4.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:proofId,message:message,emailAddresses:emailAddresses})};Proofs.prototype.getWorkflowMetrics=function getWorkflowMetrics(proofId){return this.client.request("proofs.get-workflow-metrics",{proofId:proofId}).then(function(response){if(response.data){return response.data.workflowMetrics}return null})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
1
|
+
"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _ProofsOwners=require("./ProofsOwners");var _ProofsOwners2=_interopRequireDefault(_ProofsOwners);var _ProofsEditors=require("./ProofsEditors");var _ProofsEditors2=_interopRequireDefault(_ProofsEditors);var _ProofsReviewers=require("./ProofsReviewers");var _ProofsReviewers2=_interopRequireDefault(_ProofsReviewers);var _ProofsVersions=require("./ProofsVersions");var _ProofsVersions2=_interopRequireDefault(_ProofsVersions);var _ProofsGroups=require("./ProofsGroups");var _ProofsGroups2=_interopRequireDefault(_ProofsGroups);var _ProofsAudit=require("./ProofsAudit");var _ProofsAudit2=_interopRequireDefault(_ProofsAudit);var _ProofsAssets=require("./ProofsAssets");var _ProofsAssets2=_interopRequireDefault(_ProofsAssets);var _ProofsCustomTools=require("./ProofsCustomTools");var _ProofsCustomTools2=_interopRequireDefault(_ProofsCustomTools);var _ProofsIntegrationReferences=require("./ProofsIntegrationReferences");var _ProofsIntegrationReferences2=_interopRequireDefault(_ProofsIntegrationReferences);var _ProofsLinkCheck=require("./ProofsLinkCheck");var _ProofsLinkCheck2=_interopRequireDefault(_ProofsLinkCheck);var _ProofsDecisions=require("./ProofsDecisions");var _ProofsDecisions2=_interopRequireDefault(_ProofsDecisions);var _Proof=require("../models/Proof");var _Proof2=_interopRequireDefault(_Proof);var _Reminders=require("./Reminders");var _Reminders2=_interopRequireDefault(_Reminders);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);var _constants=require("../util/constants");var _bluffer=require("../bluffer");var _bluffer2=_interopRequireDefault(_bluffer);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 VIDEO_URL_TOKEN_SEPARATOR="|";function transformProofsForUpdate(proofs){var proofsArrForUpdate=[].concat(proofs);proofsArrForUpdate.forEach(function(proof){proof.proofId=proof.id;delete proof.id});return proofsArrForUpdate}var Proofs=function(_API){_inherits(Proofs,_API);function Proofs(client){_classCallCheck(this,Proofs);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.owners=new _ProofsOwners2.default(client);_this.editors=new _ProofsEditors2.default(client);_this.reviewers=new _ProofsReviewers2.default(client);_this.versions=new _ProofsVersions2.default(client);_this.groups=new _ProofsGroups2.default(client);_this.reminders=new _Reminders2.default(client);_this.audit=new _ProofsAudit2.default(client);_this.assets=new _ProofsAssets2.default(client);_this.customTools=new _ProofsCustomTools2.default(client);_this.integrationReferences=new _ProofsIntegrationReferences2.default(client);_this.linkCheck=new _ProofsLinkCheck2.default(client);_this.decisions=new _ProofsDecisions2.default(client);return _this}Proofs.prototype.setWorkflow=function setWorkflow(proofId,workflowId){var _this2=this;return this.client.request("proofs.normalize-workflow",{proofId:proofId,workflowId:workflowId}).then(function(){return _this2.client.request("proofs.set-workflow",{proofId:proofId,workflowId:workflowId})})};Proofs.prototype.setTags=function setTags(proofId,tags){return this.client.request("proofs.set-tags",{relatedId:proofId,tag:tags.join(",")})};Proofs.prototype.deleteTag=function deleteTag(proofId,tag){return this.client.request("proofs.tag-delete",{relatedId:proofId,tag:tag})};Proofs.prototype.setFile=function setFile(proofId,fileId){var _this3=this;return this.client.request("proofs.set-file",{proofId:proofId,fileId:fileId}).then(function(){return _this3.client.request("proofs.distribute-file",{proofId:proofId})})};Proofs.prototype.create=function create(_ref){var _this4=this;var name=_ref.name,_ref$tags=_ref.tags,tags=_ref$tags===undefined?[]:_ref$tags,_ref$dueDate=_ref.dueDate,dueDate=_ref$dueDate===undefined?new Date(Date.now()+3*_constants.DAY_IN_MS):_ref$dueDate,messageToReviewers=_ref.messageToReviewers,workflow=_ref.workflow,workflowTemplate=_ref.workflowTemplate,proofTemplate=_ref.proofTemplate,checklist=_ref.checklist,file=_ref.file,group=_ref.group,previousProof=_ref.previousProof,team=_ref.team,reference=_ref.reference,customTools=_ref.customTools,integrationReferences=_ref.integrationReferences,_ref$reminders=_ref.reminders,reminders=_ref$reminders===undefined?[]:_ref$reminders,owners=_ref.owners,canDownload=_ref.canDownload,isPublic=_ref.isPublic,_ref$start=_ref.start,start=_ref$start===undefined?true:_ref$start,_ref$commentVisibilit=_ref.commentVisibility,commentVisibility=_ref$commentVisibilit===undefined?null:_ref$commentVisibilit,priority=_ref.priority,isDigitalVerificationEnabled=_ref.isDigitalVerificationEnabled;return this.client.request("proofs.create",{proof:{name:name,tags:tags,dueDate:dueDate.toISOString?dueDate.toISOString():String(dueDate),messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,workflowTemplateId:workflowTemplate&&workflowTemplate.id||undefined,proofTemplateId:proofTemplate&&proofTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,previousProofId:previousProof&&previousProof.id||undefined,teamSlug:team&&team.slug||undefined,reference:reference,integrationReferences:integrationReferences,reminders:[].concat(reminders),owners:owners,canDownload:canDownload,isPublic:isPublic,start:start,commentVisibility:commentVisibility,priority:priority,isDigitalVerificationEnabled:isDigitalVerificationEnabled}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();if(customTools&&!previousProof){return _this4.customTools.update(proof.id,customTools).then(function(){return proof})}return proof})};Proofs.prototype.archive=function archive(proofIdOrIds){return this.client.request("proofs.archive",{proofIds:proofIdOrIds})};Proofs.prototype.unarchive=function unarchive(proofId){return this.client.request("proofs.unarchive",{proofId:proofId})};Proofs.prototype.delete=function _delete(proofId){return this.client.request("proofs.delete",{proofId:proofId})};Proofs.prototype.finish=function finish(proofId,decision){return this.client.request("proofs.finish",{proofId:proofId,decision:decision})};Proofs.prototype.approve=function approve(proofId,message){return this.client.request("proofs.manual-approval",{proofId:proofId,message:message})};Proofs.prototype.withdrawApproval=function withdrawApproval(proofId,messageToSender){return this.client.request("proofs.withdraw-approval",{proofId:proofId,messageToSender:messageToSender})};Proofs.prototype.generateEmail=function generateEmail(proofId){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return this.client.request("email.proofs.generate",_extends({proofId:proofId},options)).then(function(response){return response.data})};Proofs.prototype.return=function _return(proofIdOrIds){return this.client.request("proofs.return",{proofIds:[].concat(proofIdOrIds)}).then(function(response){return{proofIds:response.data.ProofIds,errors:response.data.Errors.map(function(error){return{proofId:error.ProofId,errorCode:error.ErrorCode,errorMessage:error.ErrorMessage}})}})};Proofs.prototype.start=function start(proofId){return this.client.request("proofs.start",{proofId:proofId})};Proofs.prototype.removeEditor=function removeEditor(id){return this.client.request("proofs.remove-editor",{proofId:id})};Proofs.prototype.load=function load(proofId){return this.client.request("proofs.load",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.lock=function lock(proofId){return this.client.request("proofs.lock",{proofId:proofId})};Proofs.prototype.unlock=function unlock(proofId){return this.client.request("proofs.unlock",{proofId:proofId})};Proofs.prototype.requestUnlock=function requestUnlock(proofId){return this.client.request("proofs.request-unlock",{proofId:proofId})};Proofs.prototype.requestAccess=function requestAccess(proofId){return this.client.request("proofs.request-access",{proofId:proofId})};Proofs.prototype.images=function images(proofId){return this.client.request("proofs.images",{proofId:proofId}).then(function(response){return response.data.proof.file})};Proofs.prototype.videoCredentials=function videoCredentials(proofId){var _this5=this;return this.client.cache.auto(_constants.VIDEO_CREDENTIALS_CACHE_PREFIX+proofId,function(){return _this5._videoCredentials(proofId)})};Proofs.prototype._videoCredentials=function _videoCredentials(proofId){var _this6=this;var bluffer=new _bluffer2.default;return this.client.request("proofs.video-credentials",{proofId:proofId}).then(function(response){return Promise.all([response.data.envelope.envelope,_this6.client.rawRequest({method:"GET",url:new _whatwgURL2.default(response.data.videoCredentials.url)}).then(function(videoCredentialsResponse){return videoCredentialsResponse.body})])}).then(function(_ref2){var envelope=_ref2[0],videoCredentials$=_ref2[1];return _this6.client.crypto().decryptImage(envelope+"-"+videoCredentials$,_this6.client.keyPairs.getPrivateKeyPEMs())}).then(function(videoCredentialsBase64){return bluffer.createBase64(videoCredentialsBase64).then(function(buffer){return bluffer.read(buffer)})}).then(function(videoCredentials){try{return JSON.parse(videoCredentials)}catch(err){var _videoCredentials$spl=videoCredentials.split(VIDEO_URL_TOKEN_SEPARATOR),unsafeBaseStreamingUrl=_videoCredentials$spl[0],accessToken=_videoCredentials$spl[1];return{streamingUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest(format=m3u8-aapl,encryption=cbc)",accessToken:accessToken,manifestUrl:unsafeBaseStreamingUrl.replace("http://","https://")+"/manifest",bearerToken:accessToken}}})};Proofs.prototype._getProofSetup=function _getProofSetup(integrationKey,id){return this.client.request("integrations.get-proof-setup",{integration_key:integrationKey,id:id}).then(function(response){return{payload:response.data.payload}})};Proofs.prototype.setMessageToReviewers=function setMessageToReviewers(proofIdOrIds,messageToReviewers){return this.client.request("proofs.set-message-to-reviewers",{proofIds:[].concat(proofIdOrIds),messageToReviewers:messageToReviewers})};Proofs.prototype.returnTodos=function returnTodos(proofIdOrIds,_ref3){var messageToOwners=_ref3.messageToOwners,_ref3$markCommentsAsT=_ref3.markCommentsAsTodo,markCommentsAsTodo=_ref3$markCommentsAsT===undefined?false:_ref3$markCommentsAsT;return this.client.request("proofs.return-todos",{proofIds:[].concat(proofIdOrIds),messageToOwners:messageToOwners,markCommentAsTodo:markCommentsAsTodo})};Proofs.prototype.updateDecision=function updateDecision(proofId,decision){return this.client.request("proofs.update-decision",{proofId:proofId,decision:decision})};Proofs.prototype.update=function update(proofOrProofs){if(proofOrProofs.length===1||typeof proofOrProofs.length==="undefined"){var _concat$=[].concat(proofOrProofs)[0],id=_concat$.id,name=_concat$.name,tags=_concat$.tags,dueDate=_concat$.dueDate,messageToReviewers=_concat$.messageToReviewers,workflow=_concat$.workflow,checklist=_concat$.checklist,group=_concat$.group,proofTemplate=_concat$.proofTemplate,file=_concat$.file,reference=_concat$.reference,integrationReferences=_concat$.integrationReferences,reminders=_concat$.reminders,owners=_concat$.owners,canDownload=_concat$.canDownload,isPublic=_concat$.isPublic,start=_concat$.start,commentVisibility=_concat$.commentVisibility,priority=_concat$.priority,isDigitalVerificationEnabled=_concat$.isDigitalVerificationEnabled;return this.client.request("proofs.update",{proof:{id:id,name:name,tags:tags,dueDate:dueDate?dueDate.toISOString():undefined,messageToReviewers:messageToReviewers,workflowId:workflow&&workflow.id||undefined,proofTemplateId:proofTemplate&&proofTemplate.id||undefined,checklist:checklist,fileId:file&&file.id||undefined,groupId:group&&group.id||undefined,reference:reference,integrationReferences:integrationReferences,reminders:reminders?[].concat(reminders):undefined,owners:owners,canDownload:canDownload,isPublic:isPublic,start:start,commentVisibility:commentVisibility,priority:priority,isDigitalVerificationEnabled:isDigitalVerificationEnabled}}).then(function(response){var proof=(new _Proof2.default).fromProof(response.data);proof.calculateState();return proof})}return this.client.request("proofs.bulk-update",{proofs:transformProofsForUpdate(proofOrProofs)})};Proofs.prototype.next=function next(proofId){return this.client.request("proofs.next",{proofId:proofId}).then(function(response){return(new _Proof2.default).fromProof(response.data)})};Proofs.prototype.addWorkflow=function addWorkflow(proofIdOrIds,workflowTemplateId){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(proofIdOrIds),workflowTemplateId:workflowTemplateId})};Proofs.prototype.sendShareLink=function sendShareLink(_ref4){var proofId=_ref4.proofId,message=_ref4.message,emailAddresses=_ref4.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:proofId,message:message,emailAddresses:emailAddresses})};Proofs.prototype.getWorkflowMetrics=function getWorkflowMetrics(proofId){return this.client.request("proofs.get-workflow-metrics",{proofId:proofId}).then(function(response){if(response.data){return response.data.workflowMetrics}return null})};return Proofs}(_API3.default);exports.default=Proofs;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private
|
|
3
|
+
* @param {string} sessionToken The session token to encrypt
|
|
4
|
+
* @param {Object} nonce The nonce object
|
|
5
|
+
* @returns {string} The encrypted session token
|
|
6
|
+
*/
|
|
7
|
+
export function encryptSessionToken(sessionToken: string, nonce: any): string;
|
|
8
|
+
/**
|
|
9
|
+
* @private
|
|
10
|
+
* @param {string} encryptedData Base64 encoded encrypted data
|
|
11
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
12
|
+
* @returns {string} The decrypted data
|
|
13
|
+
*/
|
|
14
|
+
export function decryptSessionToken(encryptedData: string, privateKeyPEM: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* @private
|
|
17
|
+
* @param {Object} encryptedData Hybrid payload object
|
|
18
|
+
* @param {string} privateKeyPEM The private key PEM string
|
|
19
|
+
* @returns {string} The decrypted data
|
|
20
|
+
*/
|
|
21
|
+
export function decryptSessionData(encryptedSessionData: any, privateKeyPEM: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.__esModule=true;exports.decryptSessionData=exports.decryptSessionToken=exports.encryptSessionToken=undefined;var _nodeForge=require("node-forge");var forge=_interopRequireWildcard(_nodeForge);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 decryptSessionToken(encryptedData,privateKeyPEM){if(!privateKeyPEM||!encryptedData){throw new Error("Missing required parameters")}var privateKey=forge.pki.privateKeyFromPem(privateKeyPEM);if(typeof encryptedData!=="string"){throw new Error("RSA-OAEP algorithm expects base64 string input")}try{var encrypted=forge.util.decode64(encryptedData);var decrypted=privateKey.decrypt(encrypted,"RSA-OAEP");if(!decrypted){throw new Error("Unable to decrypt data with RSA-OAEP")}return decrypted}catch(err){throw new Error("Failed to decrypt session token: "+err.message)}}function decryptSessionData(encryptedSessionData,privateKeyPEM){if(!privateKeyPEM||!encryptedSessionData){throw new Error("Missing required parameters")}if(!privateKeyPEM){throw new Error("Private key PEM is required")}var privateKey=forge.pki.privateKeyFromPem(privateKeyPEM);var encryptedData=encryptedSessionData.encryptedData,encryptedKey=encryptedSessionData.encryptedKey,iv=encryptedSessionData.iv,authTag=encryptedSessionData.authTag;if(!encryptedData||!encryptedKey||!iv||!authTag){throw new Error("Invalid hybrid encryption payload - requires encryptedData, encryptedKey, iv, authTag")}try{var encryptedAESKey=forge.util.decode64(encryptedKey);var aesKey=privateKey.decrypt(encryptedAESKey,"RSA-OAEP");if(!aesKey){throw new Error("Failed to decrypt AES key with RSA certificate")}var encryptedDataBuffer=forge.util.createBuffer(forge.util.decode64(encryptedData));var ivBuffer=forge.util.createBuffer(forge.util.decode64(iv));var authTagBuffer=forge.util.createBuffer(forge.util.decode64(authTag));var decipher=forge.cipher.createDecipher("AES-GCM",aesKey);decipher.start({iv:ivBuffer.getBytes(),tag:authTagBuffer.getBytes()});decipher.update(encryptedDataBuffer);var success=decipher.finish();if(!success){throw new Error("Hybrid RSA+AES-GCM decryption failed - invalid auth tag or corrupted data")}return decipher.output.toString("utf8")}catch(err){throw new Error("Failed to decrypt session data: "+err.message)}}function encryptSessionToken(sessionToken,nonce){if(!sessionToken||!nonce){throw new Error("Missing required parameters")}var keyBytes=forge.util.decode64(nonce.k);var ivBytes=forge.util.decode64(nonce.r);var cipher=forge.cipher.createCipher("AES-GCM",keyBytes);cipher.start({iv:ivBytes});cipher.update(forge.util.createBuffer(sessionToken));var success=cipher.finish();if(!success){throw new Error("Failed to encrypt session token.")}var cipherText=cipher.output.getBytes();var authTag=cipher.mode.tag.getBytes();var combined=cipherText+authTag;return forge.util.encode64(combined)}exports.encryptSessionToken=encryptSessionToken;exports.decryptSessionToken=decryptSessionToken;exports.decryptSessionData=decryptSessionData;
|
package/lib/crypto/index.d.ts
CHANGED
|
@@ -17,4 +17,7 @@ import encryptComment from "./encryptComment";
|
|
|
17
17
|
import decryptBytes from "./decryptBytes";
|
|
18
18
|
import generateCommentImportKey from "./generateCommentImportKey";
|
|
19
19
|
import encryptCommentImportFile from "./encryptCommentImportFile";
|
|
20
|
-
|
|
20
|
+
import { encryptSessionToken } from "./authServerEncryption";
|
|
21
|
+
import { decryptSessionToken } from "./authServerEncryption";
|
|
22
|
+
import { decryptSessionData } from "./authServerEncryption";
|
|
23
|
+
export { decryptComment, decryptData, decryptFileBlock, decryptImage, decryptPrivateKey, encryptFileBlock, encryptPrivateKey, envelopeSeal, envelopeUnseal, generateAuthorizationHeaders, generateKeyIV, generateKeyPair, generatePasswordHash, generateWrappedSymmetricKey, decryptManagedPrivateKey, encryptComment, decryptBytes, generateCommentImportKey, encryptCommentImportFile, encryptSessionToken, decryptSessionToken, decryptSessionData };
|
package/lib/crypto/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;exports.encryptCommentImportFile=exports.generateCommentImportKey=exports.decryptBytes=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.decryptData=exports.decryptComment=undefined;var _decryptComment=require("./decryptComment");var _decryptComment2=_interopRequireDefault(_decryptComment);var _decryptData=require("./decryptData");var _decryptData2=_interopRequireDefault(_decryptData);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);var _decryptBytes=require("./decryptBytes");var _decryptBytes2=_interopRequireDefault(_decryptBytes);var _generateCommentImportKey=require("./generateCommentImportKey");var _generateCommentImportKey2=_interopRequireDefault(_generateCommentImportKey);var _encryptCommentImportFile=require("./encryptCommentImportFile");var _encryptCommentImportFile2=_interopRequireDefault(_encryptCommentImportFile);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.decryptComment=_decryptComment2.default;exports.decryptData=_decryptData2.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;exports.decryptBytes=_decryptBytes2.default;exports.generateCommentImportKey=_generateCommentImportKey2.default;exports.encryptCommentImportFile=_encryptCommentImportFile2.default;
|
|
1
|
+
"use strict";exports.__esModule=true;exports.decryptSessionData=exports.decryptSessionToken=exports.encryptSessionToken=exports.encryptCommentImportFile=exports.generateCommentImportKey=exports.decryptBytes=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.decryptData=exports.decryptComment=undefined;var _decryptComment=require("./decryptComment");var _decryptComment2=_interopRequireDefault(_decryptComment);var _decryptData=require("./decryptData");var _decryptData2=_interopRequireDefault(_decryptData);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);var _decryptBytes=require("./decryptBytes");var _decryptBytes2=_interopRequireDefault(_decryptBytes);var _generateCommentImportKey=require("./generateCommentImportKey");var _generateCommentImportKey2=_interopRequireDefault(_generateCommentImportKey);var _encryptCommentImportFile=require("./encryptCommentImportFile");var _encryptCommentImportFile2=_interopRequireDefault(_encryptCommentImportFile);var _authServerEncryption=require("./authServerEncryption");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.decryptComment=_decryptComment2.default;exports.decryptData=_decryptData2.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;exports.decryptBytes=_decryptBytes2.default;exports.generateCommentImportKey=_generateCommentImportKey2.default;exports.encryptCommentImportFile=_encryptCommentImportFile2.default;exports.encryptSessionToken=_authServerEncryption.encryptSessionToken;exports.decryptSessionToken=_authServerEncryption.decryptSessionToken;exports.decryptSessionData=_authServerEncryption.decryptSessionData;
|
package/lib/models/Proof.d.ts
CHANGED
|
@@ -443,6 +443,12 @@ declare class Proof {
|
|
|
443
443
|
* @type {boolean}
|
|
444
444
|
*/
|
|
445
445
|
usePreviousVersionDueDate: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* Whether the proof has digital verification enabled.
|
|
448
|
+
*
|
|
449
|
+
* @type {boolean}
|
|
450
|
+
*/
|
|
451
|
+
isDigitalVerificationEnabled: boolean;
|
|
446
452
|
/**
|
|
447
453
|
* Whether a user is a team admin of this proof.
|
|
448
454
|
*
|
package/lib/models/Proof.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);var _ProofIntegrationReference=require("./ProofIntegrationReference");var _ProofIntegrationReference2=_interopRequireDefault(_ProofIntegrationReference);var _ProofChecklist=require("./ProofChecklist");var _ProofChecklist2=_interopRequireDefault(_ProofChecklist);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 isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",proofTemplateId:"ProofTemplateId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",canHaveGeneralComments:"FeatureGeneralComments",canHavePrivateComments:"FeaturePrivateComments",canAddChecklist:"FeatureCanAddChecklist",hasDecisionsEnabled:"FeatureDecisions",hasColorSeparations:"HasColorSeparations",reference:"Reference",integrationReferences:(0,_transform.each)("IntegrationReferences",function(data){return(new _ProofIntegrationReference2.default).fromProofIntegrationReference(data)}),checklist:function checklist(data){return data.Checklist&&(new _ProofChecklist2.default).fromProofChecklist(data.Checklist)},isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",availableWorkflowRoles:"FeatureAvailableWorkflowRoles",usePreviousVersionDueDate:"FeatureUsePreviousVersionDueDate",canSendShareLink:"FeatureSendShareLink",publicProofKeyPair:function publicProofKeyPair(data){return data.PublicProofKeyPair&&{publicKeyPEM:data.PublicProofKeyPair.PublicKey,privateKeyPEM:data.PublicProofKeyPair.PrivateKey}},canSendMessageToOwners:"FeatureMessageToOwners",workflowMetrics:"WorkflowMetrics",commentVisibility:"CommentVisibility",canHaveCommentVisibility:"FeatureCommentVisibility",importUrl:"ImportURL",priority:"Priority"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.isUserAdminOfProofTeam=function isUserAdminOfProofTeam(user){return user.isAdmin&&this.teamId===user.teamId};Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
|
|
1
|
+
"use strict";exports.__esModule=true;var _transform=require("./transform");var _transform2=_interopRequireDefault(_transform);var _ProofState=require("../enum/ProofState");var _ProofState2=_interopRequireDefault(_ProofState);var _ProofStatus=require("../enum/ProofStatus");var _ProofStatus2=_interopRequireDefault(_ProofStatus);var _ProofType=require("../enum/ProofType");var _ProofType2=_interopRequireDefault(_ProofType);var _FileStatus=require("../enum/FileStatus");var _FileStatus2=_interopRequireDefault(_FileStatus);var _id=require("../util/id");var _getPercentage=require("../util/getPercentage");var _getPercentage2=_interopRequireDefault(_getPercentage);var _User=require("./User");var _User2=_interopRequireDefault(_User);var _DecisionSummary=require("./DecisionSummary");var _DecisionSummary2=_interopRequireDefault(_DecisionSummary);var _ProofIntegrationReference=require("./ProofIntegrationReference");var _ProofIntegrationReference2=_interopRequireDefault(_ProofIntegrationReference);var _ProofChecklist=require("./ProofChecklist");var _ProofChecklist2=_interopRequireDefault(_ProofChecklist);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 isOverdue(){return this.dueDate&&this.dueDate.getTime()<Date.now()}var proofSchema={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",proofTemplateId:"ProofTemplateId",version:"Version",dueDate:(0,_transform.date)("DueDate"),createdDate:(0,_transform.date)("CreateDate"),approvedDate:(0,_transform.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:isOverdue,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,_transform.number)("Pages"),commentCount:(0,_transform.number)("ParentComments"),canDownload:(0,_transform.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,_transform.number)("CountTodoComments"),doneCommentCount:(0,_transform.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",canHaveGeneralComments:"FeatureGeneralComments",canHavePrivateComments:"FeaturePrivateComments",canAddChecklist:"FeatureCanAddChecklist",hasDecisionsEnabled:"FeatureDecisions",hasColorSeparations:"HasColorSeparations",reference:"Reference",integrationReferences:(0,_transform.each)("IntegrationReferences",function(data){return(new _ProofIntegrationReference2.default).fromProofIntegrationReference(data)}),checklist:function checklist(data){return data.Checklist&&(new _ProofChecklist2.default).fromProofChecklist(data.Checklist)},isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,_transform.each)("Owners",function(ownerData){return(new _User2.default).fromUser(ownerData)}),decisionSummary:(0,_transform.each)("Decisions",function(decisionsData){return(new _DecisionSummary2.default).fromDecisionSummary(decisionsData)}),tags:(0,_transform.each)("Tags",function(tag){return tag.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",availableWorkflowRoles:"FeatureAvailableWorkflowRoles",usePreviousVersionDueDate:"FeatureUsePreviousVersionDueDate",canSendShareLink:"FeatureSendShareLink",publicProofKeyPair:function publicProofKeyPair(data){return data.PublicProofKeyPair&&{publicKeyPEM:data.PublicProofKeyPair.PublicKey,privateKeyPEM:data.PublicProofKeyPair.PrivateKey}},canSendMessageToOwners:"FeatureMessageToOwners",workflowMetrics:"WorkflowMetrics",commentVisibility:"CommentVisibility",canHaveCommentVisibility:"FeatureCommentVisibility",importUrl:"ImportURL",priority:"Priority",isDigitalVerificationEnabled:"IsDigitalVerificationEnabled"};var Proof=function(){function Proof(){_classCallCheck(this,Proof)}Proof.prototype.isUserAdminOfProofTeam=function isUserAdminOfProofTeam(user){return user.isAdmin&&this.teamId===user.teamId};Proof.prototype.getState=function getState(){var state=_ProofState2.default.ACTIVE;if(this.fileStatus===_FileStatus2.default.UPLOADING){state=_ProofState2.default.UPLOADING}else if(this.hasFileError()){state=_ProofState2.default.FILE_ERROR}else if(this.isProcessing()){state=_ProofState2.default.PROCESSING}else if(this.type===_ProofType2.default.BRIEF){switch(this.status){case _ProofStatus2.default.NEW:state=_ProofState2.default.SETUP_NEEDED;break;case _ProofStatus2.default.PROOFING:state=_ProofState2.default.BRIEFING;break;case _ProofStatus2.default.AWAITING_NEW_VERSION:state=_ProofState2.default.AWAITING_PROOF;break;case _ProofStatus2.default.HAS_NEW_VERSION:state=_ProofState2.default.HAS_NEW_VERSION;break;case _ProofStatus2.default.ARCHIVED:state=_ProofState2.default.ARCHIVED;break}}else if(this.status===_ProofStatus2.default.ARCHIVED){state=_ProofState2.default.ARCHIVED}else if(this.status===_ProofStatus2.default.TODOS_REQUESTED){state=_ProofState2.default.TODOS_REQUESTED}else if(this.status===_ProofStatus2.default.AWAITING_NEW_VERSION){state=_ProofState2.default.AWAITING_NEW_VERSION}else if(this.status===_ProofStatus2.default.HAS_NEW_VERSION){state=_ProofState2.default.HAS_NEW_VERSION}else if(this.status===_ProofStatus2.default.APPROVED){state=_ProofState2.default.APPROVED}else if(!this.hasWorkflow()){state=_ProofState2.default.PROOFERS_NEEDED}else if(!this.hasWorkflowStarted()){state=_ProofState2.default.NOT_STARTED}else if(this.isOverdue){state=_ProofState2.default.OVERDUE}return state};Proof.prototype.getVideoProcessingProgress=function getVideoProcessingProgress(){var percent=0;var message=String(this.fileMessage);if(message){var thumbMatch=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);var videoMatch=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(message);if(message.startsWith("Video-Scheduled-")){percent=0}else if(videoMatch){percent=(0,_getPercentage2.default)(parseFloat(videoMatch[1])/100,0,.2)}else if(thumbMatch){percent=(0,_getPercentage2.default)(parseFloat(thumbMatch[1])/100,.8,0)}}return percent};Proof.prototype.hasWorkflowStarted=function hasWorkflowStarted(){return this.hasWorkflow()&&this.status!==_ProofStatus2.default.NEW};Proof.prototype.isProcessing=function isProcessing(){return this.fileStatus===_FileStatus2.default.UPLOADING||this.fileStatus===_FileStatus2.default.QUEUED||this.fileStatus===_FileStatus2.default.RIPPING};Proof.prototype.isAwaitingFile=function isAwaitingFile(){return this.source&&this.fileStatus===_FileStatus2.default.CREATED};Proof.prototype.getProcessingProgress=function getProcessingProgress(){switch(this.fileStatus){case _FileStatus2.default.UPLOADING:return.1;case _FileStatus2.default.QUEUED:return.2;case _FileStatus2.default.RIPPING:if(this.fileCategory==="video"){return(0,_getPercentage2.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2)}return.6;default:return-1}};Proof.prototype.hasWorkflow=function hasWorkflow(){return(0,_id.isWorkflowId)(this.workflowId)};Proof.prototype.hasFile=function hasFile(){return(0,_id.isFileId)(this.fileId)};Proof.prototype.hasFileError=function hasFileError(){return this.fileStatus===_FileStatus2.default.ERROR||!this.fileStatus||!this.hasFile()};Proof.prototype.hasEditor=function hasEditor(){return(0,_id.isUserId)(this.editorUserId)};Proof.prototype.hasThumbnail=function hasThumbnail(){return this.fileStatus===_FileStatus2.default.OK};Proof.prototype.canUserUploadNewVersion=function canUserUploadNewVersion(userId){return this.getState()===_ProofState2.default.AWAITING_NEW_VERSION&&(this.isEditor(userId)||this.isOwner(userId))||this.getState()===_ProofState2.default.AWAITING_PROOF&&(this.isEditor(userId)||this.isRecipient(userId))};Proof.prototype.isOwner=function isOwner(userId){return this.ownerUserIds.indexOf(userId)!==-1};Proof.prototype.isEditor=function isEditor(userId){return this.editorUserIds.indexOf(userId)!==-1};Proof.prototype.isRecipient=function isRecipient(userId){return this.recipient===userId};Proof.prototype.calculateState=function calculateState(){this.state=this.getState()};Proof.prototype.fromProof=function fromProof(proofData){(0,_transform2.default)(this,proofSchema,proofData);this.calculateState();return this};return Proof}();exports.default=Proof;
|
|
@@ -1004,7 +1004,21 @@
|
|
|
1004
1004
|
"version": 2,
|
|
1005
1005
|
"method": "POST",
|
|
1006
1006
|
"path": "/sso/initiate_login",
|
|
1007
|
-
"body": ["email"],
|
|
1007
|
+
"body": ["email", "sessionId", "source"],
|
|
1008
|
+
"anonymous": true
|
|
1009
|
+
},
|
|
1010
|
+
"sso.get-isolated-login-status": {
|
|
1011
|
+
"version": 2,
|
|
1012
|
+
"method": "POST",
|
|
1013
|
+
"path": "/sso/isolated/status",
|
|
1014
|
+
"body": ["email", "sessionId", "applicationId"],
|
|
1015
|
+
"anonymous": true
|
|
1016
|
+
},
|
|
1017
|
+
"sso.get-isolated-login-session": {
|
|
1018
|
+
"version": 2,
|
|
1019
|
+
"method": "POST",
|
|
1020
|
+
"path": "/sso/isolated/session",
|
|
1021
|
+
"body": ["sessionId", "applicationId", "encryptedSessionToken", "nonce"],
|
|
1008
1022
|
"anonymous": true
|
|
1009
1023
|
},
|
|
1010
1024
|
"mfa.setup": {
|