@pageproof/sdk-pr 567.0.1731458118024 → 568.0.1790034838311
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/lib/adapters/AngularEnhancementAdapter.d.ts +6 -20
- package/lib/adapters/ICryptoAdapter.d.ts +21 -0
- package/lib/adapters/ICryptoAdapter.js +1 -1
- package/lib/adapters/IEnhancementAdapter.d.ts +1 -1
- package/lib/adapters/IndexedDBCacheAdapter.d.ts +3 -13
- package/lib/adapters/NodeRequestAdapter.d.ts +2 -8
- package/lib/adapters/SchedulerCryptoAdapter.d.ts +0 -116
- package/lib/adapters/SchedulerCryptoAdapter.js +1 -1
- package/lib/adapters/SyncCryptoAdapter.d.ts +0 -101
- package/lib/adapters/SyncCryptoAdapter.js +1 -1
- package/lib/adapters/WorkerCryptoAdapter.d.ts +4 -4
- package/lib/adapters/WorkerThreadsCryptoAdapter.d.ts +3 -3
- package/lib/adapters/XHRRequestAdapter.d.ts +2 -6
- package/lib/adapters/XHRRequestAdapter.js +1 -1
- package/lib/angular-enhancement-adapter.js +1 -1
- package/lib/api/API.d.ts +2 -2
- package/lib/api/Accounts.d.ts +21 -4
- package/lib/api/Accounts.js +1 -1
- package/lib/api/AccountsMFA.d.ts +1 -1
- package/lib/api/AccountsSSO.d.ts +49 -5
- package/lib/api/AccountsSSO.js +1 -1
- package/lib/api/Briefs.d.ts +5 -4
- package/lib/api/Briefs.js +1 -1
- package/lib/api/ChecklistTemplates.d.ts +4 -4
- package/lib/api/ChecklistTemplatesEntities.d.ts +2 -2
- package/lib/api/Comments.d.ts +49 -17
- package/lib/api/Comments.js +1 -1
- package/lib/api/CommentsImport.d.ts +7 -10
- package/lib/api/Dashboard.d.ts +174 -21
- package/lib/api/Dashboard.js +1 -1
- package/lib/api/DashboardGroups.d.ts +4 -4
- package/lib/api/Encryption.d.ts +2 -2
- package/lib/api/Files.d.ts +28 -52
- package/lib/api/Files.js +1 -1
- package/lib/api/FreeTrial.d.ts +2 -2
- package/lib/api/GroupsOwners.d.ts +2 -2
- package/lib/api/GroupsWorkflows.d.ts +2 -2
- package/lib/api/Integrations.d.ts +62 -4
- package/lib/api/Integrations.js +1 -1
- package/lib/api/Live.d.ts +1 -1
- package/lib/api/Preferences.d.ts +5 -5
- package/lib/api/Printing.d.ts +2 -2
- package/lib/api/Profile.d.ts +2 -2
- package/lib/api/Proofs.d.ts +42 -24
- package/lib/api/Proofs.js +1 -1
- package/lib/api/ProofsAssets.d.ts +1 -1
- package/lib/api/ProofsAssetsColorSeparations.d.ts +3 -3
- package/lib/api/ProofsAssetsExtractedText.d.ts +3 -3
- package/lib/api/ProofsAudit.d.ts +29 -2
- package/lib/api/ProofsAudit.js +1 -1
- package/lib/api/ProofsCustomTools.d.ts +1 -1
- package/lib/api/ProofsDecisions.d.ts +4 -4
- package/lib/api/ProofsEditors.d.ts +6 -6
- package/lib/api/ProofsGroups.d.ts +15 -3
- package/lib/api/ProofsGroups.js +1 -1
- package/lib/api/ProofsIntegrationReferences.d.ts +4 -4
- package/lib/api/ProofsLinkCheck.d.ts +1 -1
- package/lib/api/ProofsOwners.d.ts +3 -3
- package/lib/api/ProofsReviewers.d.ts +2 -2
- package/lib/api/ProofsVersions.d.ts +2 -2
- package/lib/api/Reminders.d.ts +4 -4
- package/lib/api/Reports.d.ts +2 -2
- package/lib/api/Sessions.d.ts +1 -1
- package/lib/api/Teams.d.ts +1 -1
- package/lib/api/TeamsInvitations.d.ts +1 -1
- package/lib/api/Users.d.ts +10 -1
- package/lib/api/Users.js +1 -1
- package/lib/api/Workflows.d.ts +189 -31
- package/lib/api/Workflows.js +1 -1
- package/lib/api/WorkflowsSteps.d.ts +4 -4
- package/lib/api/admin/Admin.d.ts +1 -1
- package/lib/api/admin/Team.d.ts +1 -1
- package/lib/api/admin/TeamCustomTools.d.ts +1 -1
- package/lib/api/admin/TeamDashboard.d.ts +141 -14
- package/lib/api/admin/TeamDashboard.js +211 -13
- package/lib/api/admin/TeamDashboardGroups.d.ts +4 -4
- package/lib/api/admin/TeamFeatures.d.ts +29 -5
- package/lib/api/admin/TeamFeatures.js +61 -2
- package/lib/api/admin/TeamNotifications.d.ts +1 -1
- package/lib/api/admin/TeamPreferences.d.ts +1 -1
- package/lib/api/admin/TeamSCIM.d.ts +1 -1
- package/lib/api/admin/TeamUsers.d.ts +7 -7
- package/lib/api/admin/TeamWorkflows.d.ts +3 -3
- package/lib/api/brian/Brian.d.ts +1 -1
- package/lib/bluffer/Uint8ArrayBluffer.d.ts +1 -1
- package/lib/core/AdapterRepository.d.ts +3 -3
- package/lib/core/Cache.d.ts +2 -2
- package/lib/core/KeyPairs.d.ts +2 -2
- package/lib/core/PageProof.d.ts +21 -45
- package/lib/core/PageProof.js +1 -1
- package/lib/crypto/authServerEncryption.d.ts +21 -0
- package/lib/crypto/authServerEncryption.js +1 -0
- package/lib/crypto/encryptComment.d.ts +1 -1
- package/lib/crypto/encryptFileBlock.js +1 -1
- package/lib/crypto/envelopes.d.ts +1 -1
- package/lib/crypto/index.d.ts +4 -1
- package/lib/crypto/index.js +1 -1
- package/lib/enum/ResponseStatus.d.ts +3 -0
- package/lib/enum/ResponseStatus.js +1 -1
- package/lib/enum/StatusMessage.d.ts +24 -0
- package/lib/enum/StatusMessage.js +1 -0
- package/lib/enum/index.d.ts +2 -1
- package/lib/enum/index.js +1 -1
- package/lib/events/EventEmitter.d.ts +1 -1
- package/lib/indexeddb-cache-adapter.js +1 -1
- package/lib/models/Comment.d.ts +19 -4
- package/lib/models/Comment.js +1 -1
- package/lib/models/DecisionSummary.d.ts +2 -2
- package/lib/models/File.d.ts +5 -5
- package/lib/models/Label.d.ts +36 -0
- package/lib/models/Label.js +1 -0
- package/lib/models/Preference.d.ts +1 -1
- package/lib/models/Proof.d.ts +67 -11
- package/lib/models/Proof.js +1 -1
- package/lib/models/ProofChecklist.d.ts +1 -1
- package/lib/models/ProofGroup.d.ts +9 -1
- package/lib/models/ProofGroup.js +1 -1
- package/lib/models/ProofIntegrationReference.d.ts +1 -1
- package/lib/models/ProofVersion.d.ts +1 -1
- package/lib/models/Reminder.d.ts +3 -3
- package/lib/models/ReportConfiguration.d.ts +1 -1
- package/lib/models/ReportField.d.ts +1 -1
- package/lib/models/Session.d.ts +5 -9
- package/lib/models/TeamAccountFeatures.d.ts +1 -1
- package/lib/models/TeamAccountFeatures.js +1 -1
- package/lib/models/TeamAddressBookFeatures.d.ts +1 -1
- package/lib/models/TeamCommentFeatures.d.ts +2 -2
- package/lib/models/TeamEmailFeatures.d.ts +1 -1
- package/lib/models/TeamFeatures.d.ts +7 -1
- package/lib/models/TeamFeatures.js +1 -1
- package/lib/models/TeamGeneralFeatures.d.ts +23 -0
- package/lib/models/TeamGeneralFeatures.js +1 -0
- package/lib/models/TeamIntelligenceFeatures.d.ts +61 -1
- package/lib/models/TeamIntelligenceFeatures.js +1 -1
- package/lib/models/TeamInvitation.d.ts +1 -1
- package/lib/models/TeamNotifications.d.ts +1 -1
- package/lib/models/TeamProofFeatures.d.ts +37 -1
- package/lib/models/TeamProofFeatures.js +1 -1
- package/lib/models/TeamUserGroupsFeatures.d.ts +17 -0
- package/lib/models/TeamUserGroupsFeatures.js +1 -0
- package/lib/models/TeamWebhookFeatures.d.ts +1 -1
- package/lib/models/TeamWorkflowFeatures.d.ts +1 -1
- package/lib/models/User.d.ts +3 -3
- package/lib/models/Workflow.d.ts +27 -3
- package/lib/models/Workflow.js +1 -1
- package/lib/models/WorkflowStep.d.ts +7 -3
- package/lib/models/WorkflowUser.d.ts +14 -7
- package/lib/models/index.d.ts +2 -1
- package/lib/models/index.js +1 -1
- package/lib/network/Request.d.ts +1 -1
- package/lib/network/Response.d.ts +39 -8
- package/lib/network/Response.js +1 -1
- package/lib/network/endpoints.json +90 -5
- package/lib/pageproof.js +1 -1
- package/lib/protobuf-adapter.js +1 -1
- package/lib/sync-crypto-adapter.js +1 -1
- package/lib/types/Comment.d.ts +6 -6
- package/lib/types/CommentImport.d.ts +3 -3
- package/lib/types/CommentTokenDefinition.d.ts +1 -1
- package/lib/types/DecisionOptions.d.ts +2 -2
- package/lib/types/Endpoint.d.ts +2 -2
- package/lib/types/FileV2.d.ts +3 -3
- package/lib/types/IsolatedLoginStatusResult.d.ts +22 -0
- package/lib/types/IsolatedLoginStatusResult.js +1 -0
- package/lib/types/NudgedWorkflow.d.ts +1 -1
- package/lib/types/NudgedWorkflowsResult.d.ts +2 -2
- package/lib/types/Pin.d.ts +5 -5
- package/lib/types/PrintingJobOptions.d.ts +1 -1
- package/lib/types/PrintingOption.d.ts +2 -2
- package/lib/types/ProofAuditSummary.d.ts +10 -0
- package/lib/types/ProofAuditSummary.js +1 -0
- package/lib/types/ProofAuditSummaryBlock.d.ts +17 -0
- package/lib/types/ProofAuditSummaryBlock.js +1 -0
- package/lib/types/ProofAuditVersion.d.ts +17 -0
- package/lib/types/ProofAuditVersion.js +1 -0
- package/lib/types/ReturnProofsResult.d.ts +2 -2
- package/lib/types/TeamDashboardPagination.d.ts +1 -1
- package/lib/types/TeamSenderEmail.d.ts +1 -1
- package/lib/types/WorkflowMetrics.d.ts +2 -2
- package/lib/types/WorkflowStepDefinition.d.ts +2 -2
- package/lib/types/WorkflowUserDefinition.d.ts +1 -4
- package/lib/util/Scheduler.d.ts +5 -5
- package/lib/util/comments/extractMentions.d.ts +1 -1
- package/lib/util/comments/v1-to-v2.d.ts +1 -0
- package/lib/util/comments/v1-to-v2.js +1 -0
- package/lib/util/creationToken.d.ts +1 -0
- package/lib/util/creationToken.js +1 -1
- package/lib/util/dashboardSearchShared.d.ts +156 -0
- package/lib/util/dashboardSearchShared.js +1 -0
- package/lib/util/errorMessages.d.ts +84 -0
- package/lib/util/errorMessages.js +1 -0
- package/lib/util/exports.js +1 -1
- package/lib/util/fileValidation.d.ts +1 -0
- package/lib/util/fileValidation.js +1 -0
- package/lib/util/isolatedAuthCert.d.ts +2 -0
- package/lib/util/isolatedAuthCert.js +1 -0
- package/lib/util/pins/parsePins.d.ts +1 -0
- package/lib/util/pins/parsePins.js +9 -1
- package/lib/util/pins/serializePins.d.ts +1 -0
- package/lib/util/pins/serializePins.js +4 -1
- package/lib/worker-crypto-adapter.js +1 -1
- package/lib/{worker.959d0daf.js → worker.c898e379.js} +2 -2
- package/lib/xhr-request-adapter.js +1 -1
- package/package.json +24 -22
- package/CHANGELOG.md +0 -1333
|
@@ -49,29 +49,15 @@ declare class AngularEnhancementAdapter extends IEnhancementAdapter {
|
|
|
49
49
|
* @param {object} [options.$scope] The $scope to re-digest
|
|
50
50
|
*/
|
|
51
51
|
constructor(options: {
|
|
52
|
-
module?: any;
|
|
53
|
-
$exceptionHandler?: Function;
|
|
54
|
-
$scope?: any;
|
|
55
|
-
});
|
|
56
|
-
/** @private */
|
|
57
|
-
options: {
|
|
58
52
|
module: any;
|
|
59
|
-
$exceptionHandler:
|
|
60
|
-
$scope:
|
|
61
|
-
};
|
|
62
|
-
/** @private */
|
|
63
|
-
$scope: any;
|
|
64
|
-
/** @private */
|
|
65
|
-
$exceptionHandler: any;
|
|
53
|
+
$exceptionHandler: Function;
|
|
54
|
+
$scope: object;
|
|
55
|
+
});
|
|
66
56
|
/** @private */
|
|
67
|
-
|
|
57
|
+
private options;
|
|
68
58
|
/** @private */
|
|
69
|
-
|
|
70
|
-
rejected: any;
|
|
71
|
-
}): void;
|
|
59
|
+
private $scope;
|
|
72
60
|
/** @private */
|
|
73
|
-
|
|
74
|
-
error: any;
|
|
75
|
-
}): void;
|
|
61
|
+
private $exceptionHandler;
|
|
76
62
|
}
|
|
77
63
|
import IEnhancementAdapter from "./IEnhancementAdapter";
|
|
@@ -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;
|
|
@@ -30,22 +30,12 @@ declare class IndexedDBCacheAdapter extends ICacheAdapter {
|
|
|
30
30
|
* @param {string} [options.database] The name of the IndexedDB database
|
|
31
31
|
*/
|
|
32
32
|
constructor(options?: {
|
|
33
|
-
database?: string;
|
|
34
|
-
});
|
|
35
|
-
/** @private */
|
|
36
|
-
options: {
|
|
37
33
|
database: string;
|
|
38
|
-
};
|
|
39
|
-
/** @private */
|
|
40
|
-
cache: any;
|
|
41
|
-
/** @private */
|
|
42
|
-
set(key: any, value: any): any;
|
|
43
|
-
/** @private */
|
|
44
|
-
has(key: any): any;
|
|
34
|
+
});
|
|
45
35
|
/** @private */
|
|
46
|
-
|
|
36
|
+
private options;
|
|
47
37
|
/** @private */
|
|
48
|
-
|
|
38
|
+
private cache;
|
|
49
39
|
/**
|
|
50
40
|
* Purges any expired entries from the cache.
|
|
51
41
|
*
|
|
@@ -33,15 +33,9 @@ declare class NodeRequestAdapter extends IRequestAdapter {
|
|
|
33
33
|
* @param {string|boolean} [options.proxy] The proxy URL to send all requests through. This option is only required if you want to manually override the system level proxy settings. Setting this option to `false` will disable all proxy settings. Omitting the setting (which is set to `true` by default) will attempt to proxy requests using the system level proxy settings.
|
|
34
34
|
*/
|
|
35
35
|
constructor(options?: {
|
|
36
|
-
proxy?: string | boolean;
|
|
37
|
-
});
|
|
38
|
-
/** @private */
|
|
39
|
-
options: {
|
|
40
36
|
proxy: string | boolean;
|
|
41
|
-
};
|
|
37
|
+
});
|
|
42
38
|
/** @private */
|
|
43
|
-
|
|
44
|
-
attempt: number;
|
|
45
|
-
}): Promise<any>;
|
|
39
|
+
private options;
|
|
46
40
|
}
|
|
47
41
|
import IRequestAdapter from "./IRequestAdapter";
|
|
@@ -2,122 +2,6 @@ export default SchedulerCryptoAdapter;
|
|
|
2
2
|
declare class SchedulerCryptoAdapter extends ICryptoAdapter {
|
|
3
3
|
constructor(options: any);
|
|
4
4
|
scheduler: Scheduler;
|
|
5
|
-
/**
|
|
6
|
-
* @param {string} data$ The encrypted (and encoded) data
|
|
7
|
-
* @param {string} envelope$ The envelope containing the key
|
|
8
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the envelope
|
|
9
|
-
* @param {string[]} before Any pre-processing to do on the encrypted data
|
|
10
|
-
* @param {string[]} after Any post-processing to do on the newly-decrypted data
|
|
11
|
-
* @returns {Promise<string>} The decrypted (and encoded) data
|
|
12
|
-
*/
|
|
13
|
-
decryptBytes(comment$: any, envelope$: string, privateKeyPEMs: string[], before: string[], after: string[]): Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} comment$ The encrypted comment
|
|
16
|
-
* @param {string} envelope The comment envelope containing the key
|
|
17
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the envelope
|
|
18
|
-
* @returns {Promise<string>} The original, raw comment text
|
|
19
|
-
*/
|
|
20
|
-
decryptComment(comment$: string, envelope: string, privateKeyPEMs: string[]): Promise<string>;
|
|
21
|
-
/**
|
|
22
|
-
* @abstract
|
|
23
|
-
* @param {number} version The encryption version number
|
|
24
|
-
* @param {string} data$ The encrypted data
|
|
25
|
-
* @param {string} envelope$ The envelope to use for decrypting the data
|
|
26
|
-
* @param {string[]} privateKeyPEMs The user's private keys (in PEM format)
|
|
27
|
-
* @returns {Promise<string>} The decrypted data
|
|
28
|
-
*/
|
|
29
|
-
decryptData(version: number, data$: string, envelope$: string, privateKeyPEMs: string[]): Promise<string>;
|
|
30
|
-
/**
|
|
31
|
-
* @param {string} data$ The encrypted file block (and envelope)
|
|
32
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the embedded envelope
|
|
33
|
-
* @returns {Promise<string>} A base64 representation of the original block
|
|
34
|
-
*/
|
|
35
|
-
decryptFileBlock(data$: string, privateKeyPEMs: string[]): Promise<string>;
|
|
36
|
-
/**
|
|
37
|
-
* @param {string} data$ The encrypted image (and envelope)
|
|
38
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the embedded envelope
|
|
39
|
-
* @returns {Promise<string>} A base64 representation of the original image
|
|
40
|
-
*/
|
|
41
|
-
decryptImage(data$: string, privateKeyPEMs: string[]): Promise<string>;
|
|
42
|
-
/**
|
|
43
|
-
* @param {string} privateKey$ The user's encrypted private key
|
|
44
|
-
* @param {string} password The user's original password, used to decrypt the private key
|
|
45
|
-
* @returns {Promise<string>} The user's private key (in PEM format)
|
|
46
|
-
*/
|
|
47
|
-
decryptPrivateKey(privateKey$: string, password: string): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* @param {{key: string, iv: string}} keyIV The key & iv to encrypt the block with
|
|
50
|
-
* @param {string} fileBlock The file block
|
|
51
|
-
* @param {boolean} decodeBlock Whether the `fileBlock` should be decoded before encrypting
|
|
52
|
-
* @returns {Promise<string>} The encrypted block, base64 encoded
|
|
53
|
-
*/
|
|
54
|
-
encryptFileBlock(keyIV: {
|
|
55
|
-
key: string;
|
|
56
|
-
iv: string;
|
|
57
|
-
}, fileBlock: string, decodeBlock: boolean): Promise<string>;
|
|
58
|
-
/**
|
|
59
|
-
* @param {string} privateKeyPEM The user's private key (in PEM format)
|
|
60
|
-
* @param {string} password The user's original password, used to encrypt the private key
|
|
61
|
-
* @returns {Promise<string>} The user's encrypted private key
|
|
62
|
-
*/
|
|
63
|
-
encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>;
|
|
64
|
-
/**
|
|
65
|
-
* @param {string} secret The secret to seal within an envelope
|
|
66
|
-
* @param {Array<string>} publicKeyPEMs The list of public keys to encrypt the envelope for
|
|
67
|
-
* @returns {Promise<string>} The full envelope
|
|
68
|
-
*/
|
|
69
|
-
envelopeSeal(secret: string, publicKeyPEMs: string[]): Promise<string>;
|
|
70
|
-
/**
|
|
71
|
-
* @param {string} envelope The full envelope to unseal
|
|
72
|
-
* @param {string[]} privateKeyPEMs The user's private keys (in PEM format), used to decrypt the envelope
|
|
73
|
-
* @returns {Promise<string>} The secret within the envelope
|
|
74
|
-
*/
|
|
75
|
-
envelopeUnseal(envelope: string, privateKeyPEMs: string[]): Promise<string>;
|
|
76
|
-
/**
|
|
77
|
-
* @param {string} method The request method/verb (eg. GET, POST)
|
|
78
|
-
* @param {string} path The endpoint (pathname)
|
|
79
|
-
* @param {Session} session The Session object used to sign the request
|
|
80
|
-
* @returns {Promise<Object<string, string>>} The additional headers to add to the request for it to be signed
|
|
81
|
-
*/
|
|
82
|
-
generateAuthorizationHeaders(method: string, path: string, session: any): Promise<{
|
|
83
|
-
[x: string]: string;
|
|
84
|
-
}>;
|
|
85
|
-
/**
|
|
86
|
-
* @param {string} password The user's original password
|
|
87
|
-
* @returns {Promise<string>} The hashed password
|
|
88
|
-
*/
|
|
89
|
-
generatePasswordHash(password: string): Promise<string>;
|
|
90
|
-
/**
|
|
91
|
-
* @param {string} serverPublicKeyPEM The server's public key (in PEM format)
|
|
92
|
-
* @returns {Promise<WrappedSymmetricKey>} The wrapped symmetric key
|
|
93
|
-
*/
|
|
94
|
-
generateWrappedSymmetricKey(serverPublicKeyPEM: string): Promise<WrappedSymmetricKey>;
|
|
95
|
-
/**
|
|
96
|
-
* @param {string} privateKey$ The encrypted (and base64 encoded) private key
|
|
97
|
-
* @param {string} keyBase64 The key (base64 encoded) for decrypting the private key
|
|
98
|
-
* @returns {Promise<string>} The private pem (in PEM format)
|
|
99
|
-
*/
|
|
100
|
-
decryptManagedPrivateKey(privateKey$: string, keyBase64: string): Promise<string>;
|
|
101
|
-
/**
|
|
102
|
-
* @param {string} comment The raw comment text
|
|
103
|
-
* @param {Array<string>} publicKeyPEMs The public keys of recipients who can decrypt the comment (in PEM format)
|
|
104
|
-
* @returns {Promise<EncryptedComment>} The encrypted comment and envelope
|
|
105
|
-
*/
|
|
106
|
-
encryptComment(comment: string, publicKeyPEMs: string[]): Promise<EncryptedComment>;
|
|
107
|
-
/**
|
|
108
|
-
* @param {string} serverPublicKeyPEM The server's public key (in PEM format)
|
|
109
|
-
* @returns {Promise<{ key: string, key$: string }>}
|
|
110
|
-
*/
|
|
111
|
-
generateCommentImportKey(serverPublicKeyPEM: string): Promise<{
|
|
112
|
-
key: string;
|
|
113
|
-
key$: string;
|
|
114
|
-
}>;
|
|
115
|
-
/**
|
|
116
|
-
* @param {string} key The key (encoded) to encrypt the file with
|
|
117
|
-
* @param {string} fileBase64 The base64 encoded file contents
|
|
118
|
-
* @returns {Promise<string>} The encrypted block, base64 encoded
|
|
119
|
-
*/
|
|
120
|
-
encryptCommentImportFile(key: string, fileBase64: string): Promise<string>;
|
|
121
5
|
}
|
|
122
6
|
import ICryptoAdapter from "./ICryptoAdapter";
|
|
123
7
|
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;
|
|
@@ -1,105 +1,4 @@
|
|
|
1
1
|
export default SyncCryptoAdapter;
|
|
2
2
|
declare class SyncCryptoAdapter extends ICryptoAdapter {
|
|
3
|
-
/**
|
|
4
|
-
* @param {string} data$ The encrypted (and encoded) data
|
|
5
|
-
* @param {string} envelope$ The envelope containing the key
|
|
6
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the envelope
|
|
7
|
-
* @param {string[]} before Any pre-processing to do on the encrypted data
|
|
8
|
-
* @param {string[]} after Any post-processing to do on the newly-decrypted data
|
|
9
|
-
* @returns {Promise<string>} The decrypted (and encoded) data
|
|
10
|
-
*/
|
|
11
|
-
decryptBytes(comment$: any, envelope$: string, privateKeyPEMs: string[], before: string[], after: string[]): Promise<string>;
|
|
12
|
-
/**
|
|
13
|
-
* @param {string} comment$ The encrypted comment
|
|
14
|
-
* @param {string} envelope The comment envelope containing the key
|
|
15
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the envelope
|
|
16
|
-
* @returns {Promise<string>} The original, raw comment text
|
|
17
|
-
*/
|
|
18
|
-
decryptComment(comment$: string, envelope: string, privateKeyPEMs: string[]): Promise<string>;
|
|
19
|
-
/**
|
|
20
|
-
* @param {number} version The encryption version number
|
|
21
|
-
* @param {string} data$ The encrypted data
|
|
22
|
-
* @param {string} envelope$ The envelope to use for decrypting the data
|
|
23
|
-
* @param {string[]} privateKeyPEMs The user's private keys (in PEM format)
|
|
24
|
-
* @returns {Promise<string>} The decrypted data
|
|
25
|
-
*/
|
|
26
|
-
decryptData(version: number, data$: string, envelope$: string, privateKeyPEMs: string[]): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* @param {string} data$ The encrypted file block (and envelope)
|
|
29
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the embedded envelope
|
|
30
|
-
* @returns {Promise<string>} A base64 representation of the original block
|
|
31
|
-
*/
|
|
32
|
-
decryptFileBlock(data$: string, privateKeyPEMs: string[]): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* @param {string} data$ The encrypted image (and envelope)
|
|
35
|
-
* @param {string[]} privateKeyPEMs The user's private keys used to decrypt the embedded envelope
|
|
36
|
-
* @returns {Promise<string>} A base64 representation of the original image
|
|
37
|
-
*/
|
|
38
|
-
decryptImage(data$: string, privateKeyPEMs: string[]): Promise<string>;
|
|
39
|
-
/**
|
|
40
|
-
* @param {string} privateKey$ The user's encrypted private key
|
|
41
|
-
* @param {string} password The user's original password, used to decrypt the private key
|
|
42
|
-
* @returns {Promise<string>} The user's private key (in PEM format)
|
|
43
|
-
*/
|
|
44
|
-
decryptPrivateKey(privateKey$: string, password: string): Promise<string>;
|
|
45
|
-
/**
|
|
46
|
-
* @param {{key: string, iv: string}} keyIV The key & iv to encrypt the block with
|
|
47
|
-
* @param {string} fileBlock The file block
|
|
48
|
-
* @param {boolean} decodeBlock Whether the `fileBlock` should be decoded before encrypting
|
|
49
|
-
* @returns {Promise<string>} The encrypted block, base64 encoded
|
|
50
|
-
*/
|
|
51
|
-
encryptFileBlock(keyIV: {
|
|
52
|
-
key: string;
|
|
53
|
-
iv: string;
|
|
54
|
-
}, fileBlock: string, decodeBlock: boolean): Promise<string>;
|
|
55
|
-
/**
|
|
56
|
-
* @param {string} privateKeyPEM The user's private key (in PEM format)
|
|
57
|
-
* @param {string} password The user's original password, used to encrypt the private key
|
|
58
|
-
* @returns {Promise<string>} The user's encrypted private key
|
|
59
|
-
*/
|
|
60
|
-
encryptPrivateKey(privateKeyPEM: string, password: string): Promise<string>;
|
|
61
|
-
/**
|
|
62
|
-
* @param {string} secret The secret to seal within an envelope
|
|
63
|
-
* @param {Array<string>} publicKeyPEMs The list of public keys to encrypt the envelope for
|
|
64
|
-
* @returns {Promise<string>} The full envelope
|
|
65
|
-
*/
|
|
66
|
-
envelopeSeal(secret: string, publicKeyPEMs: string[]): Promise<string>;
|
|
67
|
-
/**
|
|
68
|
-
* @param {string} envelope The full envelope to unseal
|
|
69
|
-
* @param {string[]} privateKeyPEMs The user's private keys (in PEM format), used to decrypt the envelope
|
|
70
|
-
* @returns {Promise<string>} The secret within the envelope
|
|
71
|
-
*/
|
|
72
|
-
envelopeUnseal(envelope: string, privateKeyPEMs: string[]): Promise<string>;
|
|
73
|
-
/**
|
|
74
|
-
* @param {string} method The request method/verb (eg. GET, POST)
|
|
75
|
-
* @param {string} path The endpoint (pathname)
|
|
76
|
-
* @param {Session} session The Session object used to sign the request
|
|
77
|
-
* @returns {Promise<Object<string, string>>} The additional headers to add to the request for it to be signed
|
|
78
|
-
*/
|
|
79
|
-
generateAuthorizationHeaders(method: string, path: string, session: any): Promise<{
|
|
80
|
-
[x: string]: string;
|
|
81
|
-
}>;
|
|
82
|
-
/**
|
|
83
|
-
* @param {string} password The user's original password
|
|
84
|
-
* @returns {Promise<string>} The hashed password
|
|
85
|
-
*/
|
|
86
|
-
generatePasswordHash(password: string): Promise<string>;
|
|
87
|
-
/**
|
|
88
|
-
* @param {string} serverPublicKeyPEM The server's public key (in PEM format)
|
|
89
|
-
* @returns {Promise<WrappedSymmetricKey>} The wrapped symmetric key
|
|
90
|
-
*/
|
|
91
|
-
generateWrappedSymmetricKey(serverPublicKeyPEM: string): Promise<WrappedSymmetricKey>;
|
|
92
|
-
/**
|
|
93
|
-
* @param {string} privateKey$ The encrypted (and base64 encoded) private key
|
|
94
|
-
* @param {string} keyBase64 The key (base64 encoded) for decrypting the private key
|
|
95
|
-
* @returns {Promise<string>} The private pem (in PEM format)
|
|
96
|
-
*/
|
|
97
|
-
decryptManagedPrivateKey(privateKey$: string, keyBase64: string): Promise<string>;
|
|
98
|
-
/**
|
|
99
|
-
* @param {string} comment The raw comment text
|
|
100
|
-
* @param {Array<string>} publicKeyPEMs The public keys of recipients who can decrypt the comment (in PEM format)
|
|
101
|
-
* @returns {Promise<EncryptedComment>} The encrypted comment and envelope
|
|
102
|
-
*/
|
|
103
|
-
encryptComment(comment: string, publicKeyPEMs: string[]): Promise<EncryptedComment>;
|
|
104
3
|
}
|
|
105
4
|
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;
|
|
@@ -8,10 +8,10 @@ declare class WorkerCryptoAdapter extends SchedulerCryptoAdapter {
|
|
|
8
8
|
* @param {boolean} [options.optimistic]
|
|
9
9
|
*/
|
|
10
10
|
constructor(options?: {
|
|
11
|
-
url
|
|
12
|
-
create
|
|
13
|
-
limit
|
|
14
|
-
optimistic
|
|
11
|
+
url: string;
|
|
12
|
+
create: Function;
|
|
13
|
+
limit: number;
|
|
14
|
+
optimistic: boolean;
|
|
15
15
|
});
|
|
16
16
|
options: {
|
|
17
17
|
url?: string;
|
|
@@ -6,11 +6,11 @@ declare class WorkerThreadsCryptoAdapter extends SchedulerCryptoAdapter {
|
|
|
6
6
|
* @param {boolean} [options.optimistic] Whether to immediately create the maximum number of worker threads (reduces cold start times).
|
|
7
7
|
*/
|
|
8
8
|
constructor(options?: {
|
|
9
|
-
limit
|
|
10
|
-
optimistic
|
|
9
|
+
limit: number | null | undefined;
|
|
10
|
+
optimistic: boolean;
|
|
11
11
|
});
|
|
12
12
|
options: {
|
|
13
|
-
limit?: number;
|
|
13
|
+
limit?: number | null | undefined;
|
|
14
14
|
optimistic?: boolean;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -23,13 +23,9 @@ declare class XHRRequestAdapter extends IRequestAdapter {
|
|
|
23
23
|
* @param {boolean} [options.async=true] Whether to send request asynchronously
|
|
24
24
|
*/
|
|
25
25
|
constructor(options?: {
|
|
26
|
-
async?: boolean;
|
|
27
|
-
});
|
|
28
|
-
/** @private */
|
|
29
|
-
options: {
|
|
30
26
|
async: boolean;
|
|
31
|
-
};
|
|
27
|
+
});
|
|
32
28
|
/** @private */
|
|
33
|
-
|
|
29
|
+
private options;
|
|
34
30
|
}
|
|
35
31
|
import IRequestAdapter from "./IRequestAdapter";
|
|
@@ -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 _IRequestAdapter2=require("./IRequestAdapter");var _IRequestAdapter3=_interopRequireDefault(_IRequestAdapter2);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 debug=require("debug")("XHRRequestAdapter");var CONTENT_LENGTH_HEADER="ppcl";var defaultOptions={async:true};var XHRRequestAdapter=function(_IRequestAdapter){_inherits(XHRRequestAdapter,_IRequestAdapter);function XHRRequestAdapter(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,XHRRequestAdapter);var _this=_possibleConstructorReturn(this,_IRequestAdapter.call(this));_this.options=_extends({},defaultOptions,options);return _this}XHRRequestAdapter.prototype.send=function send(request){var _this2=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};debug(request.method+" "+request.path);return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===4){debug(request.method+" "+request.path+" ("+xhr.status+")");var headers={};try{var lines=xhr.getAllResponseHeaders().split("\n");lines.forEach(function(line){if(line){var _line$split=line.split(": ",2),name=_line$split[0],value=_line$split[1];headers[name.toLowerCase()]=value}})}catch(err){debug(err)}resolve({status:xhr.status,headers:headers,body:options.bluffer?xhr.response:xhr.responseText})}};xhr.onerror=function(){debug(request.method+" "+request.path+" (Unknown error)");reject(new Error("A network level error occurred."))};if(options.onUploadProgress){xhr.upload.onprogress=function(event){if(event.loaded&&event.total){options.onUploadProgress(event.loaded/event.total*100)}}}if(options.onDownloadProgress){var length=null;xhr.onprogress=function(event){if(length===null){length=event.total;try{if(!length){length=parseInt(xhr.getResponseHeader(CONTENT_LENGTH_HEADER),10)}}catch(err){length=0}}if(length){options.onDownloadProgress(event.loaded/length*100)}}}xhr.open(request.method,request.host+request.path+request.query,_this2.options.async);if(options.bluffer){xhr.responseType="blob"}if(request.credentials){xhr.withCredentials=true}if(request.headers){Object.keys(request.headers).forEach(function(name){var value=request.headers[name];if(value!=null){xhr.setRequestHeader(name,value)}})}xhr.send(request.body)})};return XHRRequestAdapter}(_IRequestAdapter3.default);exports.default=XHRRequestAdapter;
|
|
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 _IRequestAdapter2=require("./IRequestAdapter");var _IRequestAdapter3=_interopRequireDefault(_IRequestAdapter2);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 debug=require("debug")("XHRRequestAdapter");var CONTENT_LENGTH_HEADER="ppcl";var defaultOptions={async:true};var XHRRequestAdapter=function(_IRequestAdapter){_inherits(XHRRequestAdapter,_IRequestAdapter);function XHRRequestAdapter(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,XHRRequestAdapter);var _this=_possibleConstructorReturn(this,_IRequestAdapter.call(this));_this.options=_extends({},defaultOptions,options);return _this}XHRRequestAdapter.prototype.send=function send(request){var _this2=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};debug(request.method+" "+request.path);return new Promise(function(resolve,reject){var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===4){if(options.rejectOnNetworkError&&xhr.status===0){return}debug(request.method+" "+request.path+" ("+xhr.status+")");var headers={};try{var lines=xhr.getAllResponseHeaders().split("\n");lines.forEach(function(line){if(line){var _line$split=line.split(": ",2),name=_line$split[0],value=_line$split[1];headers[name.toLowerCase()]=value}})}catch(err){debug(err)}resolve({status:xhr.status,headers:headers,body:options.bluffer?xhr.response:xhr.responseText})}};xhr.onerror=function(){debug(request.method+" "+request.path+" (Unknown error)");reject(new Error("A network level error occurred."))};if(options.timeout){xhr.timeout=options.timeout;xhr.ontimeout=function(){debug(request.method+" "+request.path+" (Timeout after "+options.timeout+"ms)");reject(new Error("Request timed out after "+options.timeout+"ms."))}}if(options.onUploadProgress){xhr.upload.onprogress=function(event){if(event.loaded&&event.total){options.onUploadProgress(event.loaded/event.total*100)}}}if(options.onDownloadProgress){var length=null;xhr.onprogress=function(event){if(length===null){length=event.total;try{if(!length){length=parseInt(xhr.getResponseHeader(CONTENT_LENGTH_HEADER),10)}}catch(err){length=0}}if(length){options.onDownloadProgress(event.loaded/length*100)}}}xhr.open(request.method,request.host+request.path+request.query,_this2.options.async);if(options.bluffer){xhr.responseType="blob"}if(request.credentials){xhr.withCredentials=true}if(request.headers){Object.keys(request.headers).forEach(function(name){var value=request.headers[name];if(value!=null){xhr.setRequestHeader(name,value)}})}xhr.send(request.body)})};return XHRRequestAdapter}(_IRequestAdapter3.default);exports.default=XHRRequestAdapter;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProofAngularEnhancementAdapter=t():e.PageProofAngularEnhancementAdapter=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(c),p=n(2)("AngularEnhancementAdapter"),f={$scope:null,$exceptionHandler:null,module:null},s=function(e){function t(n){o(this,t);var i=r(this,e.call(this));return i.options=u({},f,n),i.$scope=i.options.$scope,i.$exceptionHandler=i.options.$exceptionHandler,i.options.module&&i.options.module.run(["$rootScope","$exceptionHandler",function(e,t){p("Extracting the $rootScope and $exceptionHandler from Angular module"),i.$scope=i.$scope||e,i.$exceptionHandler=i.$exceptionHandler||t}]),i}return i(t,e),t.prototype.onMethodFinally=function(){this.$scope&&!this.$scope.$$phase&&this.$scope.$apply(),this.$scope||p("Unable to tell $scope to re-digest, either module hasn't booted, or no $scope was provided")},t.prototype.onMethodReject=function(e){var t=e.rejected;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of rejected Promise, check configuration")},t.prototype.onMethodThrown=function(e){var t=e.error;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of uncaught error, check configuration")},t}(a.default);t.default=s},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var o=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=o.bind.apply(o,[this].concat(t));return n(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),c=Object.getPrototypeOf(r),a=Object.keys(c).filter(function(e){return"function"==typeof c[e]&&0!==e.indexOf("_")});if(i.length||n){var p=i.join(".");0===p.indexOf("__")&&(p=p.substring(2)),a.forEach(function(e){o.push({namespace:p,name:e,api:r})})}u.forEach(function(e){t(r[e],i.concat(e))})}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=[];return t(e),o}t.__esModule=!0;var u,c,a=(c=u=function(){function e(){o(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){var n={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};t.onMethodEnhance(n),r(e.api,e.name,function(e){return t.onMethodBefore(n),function(){var o=void 0;try{o=e()}catch(e){throw n.error=e,t.onMethodThrown(n),e}finally{n.value=o,t.onMethodAfter(n),o&&"function"==typeof o.then&&o.then(function(e){n.resolved=e,t.onMethodResolve(n)},function(e){n.rejected=e,t.onMethodReject(n)}).then(function(){t.onMethodFinally(n)})}return o}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodEnhance=function(e){},e.prototype.onMethodBefore=function(e){},e.prototype.onMethodAfter=function(e){},e.prototype.onMethodReject=function(e){},e.prototype.onMethodResolve=function(e){},e.prototype.onMethodFinally=function(e){},e.prototype.onMethodThrown=function(e){},e.prototype.onRequestBefore=function(e){},e.prototype.onRequestAfter=function(e){},e.prototype.onRequestReject=function(e){},e.prototype.onRequestThrottled=function(e){},e.prototype.onRequestRetry=function(e){},e.prototype.onRequestUnauthorized=function(e){},e.prototype.onRequestDeprecated=function(e){},e.prototype.onRequestResolve=function(e){},e.prototype.onRequestFinally=function(e){},e}(),u.__adapter__="IEnhancementAdapter",c);t.default=a},function(e,t,n){"use strict";e.exports=function e(){return e}}])});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProofAngularEnhancementAdapter=t():e.PageProofAngularEnhancementAdapter=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(c),p=n(2)("AngularEnhancementAdapter"),f={$scope:null,$exceptionHandler:null,module:null},s=function(e){function t(n){o(this,t);var i=r(this,e.call(this));return i.options=u({},f,n),i.$scope=i.options.$scope,i.$exceptionHandler=i.options.$exceptionHandler,i.options.module&&i.options.module.run(["$rootScope","$exceptionHandler",function(e,t){p("Extracting the $rootScope and $exceptionHandler from Angular module"),i.$scope=i.$scope||e,i.$exceptionHandler=i.$exceptionHandler||t}]),i}return i(t,e),t.prototype.onMethodFinally=function(){this.$scope&&!this.$scope.$$phase&&this.$scope.$apply(),this.$scope||p("Unable to tell $scope to re-digest, either module hasn't booted, or no $scope was provided")},t.prototype.onMethodReject=function(e){var t=e.rejected;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of rejected Promise, check configuration")},t.prototype.onMethodThrown=function(e){var t=e.error;this.$exceptionHandler?this.$exceptionHandler(t):p("Unable to invoke $exceptionHandler of uncaught error, check configuration")},t}(a.default);t.default=s},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t,n){var o=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=o.bind.apply(o,[this].concat(t));return n(i,this,t).apply(this,t)}}function i(e){function t(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=Object.getOwnPropertyNames(r).filter(function(t){return r[t].client===e}),c=Object.getPrototypeOf(r),a=Object.keys(c).filter(function(e){return"function"==typeof c[e]&&0!==e.indexOf("_")});if(i.length||n){var p=i.join(".");0===p.indexOf("__")&&(p=p.substring(2)),a.forEach(function(e){o.push({namespace:p,name:e,api:r})})}u.forEach(function(e){t(r[e],i.concat(e))})}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=[];return t(e),o}t.__esModule=!0;var u,c,a=(c=u=function(){function e(){o(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){var n={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};t.onMethodEnhance(n),r(e.api,e.name,function(e){return t.onMethodBefore(n),function(){var o=void 0;try{o=e()}catch(e){throw n.error=e,t.onMethodThrown(n),e}finally{n.value=o,t.onMethodAfter(n),o&&"function"==typeof o.then&&o.then(function(e){n.resolved=e,t.onMethodResolve(n)},function(e){n.rejected=e,t.onMethodReject(n)}).then(function(){t.onMethodFinally(n)})}return o}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodEnhance=function(e){},e.prototype.onMethodBefore=function(e){},e.prototype.onMethodAfter=function(e){},e.prototype.onMethodReject=function(e){},e.prototype.onMethodResolve=function(e){},e.prototype.onMethodFinally=function(e){},e.prototype.onMethodThrown=function(e){},e.prototype.onRequestBefore=function(e){},e.prototype.onRequestAfter=function(e){},e.prototype.onRequestReject=function(e){},e.prototype.onRequestThrottled=function(e){},e.prototype.onRequestRetry=function(e){},e.prototype.onRequestUnauthorized=function(e){},e.prototype.onRequestDeprecated=function(e){},e.prototype.onRequestResolve=function(e){},e.prototype.onRequestFinally=function(e){},e}(),u.__adapter__="IEnhancementAdapter",c);t.default=a},function(e,t,n){"use strict";e.exports=function e(){return e}}])});
|
|
2
2
|
//# sourceMappingURL=angular-enhancement-adapter.js.map
|
package/lib/api/API.d.ts
CHANGED
package/lib/api/Accounts.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default Accounts;
|
|
2
2
|
declare class Accounts extends API {
|
|
3
3
|
/** @private */
|
|
4
|
-
constructor(
|
|
4
|
+
private constructor();
|
|
5
5
|
/**
|
|
6
6
|
* The Accounts SSO API.
|
|
7
7
|
*
|
|
@@ -15,7 +15,7 @@ declare class Accounts extends API {
|
|
|
15
15
|
*/
|
|
16
16
|
mfa: AccountsMFA;
|
|
17
17
|
/** @private */
|
|
18
|
-
_generateCredentials
|
|
18
|
+
private _generateCredentials;
|
|
19
19
|
/**
|
|
20
20
|
* Creates a new PageProof account.
|
|
21
21
|
*
|
|
@@ -57,8 +57,8 @@ declare class Accounts extends API {
|
|
|
57
57
|
* @returns {Promise<Session>}
|
|
58
58
|
*/
|
|
59
59
|
register(email: string, password: string, options?: {
|
|
60
|
-
activationCode
|
|
61
|
-
referrer
|
|
60
|
+
activationCode: string;
|
|
61
|
+
referrer: string;
|
|
62
62
|
}): Promise<Session>;
|
|
63
63
|
/**
|
|
64
64
|
* Generates a new activation code for a newly created account. The activation code is sent to the user's email
|
|
@@ -111,6 +111,23 @@ declare class Accounts extends API {
|
|
|
111
111
|
* @returns {Promise<Session>}
|
|
112
112
|
*/
|
|
113
113
|
login(email: string, password: string, totp?: string, _decryptPrivateKey?: boolean): Promise<Session>;
|
|
114
|
+
/**
|
|
115
|
+
* Re-authenticates the user with PageProof.
|
|
116
|
+
* Required when the user requests access to certain privileged actions.
|
|
117
|
+
* The user must be logged in to call this method, so we don't pass in the email address.
|
|
118
|
+
*
|
|
119
|
+
* @example <caption>Re-authenticating the user</caption>
|
|
120
|
+
* await client.accounts.reauthenticate('password', '<totp>');
|
|
121
|
+
*
|
|
122
|
+
* @param {string} password The user's password
|
|
123
|
+
* @param {string} [totp] The user's timed one time passcode produced from their authenticator app (if enabled)
|
|
124
|
+
* @returns {Promise<{success: boolean, error: string | null, data: string | null}>}
|
|
125
|
+
*/
|
|
126
|
+
reauthenticate(password: string, totp?: string): Promise<{
|
|
127
|
+
success: boolean;
|
|
128
|
+
error: string | null;
|
|
129
|
+
data: string | null;
|
|
130
|
+
}>;
|
|
114
131
|
/**
|
|
115
132
|
* Resets the password for an account.
|
|
116
133
|
*
|
package/lib/api/Accounts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var finalOptions=options;if(typeof options==="string"){console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version.");finalOptions={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:finalOptions.referrer})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,undefined,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,finalOptions.activationCode?_this3.activate(finalOptions.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password,totp){var _this5=this;var _decryptPrivateKey=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this5.client.request("accounts.login",{email:email,password:passwordHash,totp:totp})}).then(function(response){var session=(new _Session2.default).fromSession(response.data);session.user.email=email;return session}).then(function(session){if(_decryptPrivateKey){return _this5.client.crypto().decryptPrivateKey(session.privateKeyPEM$,password).then(function(privateKeyPEM){session.privateKeyPEM=privateKeyPEM;return session})}return session}).then(function(session){_this5.client.setSession(session);return session})};Accounts.prototype.reauthenticate=function reauthenticate(password,totp){var _this6=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return _this6.client.request("accounts.reauthenticate",{password:passwordHash,totp:totp})})};Accounts.prototype.resetPassword=function resetPassword(_ref6){var _this7=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this7.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this7.login(email,password,undefined,false)])}).then(function(_ref9){var keyPair=_ref9[0],session=_ref9[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.forgotPassword=function forgotPassword(email){return this.client.request("accounts.forgot-password",{email:email})};Accounts.prototype.setPasswordRequest=function setPasswordRequest(email){return this.client.request("accounts.set-password-request",{email:email})};Accounts.prototype.setPassword=function setPassword(_ref10){var _this8=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this8.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this8.login(email,password,undefined,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this9=this;return this.client.request("accounts.logout").catch(function(err){_this9.client.setSession(null);return Promise.reject(err)}).then(function(){_this9.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
|