@pageproof/sdk-pr 636.0.1762820073965 → 636.0.1769460059803

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.
Files changed (157) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/lib/adapters/AngularEnhancementAdapter.d.ts +6 -20
  3. package/lib/adapters/IEnhancementAdapter.d.ts +1 -1
  4. package/lib/adapters/IndexedDBCacheAdapter.d.ts +3 -13
  5. package/lib/adapters/NodeRequestAdapter.d.ts +2 -8
  6. package/lib/adapters/SchedulerCryptoAdapter.d.ts +0 -134
  7. package/lib/adapters/SyncCryptoAdapter.d.ts +0 -119
  8. package/lib/adapters/WorkerCryptoAdapter.d.ts +4 -4
  9. package/lib/adapters/WorkerThreadsCryptoAdapter.d.ts +3 -3
  10. package/lib/adapters/XHRRequestAdapter.d.ts +2 -6
  11. package/lib/angular-enhancement-adapter.js +1 -1
  12. package/lib/api/API.d.ts +2 -2
  13. package/lib/api/Accounts.d.ts +21 -4
  14. package/lib/api/Accounts.js +1 -1
  15. package/lib/api/AccountsMFA.d.ts +1 -1
  16. package/lib/api/AccountsSSO.d.ts +15 -7
  17. package/lib/api/AccountsSSO.js +1 -1
  18. package/lib/api/Briefs.d.ts +2 -2
  19. package/lib/api/Briefs.js +1 -1
  20. package/lib/api/ChecklistTemplates.d.ts +4 -4
  21. package/lib/api/ChecklistTemplatesEntities.d.ts +2 -2
  22. package/lib/api/Comments.d.ts +18 -17
  23. package/lib/api/Comments.js +1 -1
  24. package/lib/api/CommentsImport.d.ts +7 -10
  25. package/lib/api/Dashboard.d.ts +13 -13
  26. package/lib/api/DashboardGroups.d.ts +4 -4
  27. package/lib/api/Encryption.d.ts +2 -2
  28. package/lib/api/Files.d.ts +27 -52
  29. package/lib/api/FreeTrial.d.ts +2 -2
  30. package/lib/api/GroupsOwners.d.ts +2 -2
  31. package/lib/api/GroupsWorkflows.d.ts +2 -2
  32. package/lib/api/Integrations.d.ts +4 -4
  33. package/lib/api/Live.d.ts +1 -1
  34. package/lib/api/Preferences.d.ts +5 -5
  35. package/lib/api/Printing.d.ts +2 -2
  36. package/lib/api/Profile.d.ts +2 -2
  37. package/lib/api/Proofs.d.ts +18 -20
  38. package/lib/api/Proofs.js +1 -1
  39. package/lib/api/ProofsAssets.d.ts +1 -1
  40. package/lib/api/ProofsAssetsColorSeparations.d.ts +3 -3
  41. package/lib/api/ProofsAssetsExtractedText.d.ts +3 -3
  42. package/lib/api/ProofsAudit.d.ts +1 -1
  43. package/lib/api/ProofsCustomTools.d.ts +1 -1
  44. package/lib/api/ProofsDecisions.d.ts +4 -4
  45. package/lib/api/ProofsEditors.d.ts +6 -6
  46. package/lib/api/ProofsGroups.d.ts +14 -3
  47. package/lib/api/ProofsGroups.js +1 -1
  48. package/lib/api/ProofsIntegrationReferences.d.ts +4 -4
  49. package/lib/api/ProofsLinkCheck.d.ts +1 -1
  50. package/lib/api/ProofsOwners.d.ts +3 -3
  51. package/lib/api/ProofsReviewers.d.ts +2 -2
  52. package/lib/api/ProofsVersions.d.ts +2 -2
  53. package/lib/api/Reminders.d.ts +4 -4
  54. package/lib/api/Reports.d.ts +2 -2
  55. package/lib/api/Sessions.d.ts +1 -1
  56. package/lib/api/Teams.d.ts +1 -1
  57. package/lib/api/TeamsInvitations.d.ts +1 -1
  58. package/lib/api/Users.d.ts +10 -1
  59. package/lib/api/Users.js +1 -1
  60. package/lib/api/Workflows.d.ts +34 -34
  61. package/lib/api/WorkflowsSteps.d.ts +4 -4
  62. package/lib/api/admin/Admin.d.ts +1 -1
  63. package/lib/api/admin/Team.d.ts +1 -1
  64. package/lib/api/admin/TeamCustomTools.d.ts +1 -1
  65. package/lib/api/admin/TeamDashboard.d.ts +6 -6
  66. package/lib/api/admin/TeamDashboardGroups.d.ts +4 -4
  67. package/lib/api/admin/TeamFeatures.d.ts +19 -4
  68. package/lib/api/admin/TeamFeatures.js +34 -1
  69. package/lib/api/admin/TeamNotifications.d.ts +1 -1
  70. package/lib/api/admin/TeamPreferences.d.ts +1 -1
  71. package/lib/api/admin/TeamSCIM.d.ts +1 -1
  72. package/lib/api/admin/TeamUsers.d.ts +7 -7
  73. package/lib/api/admin/TeamWorkflows.d.ts +3 -3
  74. package/lib/api/brian/Brian.d.ts +1 -1
  75. package/lib/bluffer/Uint8ArrayBluffer.d.ts +1 -1
  76. package/lib/core/AdapterRepository.d.ts +3 -3
  77. package/lib/core/Cache.d.ts +2 -2
  78. package/lib/core/KeyPairs.d.ts +2 -2
  79. package/lib/core/PageProof.d.ts +21 -45
  80. package/lib/core/PageProof.js +1 -1
  81. package/lib/crypto/encryptComment.d.ts +1 -1
  82. package/lib/crypto/encryptFileBlock.js +1 -1
  83. package/lib/crypto/envelopes.d.ts +1 -1
  84. package/lib/events/EventEmitter.d.ts +1 -1
  85. package/lib/indexeddb-cache-adapter.js +1 -1
  86. package/lib/models/Comment.d.ts +4 -4
  87. package/lib/models/DecisionSummary.d.ts +2 -2
  88. package/lib/models/File.d.ts +5 -5
  89. package/lib/models/Preference.d.ts +1 -1
  90. package/lib/models/Proof.d.ts +19 -11
  91. package/lib/models/Proof.js +1 -1
  92. package/lib/models/ProofChecklist.d.ts +1 -1
  93. package/lib/models/ProofGroup.d.ts +1 -1
  94. package/lib/models/ProofIntegrationReference.d.ts +1 -1
  95. package/lib/models/ProofVersion.d.ts +1 -1
  96. package/lib/models/Reminder.d.ts +3 -3
  97. package/lib/models/ReportConfiguration.d.ts +1 -1
  98. package/lib/models/ReportField.d.ts +1 -1
  99. package/lib/models/Session.d.ts +5 -9
  100. package/lib/models/TeamAccountFeatures.d.ts +1 -1
  101. package/lib/models/TeamAddressBookFeatures.d.ts +1 -1
  102. package/lib/models/TeamCommentFeatures.d.ts +2 -2
  103. package/lib/models/TeamEmailFeatures.d.ts +1 -1
  104. package/lib/models/TeamFeatures.d.ts +1 -1
  105. package/lib/models/TeamGeneralFeatures.d.ts +1 -1
  106. package/lib/models/TeamIntelligenceFeatures.d.ts +43 -1
  107. package/lib/models/TeamIntelligenceFeatures.js +1 -1
  108. package/lib/models/TeamInvitation.d.ts +1 -1
  109. package/lib/models/TeamNotifications.d.ts +1 -1
  110. package/lib/models/TeamProofFeatures.d.ts +25 -1
  111. package/lib/models/TeamProofFeatures.js +1 -1
  112. package/lib/models/TeamUserGroupsFeatures.d.ts +1 -1
  113. package/lib/models/TeamWebhookFeatures.d.ts +1 -1
  114. package/lib/models/TeamWorkflowFeatures.d.ts +1 -1
  115. package/lib/models/User.d.ts +3 -3
  116. package/lib/models/Workflow.d.ts +3 -3
  117. package/lib/models/WorkflowStep.d.ts +7 -3
  118. package/lib/models/WorkflowUser.d.ts +11 -5
  119. package/lib/network/Request.d.ts +1 -1
  120. package/lib/network/Response.d.ts +39 -8
  121. package/lib/network/endpoints.json +12 -2
  122. package/lib/pageproof.js +1 -1
  123. package/lib/protobuf-adapter.js +1 -1
  124. package/lib/sync-crypto-adapter.js +1 -1
  125. package/lib/types/Comment.d.ts +6 -6
  126. package/lib/types/CommentImport.d.ts +3 -3
  127. package/lib/types/CommentTokenDefinition.d.ts +1 -1
  128. package/lib/types/DecisionOptions.d.ts +2 -2
  129. package/lib/types/Endpoint.d.ts +2 -2
  130. package/lib/types/FileV2.d.ts +3 -3
  131. package/lib/types/NudgedWorkflow.d.ts +1 -1
  132. package/lib/types/NudgedWorkflowsResult.d.ts +2 -2
  133. package/lib/types/Pin.d.ts +5 -5
  134. package/lib/types/PrintingJobOptions.d.ts +1 -1
  135. package/lib/types/PrintingOption.d.ts +2 -2
  136. package/lib/types/ReturnProofsResult.d.ts +2 -2
  137. package/lib/types/TeamDashboardPagination.d.ts +1 -1
  138. package/lib/types/TeamSenderEmail.d.ts +1 -1
  139. package/lib/types/WorkflowMetrics.d.ts +2 -2
  140. package/lib/types/WorkflowStepDefinition.d.ts +2 -2
  141. package/lib/types/WorkflowUserDefinition.d.ts +1 -4
  142. package/lib/util/Scheduler.d.ts +5 -5
  143. package/lib/util/comments/extractMentions.d.ts +1 -1
  144. package/lib/util/comments/v1-to-v2.d.ts +1 -0
  145. package/lib/util/comments/v1-to-v2.js +1 -0
  146. package/lib/util/creationToken.d.ts +1 -0
  147. package/lib/util/creationToken.js +1 -1
  148. package/lib/util/errorMessages.d.ts +1 -1
  149. package/lib/util/exports.js +1 -1
  150. package/lib/util/pins/parsePins.d.ts +1 -0
  151. package/lib/util/pins/parsePins.js +9 -1
  152. package/lib/util/pins/serializePins.d.ts +1 -0
  153. package/lib/util/pins/serializePins.js +4 -1
  154. package/lib/worker-crypto-adapter.js +1 -1
  155. package/lib/{worker.7844e467.js → worker.c898e379.js} +2 -2
  156. package/lib/xhr-request-adapter.js +1 -1
  157. package/package.json +19 -19
package/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## 2.12.0
2
+
3
+ Released on the 22nd of January 2026.
4
+
5
+ - [[PP-9564](https://pageproof.atlassian.net/browse/PP-9564)] Added support for PageProof Intelligence® feature flags, allowing teams to control PI insights across proofs, dashboard, and reports.
6
+
7
+ ## 2.11.0
8
+
9
+ Released on the 6th of January 2026.
10
+
11
+ - [[PP-9218](https://pageproof.atlassian.net/browse/PP-9218)] Added support for the collection status feature.
12
+
13
+ ## 2.10.1
14
+
15
+ Released on the 10th of December 2025.
16
+
17
+ - [[PP-8158](https://pageproof.atlassian.net/browse/PP-8158)] Bug fixes for the digital signing feature.
18
+
19
+ ## 2.10.0
20
+
21
+ Released on the 9th of December 2025.
22
+
23
+ - [[PP-8158](https://pageproof.atlassian.net/browse/PP-8158)] Added support for digital signing, including team settings for licensing, enabling, and setting default signing preferences, as well as re-authentication options.
24
+
25
+ ## 2.9.0
26
+
27
+ Released on the 1st of December 2025.
28
+
29
+ - [[PP-9177](https://pageproof.atlassian.net/browse/PP-9177)] Added support for team admin granular controls, allowing users to request specific role access permissions.
30
+
31
+ ## 2.8.1
32
+
33
+ Released on the 21st of November 2025.
34
+
35
+ - [[PP-9287](https://pageproof.atlassian.net/browse/PP-9287)] Bug fixes for scheduled proofs feature.
36
+
37
+ ## 2.8.0
38
+
39
+ Released on the 19th of November 2025.
40
+
41
+ - [[PP-9243](https://pageproof.atlassian.net/browse/PP-9243)] Updated core dependencies to the latest versions to improve stability, security, and performance.
42
+
1
43
  ## 2.7.0
2
44
 
3
45
  Released on the 11th of November 2025.
@@ -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: any;
60
- $scope: any;
61
- };
62
- /** @private */
63
- $scope: any;
64
- /** @private */
65
- $exceptionHandler: any;
53
+ $exceptionHandler: Function;
54
+ $scope: object;
55
+ });
66
56
  /** @private */
67
- onMethodFinally(): void;
57
+ private options;
68
58
  /** @private */
69
- onMethodReject({ rejected }: {
70
- rejected: any;
71
- }): void;
59
+ private $scope;
72
60
  /** @private */
73
- onMethodThrown({ error }: {
74
- error: any;
75
- }): void;
61
+ private $exceptionHandler;
76
62
  }
77
63
  import IEnhancementAdapter from "./IEnhancementAdapter";
@@ -2,7 +2,7 @@ export default IEnhancementAdapter;
2
2
  declare class IEnhancementAdapter {
3
3
  static __adapter__: string;
4
4
  /** @private */
5
- onClientReady(client: any): void;
5
+ private onClientReady;
6
6
  /**
7
7
  * Called before the method is enhanced.
8
8
  *
@@ -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
- get(key: any): any;
36
+ private options;
47
37
  /** @private */
48
- clear(): any;
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
- send(request: any, options?: {}, state?: {
44
- attempt: number;
45
- }): Promise<any>;
39
+ private options;
46
40
  }
47
41
  import IRequestAdapter from "./IRequestAdapter";
@@ -2,140 +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
- /**
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>;
139
5
  }
140
6
  import ICryptoAdapter from "./ICryptoAdapter";
141
7
  import Scheduler from "../util/Scheduler";
@@ -1,123 +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
- /**
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>;
122
3
  }
123
4
  import ICryptoAdapter from "./ICryptoAdapter";
@@ -8,10 +8,10 @@ declare class WorkerCryptoAdapter extends SchedulerCryptoAdapter {
8
8
  * @param {boolean} [options.optimistic]
9
9
  */
10
10
  constructor(options?: {
11
- url?: string;
12
- create?: Function;
13
- limit?: number;
14
- optimistic?: boolean;
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?: number;
10
- optimistic?: boolean;
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
- send(request: any, options?: {}): Promise<any>;
29
+ private options;
34
30
  }
35
31
  import IRequestAdapter from "./IRequestAdapter";
@@ -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
@@ -4,10 +4,10 @@ declare class API {
4
4
  * @private
5
5
  * @param {PageProof} client The parent PageProof client
6
6
  */
7
- constructor(client: any);
7
+ private constructor();
8
8
  /**
9
9
  * @type {PageProof}
10
10
  * @private
11
11
  */
12
- client: PageProof;
12
+ private client;
13
13
  }
@@ -1,7 +1,7 @@
1
1
  export default Accounts;
2
2
  declare class Accounts extends API {
3
3
  /** @private */
4
- constructor(client: any);
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(password: any): any;
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?: string;
61
- referrer?: string;
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
  *
@@ -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.");options={activationCode:options}}return this._generateCredentials(password).then(function(_ref2){var passwordHash=_ref2[0],keyPair=_ref2[1],privateKeyPEM$=_ref2[2];return Promise.all([keyPair,_this3.client.request("accounts.register",{email:email,password:passwordHash,privateKey:privateKeyPEM$,publicKey:keyPair.publicKeyPEM,referrer:options.referrer})])}).then(function(_ref3){var keyPair=_ref3[0];return Promise.all([keyPair,_this3.login(email,password,undefined,false)])}).then(function(_ref4){var keyPair=_ref4[0],session=_ref4[1];return Promise.all([keyPair,session,options.activationCode?_this3.activate(options.activationCode).catch(function(){return _this3.generateActivationCode()}):_this3.generateActivationCode()])}).then(function(_ref5){var keyPair=_ref5[0],session=_ref5[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.generateActivationCode=function generateActivationCode(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})};Accounts.prototype.activate=function activate(activationCode){var _this4=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:activationCode}).then(function(){_this4.client.session.user.hasActivated=true})};Accounts.prototype.login=function login(email,password,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.resetPassword=function resetPassword(_ref6){var _this6=this;var email=_ref6.email,code=_ref6.code,password=_ref6.password;return this._generateCredentials(password).then(function(_ref7){var passwordHash=_ref7[0],keyPair=_ref7[1],privateKeyPEM$=_ref7[2];return Promise.all([keyPair,_this6.client.request("accounts.reset-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref8){var keyPair=_ref8[0];return Promise.all([keyPair,_this6.login(email,password,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 _this7=this;var email=_ref10.email,code=_ref10.code,password=_ref10.password;return this._generateCredentials(password).then(function(_ref11){var passwordHash=_ref11[0],keyPair=_ref11[1],privateKeyPEM$=_ref11[2];return Promise.all([keyPair,_this7.client.request("accounts.set-password",{email:email,secret:code,newPassword:passwordHash,newPrivateKey:privateKeyPEM$,newPublicKey:keyPair.publicKeyPEM})])}).then(function(_ref12){var keyPair=_ref12[0];return Promise.all([keyPair,_this7.login(email,password,undefined,false)])}).then(function(_ref13){var keyPair=_ref13[0],session=_ref13[1];session.privateKeyPEM=keyPair.privateKeyPEM;return session})};Accounts.prototype.logout=function logout(){var _this8=this;return this.client.request("accounts.logout").catch(function(err){_this8.client.setSession(null);return Promise.reject(err)}).then(function(){_this8.client.setSession(null)})};return Accounts}(_API3.default);exports.default=Accounts;
1
+ "use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _Session=require("../models/Session");var _Session2=_interopRequireDefault(_Session);var _AccountsSSO=require("./AccountsSSO");var _AccountsSSO2=_interopRequireDefault(_AccountsSSO);var _AccountsMFA=require("./AccountsMFA");var _AccountsMFA2=_interopRequireDefault(_AccountsMFA);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var Accounts=function(_API){_inherits(Accounts,_API);function Accounts(client){_classCallCheck(this,Accounts);var _this=_possibleConstructorReturn(this,_API.call(this,client));_this.sso=new _AccountsSSO2.default(client);_this.mfa=new _AccountsMFA2.default(client);return _this}Accounts.prototype._generateCredentials=function _generateCredentials(password){var _this2=this;return this.client.crypto().generatePasswordHash(password).then(function(passwordHash){return Promise.all([passwordHash,_this2.client.crypto().generateKeyPair()])}).then(function(_ref){var passwordHash=_ref[0],keyPair=_ref[1];return Promise.all([passwordHash,keyPair,_this2.client.crypto().encryptPrivateKey(keyPair.privateKeyPEM,password)])})};Accounts.prototype.register=function register(email,password){var _this3=this;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};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;
@@ -1,6 +1,6 @@
1
1
  export default AccountsMFA;
2
2
  declare class AccountsMFA extends API {
3
- constructor(client: any);
3
+ private constructor();
4
4
  /**
5
5
  * Begins the setup for MFA (multi-factor authentication).
6
6
  *
@@ -13,22 +13,31 @@ export default AccountsSSO;
13
13
  * - Uses CryptoAlgorithm.RSA_OAEP for simple RSA or CryptoAlgorithm.RSA_AES_GCM for hybrid encryption
14
14
  */
15
15
  declare class AccountsSSO extends API {
16
- constructor(client: any);
16
+ private constructor();
17
17
  /**
18
18
  * @private
19
19
  * @returns {Promise<Session>}
20
20
  */
21
- getSession(): Promise<Session>;
21
+ private getSession;
22
22
  /**
23
23
  * @private
24
24
  * @returns {Promise<Array<SSOLoginOption>>}
25
25
  */
26
- getLoginOptions(email: any): Promise<SSOLoginOption[]>;
26
+ private getLoginOptions;
27
27
  /**
28
28
  * @private
29
29
  * @returns {Promise}
30
30
  */
31
- initiateLogin(email: any, sessionId: any, source: any): Promise<any>;
31
+ private initiateLogin;
32
+ /**
33
+ * Initiates a reauthentication flow for the given email.
34
+ * Returns login options for the user. If the user is configured for SSO, the appropriate URL
35
+ * will be returned, forcing the user to reauthenticate to the SSO provider.
36
+ *
37
+ * @param {string} email - The email of the user to reauthenticate
38
+ * @returns {Promise}
39
+ */
40
+ initiateReauthentication(email: string): Promise<any>;
32
41
  /**
33
42
  * Polls the status of a login using the device flow where authentication is completed via an isolated browser session.
34
43
  * If the authentication has been completed, a session token is returned which can be used to retrieve the session data.
@@ -44,7 +53,7 @@ declare class AccountsSSO extends API {
44
53
  * @param {string} source - The source id of your application
45
54
  * @returns {Promise<IsolatedLoginStatusResult>}
46
55
  */
47
- getIsolatedLoginStatus(email: string, sessionId: string, applicationId: any): Promise<IsolatedLoginStatusResult>;
56
+ private getIsolatedLoginStatus;
48
57
  /**
49
58
  * Retrieves the session data for an isolated login.
50
59
  * A session token is required to retrieve the session data. This is obtained from the {@link AccountsSSO#getIsolatedLoginStatus} method.
@@ -58,7 +67,6 @@ declare class AccountsSSO extends API {
58
67
  * @param {string} encryptedSessionToken - The nonce-encrypted session token, obtained from the {@link AccountsSSO#getIsolatedLoginStatus} method
59
68
  * @returns {Promise<Session>}
60
69
  */
61
- getIsolatedLoginSession(sessionId: string, applicationId: any, encryptedSessionToken: string): Promise<Session>;
70
+ private getIsolatedLoginSession;
62
71
  }
63
72
  import API from "./API";
64
- import Session from "../models/Session";