@prove-identity/prove-auth 2.3.2

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 (85) hide show
  1. package/LICENSE +404 -0
  2. package/README.md +17 -0
  3. package/build/lib/index.d.ts +12 -0
  4. package/build/lib/index.js +47 -0
  5. package/build/lib/proveauth/auth-finish-step.d.ts +7 -0
  6. package/build/lib/proveauth/auth-finish-step.js +2 -0
  7. package/build/lib/proveauth/authenticator-builder.d.ts +42 -0
  8. package/build/lib/proveauth/authenticator-builder.js +126 -0
  9. package/build/lib/proveauth/authenticator.d.ts +12 -0
  10. package/build/lib/proveauth/authenticator.js +2 -0
  11. package/build/lib/proveauth/common/base64.d.ts +5 -0
  12. package/build/lib/proveauth/common/base64.js +19 -0
  13. package/build/lib/proveauth/common/cancelable-promise.d.ts +5 -0
  14. package/build/lib/proveauth/common/cancelable-promise.js +15 -0
  15. package/build/lib/proveauth/common/logger.d.ts +25 -0
  16. package/build/lib/proveauth/common/logger.js +85 -0
  17. package/build/lib/proveauth/instantlink.d.ts +4 -0
  18. package/build/lib/proveauth/instantlink.js +2 -0
  19. package/build/lib/proveauth/internal/auth-error.d.ts +7 -0
  20. package/build/lib/proveauth/internal/auth-error.js +27 -0
  21. package/build/lib/proveauth/internal/auth-message.d.ts +12 -0
  22. package/build/lib/proveauth/internal/auth-message.js +2 -0
  23. package/build/lib/proveauth/internal/auth-request.d.ts +90 -0
  24. package/build/lib/proveauth/internal/auth-request.js +2 -0
  25. package/build/lib/proveauth/internal/auth-response-status.d.ts +8 -0
  26. package/build/lib/proveauth/internal/auth-response-status.js +12 -0
  27. package/build/lib/proveauth/internal/auth-response.d.ts +61 -0
  28. package/build/lib/proveauth/internal/auth-response.js +2 -0
  29. package/build/lib/proveauth/internal/auth-session.d.ts +30 -0
  30. package/build/lib/proveauth/internal/auth-session.js +156 -0
  31. package/build/lib/proveauth/internal/auth-step.d.ts +5 -0
  32. package/build/lib/proveauth/internal/auth-step.js +2 -0
  33. package/build/lib/proveauth/internal/auth-token-claims.d.ts +46 -0
  34. package/build/lib/proveauth/internal/auth-token-claims.js +9 -0
  35. package/build/lib/proveauth/internal/base-authenticator.d.ts +28 -0
  36. package/build/lib/proveauth/internal/base-authenticator.js +129 -0
  37. package/build/lib/proveauth/internal/device-auth.d.ts +22 -0
  38. package/build/lib/proveauth/internal/device-auth.js +2 -0
  39. package/build/lib/proveauth/internal/device-passive-register-step.d.ts +10 -0
  40. package/build/lib/proveauth/internal/device-passive-register-step.js +97 -0
  41. package/build/lib/proveauth/internal/device-passive-silent-step.d.ts +10 -0
  42. package/build/lib/proveauth/internal/device-passive-silent-step.js +98 -0
  43. package/build/lib/proveauth/internal/device-passive-step.d.ts +17 -0
  44. package/build/lib/proveauth/internal/device-passive-step.js +133 -0
  45. package/build/lib/proveauth/internal/device-passive-stepup-step.d.ts +9 -0
  46. package/build/lib/proveauth/internal/device-passive-stepup-step.js +25 -0
  47. package/build/lib/proveauth/internal/device-passive-verify-step.d.ts +8 -0
  48. package/build/lib/proveauth/internal/device-passive-verify-step.js +54 -0
  49. package/build/lib/proveauth/internal/error-code.d.ts +9 -0
  50. package/build/lib/proveauth/internal/error-code.js +12 -0
  51. package/build/lib/proveauth/internal/mobile-instant-step.d.ts +15 -0
  52. package/build/lib/proveauth/internal/mobile-instant-step.js +100 -0
  53. package/build/lib/proveauth/internal/mobile-instantlink-step.d.ts +14 -0
  54. package/build/lib/proveauth/internal/mobile-instantlink-step.js +108 -0
  55. package/build/lib/proveauth/internal/mobile-otp-step.d.ts +14 -0
  56. package/build/lib/proveauth/internal/mobile-otp-step.js +141 -0
  57. package/build/lib/proveauth/internal/phone-number-input.d.ts +11 -0
  58. package/build/lib/proveauth/internal/phone-number-input.js +13 -0
  59. package/build/lib/proveauth/internal/platform.d.ts +45 -0
  60. package/build/lib/proveauth/internal/platform.js +20 -0
  61. package/build/lib/proveauth/internal/primary-authenticator.d.ts +14 -0
  62. package/build/lib/proveauth/internal/primary-authenticator.js +64 -0
  63. package/build/lib/proveauth/internal/report-error-step.d.ts +16 -0
  64. package/build/lib/proveauth/internal/report-error-step.js +88 -0
  65. package/build/lib/proveauth/internal/request-signer-v3.d.ts +10 -0
  66. package/build/lib/proveauth/internal/request-signer-v3.js +104 -0
  67. package/build/lib/proveauth/internal/scan-message-step.d.ts +11 -0
  68. package/build/lib/proveauth/internal/scan-message-step.js +45 -0
  69. package/build/lib/proveauth/internal/secondary-authenticator.d.ts +10 -0
  70. package/build/lib/proveauth/internal/secondary-authenticator.js +65 -0
  71. package/build/lib/proveauth/internal/settings.d.ts +18 -0
  72. package/build/lib/proveauth/internal/settings.js +50 -0
  73. package/build/lib/proveauth/internal/user-mobileactive-step.d.ts +7 -0
  74. package/build/lib/proveauth/internal/user-mobileactive-step.js +18 -0
  75. package/build/lib/proveauth/internal/user-present-step.d.ts +7 -0
  76. package/build/lib/proveauth/internal/user-present-step.js +18 -0
  77. package/build/lib/proveauth/internal/web-device-auth.d.ts +32 -0
  78. package/build/lib/proveauth/internal/web-device-auth.js +242 -0
  79. package/build/lib/proveauth/internal/web-platform.d.ts +30 -0
  80. package/build/lib/proveauth/internal/web-platform.js +160 -0
  81. package/build/lib/proveauth/otp.d.ts +23 -0
  82. package/build/lib/proveauth/otp.js +18 -0
  83. package/build/lib/proveauth/version.d.ts +3 -0
  84. package/build/lib/proveauth/version.js +6 -0
  85. package/package.json +75 -0
package/LICENSE ADDED
@@ -0,0 +1,404 @@
1
+ Attribution-NonCommercial-NoDerivatives 4.0 International
2
+
3
+ © 2024, Prove Identity, Inc. Distributed under Creative Commons Attribution NonCommercial NoDerivs 4.0 International License (CC BY-NC-ND 4.0).
4
+
5
+ =======================================================================
6
+
7
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
8
+ does not provide legal services or legal advice. Distribution of
9
+ Creative Commons public licenses does not create a lawyer-client or
10
+ other relationship. Creative Commons makes its licenses and related
11
+ information available on an "as-is" basis. Creative Commons gives no
12
+ warranties regarding its licenses, any material licensed under their
13
+ terms and conditions, or any related information. Creative Commons
14
+ disclaims all liability for damages resulting from their use to the
15
+ fullest extent possible.
16
+
17
+ Using Creative Commons Public Licenses
18
+
19
+ Creative Commons public licenses provide a standard set of terms and
20
+ conditions that creators and other rights holders may use to share
21
+ original works of authorship and other material subject to copyright
22
+ and certain other rights specified in the public license below. The
23
+ following considerations are for informational purposes only, are not
24
+ exhaustive, and do not form part of our licenses.
25
+
26
+ Considerations for licensors: Our public licenses are
27
+ intended for use by those authorized to give the public
28
+ permission to use material in ways otherwise restricted by
29
+ copyright and certain other rights. Our licenses are
30
+ irrevocable. Licensors should read and understand the terms
31
+ and conditions of the license they choose before applying it.
32
+ Licensors should also secure all rights necessary before
33
+ applying our licenses so that the public can reuse the
34
+ material as expected. Licensors should clearly mark any
35
+ material not subject to the license. This includes other CC-
36
+ licensed material, or material used under an exception or
37
+ limitation to copyright. More considerations for licensors:
38
+ wiki.creativecommons.org/Considerations_for_licensors
39
+
40
+ Considerations for the public: By using one of our public
41
+ licenses, a licensor grants the public permission to use the
42
+ licensed material under specified terms and conditions. If
43
+ the licensor's permission is not necessary for any reason--for
44
+ example, because of any applicable exception or limitation to
45
+ copyright--then that use is not regulated by the license. Our
46
+ licenses grant only permissions under copyright and certain
47
+ other rights that a licensor has authority to grant. Use of
48
+ the licensed material may still be restricted for other
49
+ reasons, including because others have copyright or other
50
+ rights in the material. A licensor may make special requests,
51
+ such as asking that all changes be marked or described.
52
+ Although not required by our licenses, you are encouraged to
53
+ respect those requests where reasonable. More considerations
54
+ for the public:
55
+ wiki.creativecommons.org/Considerations_for_licensees
56
+
57
+ =======================================================================
58
+
59
+ Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
60
+ International Public License
61
+
62
+ By exercising the Licensed Rights (defined below), You accept and agree
63
+ to be bound by the terms and conditions of this Creative Commons
64
+ Attribution-NonCommercial-NoDerivatives 4.0 International Public
65
+ License ("Public License"). To the extent this Public License may be
66
+ interpreted as a contract, You are granted the Licensed Rights in
67
+ consideration of Your acceptance of these terms and conditions, and the
68
+ Licensor grants You such rights in consideration of benefits the
69
+ Licensor receives from making the Licensed Material available under
70
+ these terms and conditions.
71
+
72
+
73
+ Section 1 -- Definitions.
74
+
75
+ a. Adapted Material means material subject to Copyright and Similar
76
+ Rights that is derived from or based upon the Licensed Material
77
+ and in which the Licensed Material is translated, altered,
78
+ arranged, transformed, or otherwise modified in a manner requiring
79
+ permission under the Copyright and Similar Rights held by the
80
+ Licensor. For purposes of this Public License, where the Licensed
81
+ Material is a musical work, performance, or sound recording,
82
+ Adapted Material is always produced where the Licensed Material is
83
+ synched in timed relation with a moving image.
84
+
85
+ b. Copyright and Similar Rights means copyright and/or similar rights
86
+ closely related to copyright including, without limitation,
87
+ performance, broadcast, sound recording, and Sui Generis Database
88
+ Rights, without regard to how the rights are labeled or
89
+ categorized. For purposes of this Public License, the rights
90
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
91
+ Rights.
92
+
93
+ c. Effective Technological Measures means those measures that, in the
94
+ absence of proper authority, may not be circumvented under laws
95
+ fulfilling obligations under Article 11 of the WIPO Copyright
96
+ Treaty adopted on December 20, 1996, and/or similar international
97
+ agreements.
98
+
99
+ d. Exceptions and Limitations means fair use, fair dealing, and/or
100
+ any other exception or limitation to Copyright and Similar Rights
101
+ that applies to Your use of the Licensed Material.
102
+
103
+ e. Licensed Material means the artistic or literary work, database,
104
+ or other material to which the Licensor applied this Public
105
+ License.
106
+
107
+ f. Licensed Rights means the rights granted to You subject to the
108
+ terms and conditions of this Public License, which are limited to
109
+ all Copyright and Similar Rights that apply to Your use of the
110
+ Licensed Material and that the Licensor has authority to license.
111
+
112
+ g. Licensor means the individual(s) or entity(ies) granting rights
113
+ under this Public License.
114
+
115
+ h. NonCommercial means not primarily intended for or directed towards
116
+ commercial advantage or monetary compensation. For purposes of
117
+ this Public License, the exchange of the Licensed Material for
118
+ other material subject to Copyright and Similar Rights by digital
119
+ file-sharing or similar means is NonCommercial provided there is
120
+ no payment of monetary compensation in connection with the
121
+ exchange.
122
+
123
+ i. Share means to provide material to the public by any means or
124
+ process that requires permission under the Licensed Rights, such
125
+ as reproduction, public display, public performance, distribution,
126
+ dissemination, communication, or importation, and to make material
127
+ available to the public including in ways that members of the
128
+ public may access the material from a place and at a time
129
+ individually chosen by them.
130
+
131
+ j. Sui Generis Database Rights means rights other than copyright
132
+ resulting from Directive 96/9/EC of the European Parliament and of
133
+ the Council of 11 March 1996 on the legal protection of databases,
134
+ as amended and/or succeeded, as well as other essentially
135
+ equivalent rights anywhere in the world.
136
+
137
+ k. You means the individual or entity exercising the Licensed Rights
138
+ under this Public License. Your has a corresponding meaning.
139
+
140
+
141
+ Section 2 -- Scope.
142
+
143
+ a. License grant.
144
+
145
+ 1. Subject to the terms and conditions of this Public License,
146
+ the Licensor hereby grants You a worldwide, royalty-free,
147
+ non-sublicensable, non-exclusive, irrevocable license to
148
+ exercise the Licensed Rights in the Licensed Material to:
149
+
150
+ a. reproduce and Share the Licensed Material, in whole or
151
+ in part, for NonCommercial purposes only; and
152
+
153
+ b. produce and reproduce, but not Share, Adapted Material
154
+ for NonCommercial purposes only.
155
+
156
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
157
+ Exceptions and Limitations apply to Your use, this Public
158
+ License does not apply, and You do not need to comply with
159
+ its terms and conditions.
160
+
161
+ 3. Term. The term of this Public License is specified in Section
162
+ 6(a).
163
+
164
+ 4. Media and formats; technical modifications allowed. The
165
+ Licensor authorizes You to exercise the Licensed Rights in
166
+ all media and formats whether now known or hereafter created,
167
+ and to make technical modifications necessary to do so. The
168
+ Licensor waives and/or agrees not to assert any right or
169
+ authority to forbid You from making technical modifications
170
+ necessary to exercise the Licensed Rights, including
171
+ technical modifications necessary to circumvent Effective
172
+ Technological Measures. For purposes of this Public License,
173
+ simply making modifications authorized by this Section 2(a)
174
+ (4) never produces Adapted Material.
175
+
176
+ 5. Downstream recipients.
177
+
178
+ a. Offer from the Licensor -- Licensed Material. Every
179
+ recipient of the Licensed Material automatically
180
+ receives an offer from the Licensor to exercise the
181
+ Licensed Rights under the terms and conditions of this
182
+ Public License.
183
+
184
+ b. No downstream restrictions. You may not offer or impose
185
+ any additional or different terms or conditions on, or
186
+ apply any Effective Technological Measures to, the
187
+ Licensed Material if doing so restricts exercise of the
188
+ Licensed Rights by any recipient of the Licensed
189
+ Material.
190
+
191
+ 6. No endorsement. Nothing in this Public License constitutes or
192
+ may be construed as permission to assert or imply that You
193
+ are, or that Your use of the Licensed Material is, connected
194
+ with, or sponsored, endorsed, or granted official status by,
195
+ the Licensor or others designated to receive attribution as
196
+ provided in Section 3(a)(1)(A)(i).
197
+
198
+ b. Other rights.
199
+
200
+ 1. Moral rights, such as the right of integrity, are not
201
+ licensed under this Public License, nor are publicity,
202
+ privacy, and/or other similar personality rights; however, to
203
+ the extent possible, the Licensor waives and/or agrees not to
204
+ assert any such rights held by the Licensor to the limited
205
+ extent necessary to allow You to exercise the Licensed
206
+ Rights, but not otherwise.
207
+
208
+ 2. Patent and trademark rights are not licensed under this
209
+ Public License.
210
+
211
+ 3. To the extent possible, the Licensor waives any right to
212
+ collect royalties from You for the exercise of the Licensed
213
+ Rights, whether directly or through a collecting society
214
+ under any voluntary or waivable statutory or compulsory
215
+ licensing scheme. In all other cases the Licensor expressly
216
+ reserves any right to collect such royalties, including when
217
+ the Licensed Material is used other than for NonCommercial
218
+ purposes.
219
+
220
+
221
+ Section 3 -- License Conditions.
222
+
223
+ Your exercise of the Licensed Rights is expressly made subject to the
224
+ following conditions.
225
+
226
+ a. Attribution.
227
+
228
+ 1. If You Share the Licensed Material, You must:
229
+
230
+ a. retain the following if it is supplied by the Licensor
231
+ with the Licensed Material:
232
+
233
+ i. identification of the creator(s) of the Licensed
234
+ Material and any others designated to receive
235
+ attribution, in any reasonable manner requested by
236
+ the Licensor (including by pseudonym if
237
+ designated);
238
+
239
+ ii. a copyright notice;
240
+
241
+ iii. a notice that refers to this Public License;
242
+
243
+ iv. a notice that refers to the disclaimer of
244
+ warranties;
245
+
246
+ v. a URI or hyperlink to the Licensed Material to the
247
+ extent reasonably practicable;
248
+
249
+ b. indicate if You modified the Licensed Material and
250
+ retain an indication of any previous modifications; and
251
+
252
+ c. indicate the Licensed Material is licensed under this
253
+ Public License, and include the text of, or the URI or
254
+ hyperlink to, this Public License.
255
+
256
+ For the avoidance of doubt, You do not have permission under
257
+ this Public License to Share Adapted Material.
258
+
259
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
260
+ reasonable manner based on the medium, means, and context in
261
+ which You Share the Licensed Material. For example, it may be
262
+ reasonable to satisfy the conditions by providing a URI or
263
+ hyperlink to a resource that includes the required
264
+ information.
265
+
266
+ 3. If requested by the Licensor, You must remove any of the
267
+ information required by Section 3(a)(1)(A) to the extent
268
+ reasonably practicable.
269
+
270
+
271
+ Section 4 -- Sui Generis Database Rights.
272
+
273
+ Where the Licensed Rights include Sui Generis Database Rights that
274
+ apply to Your use of the Licensed Material:
275
+
276
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
277
+ to extract, reuse, reproduce, and Share all or a substantial
278
+ portion of the contents of the database for NonCommercial purposes
279
+ only and provided You do not Share Adapted Material;
280
+
281
+ b. if You include all or a substantial portion of the database
282
+ contents in a database in which You have Sui Generis Database
283
+ Rights, then the database in which You have Sui Generis Database
284
+ Rights (but not its individual contents) is Adapted Material; and
285
+
286
+ c. You must comply with the conditions in Section 3(a) if You Share
287
+ all or a substantial portion of the contents of the database.
288
+
289
+ For the avoidance of doubt, this Section 4 supplements and does not
290
+ replace Your obligations under this Public License where the Licensed
291
+ Rights include other Copyright and Similar Rights.
292
+
293
+
294
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
295
+
296
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
297
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
298
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
299
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
300
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
301
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
302
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
303
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
304
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
305
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
306
+
307
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
308
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
309
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
310
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
311
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
312
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
313
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
314
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
315
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
316
+
317
+ c. The disclaimer of warranties and limitation of liability provided
318
+ above shall be interpreted in a manner that, to the extent
319
+ possible, most closely approximates an absolute disclaimer and
320
+ waiver of all liability.
321
+
322
+
323
+ Section 6 -- Term and Termination.
324
+
325
+ a. This Public License applies for the term of the Copyright and
326
+ Similar Rights licensed here. However, if You fail to comply with
327
+ this Public License, then Your rights under this Public License
328
+ terminate automatically.
329
+
330
+ b. Where Your right to use the Licensed Material has terminated under
331
+ Section 6(a), it reinstates:
332
+
333
+ 1. automatically as of the date the violation is cured, provided
334
+ it is cured within 30 days of Your discovery of the
335
+ violation; or
336
+
337
+ 2. upon express reinstatement by the Licensor.
338
+
339
+ For the avoidance of doubt, this Section 6(b) does not affect any
340
+ right the Licensor may have to seek remedies for Your violations
341
+ of this Public License.
342
+
343
+ c. For the avoidance of doubt, the Licensor may also offer the
344
+ Licensed Material under separate terms or conditions or stop
345
+ distributing the Licensed Material at any time; however, doing so
346
+ will not terminate this Public License.
347
+
348
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
349
+ License.
350
+
351
+
352
+ Section 7 -- Other Terms and Conditions.
353
+
354
+ a. The Licensor shall not be bound by any additional or different
355
+ terms or conditions communicated by You unless expressly agreed.
356
+
357
+ b. Any arrangements, understandings, or agreements regarding the
358
+ Licensed Material not stated herein are separate from and
359
+ independent of the terms and conditions of this Public License.
360
+
361
+
362
+ Section 8 -- Interpretation.
363
+
364
+ a. For the avoidance of doubt, this Public License does not, and
365
+ shall not be interpreted to, reduce, limit, restrict, or impose
366
+ conditions on any use of the Licensed Material that could lawfully
367
+ be made without permission under this Public License.
368
+
369
+ b. To the extent possible, if any provision of this Public License is
370
+ deemed unenforceable, it shall be automatically reformed to the
371
+ minimum extent necessary to make it enforceable. If the provision
372
+ cannot be reformed, it shall be severed from this Public License
373
+ without affecting the enforceability of the remaining terms and
374
+ conditions.
375
+
376
+ c. No term or condition of this Public License will be waived and no
377
+ failure to comply consented to unless expressly agreed to by the
378
+ Licensor.
379
+
380
+ d. Nothing in this Public License constitutes or may be interpreted
381
+ as a limitation upon, or waiver of, any privileges and immunities
382
+ that apply to the Licensor or You, including from the legal
383
+ processes of any jurisdiction or authority.
384
+
385
+ =======================================================================
386
+
387
+ Creative Commons is not a party to its public
388
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
389
+ its public licenses to material it publishes and in those instances
390
+ will be considered the “Licensor.” The text of the Creative Commons
391
+ public licenses is dedicated to the public domain under the CC0 Public
392
+ Domain Dedication. Except for the limited purpose of indicating that
393
+ material is shared under a Creative Commons public license or as
394
+ otherwise permitted by the Creative Commons policies published at
395
+ creativecommons.org/policies, Creative Commons does not authorize the
396
+ use of the trademark "Creative Commons" or any other trademark or logo
397
+ of Creative Commons without its prior written consent including,
398
+ without limitation, in connection with any unauthorized modifications
399
+ to any of its public licenses or any other arrangements,
400
+ understandings, or agreements concerning use of licensed material. For
401
+ the avoidance of doubt, this paragraph does not form part of the
402
+ public licenses.
403
+
404
+ Creative Commons may be contacted at creativecommons.org.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Prove Auth Web SDK
2
+
3
+ This SDK provides JavaScript client API to the Prove's authentication platform Prove Auth.
4
+
5
+ ## Building
6
+
7
+ - Make sure you have Node JS, npm, TypeScript installed:
8
+ - Install node, preferably using nvm, current stable version is v20.2.0
9
+ - Make sure to uninstall any old version on TypeScript compiler - `npm uninstall tpc`
10
+ - Install TypeScript `npm install typescript`
11
+ - Build the project from your IDE or CLI - `npm run build`
12
+
13
+ ## Running Samples
14
+
15
+ - Build the sdk first, then build the sample code:
16
+ - Build SDK web bundle - `npm run clean && npm run build && npm run bundle-dev`
17
+ - Build and start sample code - `cd samples/basic; npm run build && npm run serve`
@@ -0,0 +1,12 @@
1
+ import { VERSION } from './proveauth/version';
2
+ import AuthenticatorBuilder, { AuthMessageHandler, DeviceRole, MobileAuthImplementation } from './proveauth/authenticator-builder';
3
+ import AuthMessage from './proveauth/internal/auth-message';
4
+ import { AuthResponseStatus } from './proveauth/internal/auth-response-status';
5
+ import { LoggerFactory, LogWriter, LogLevel, Logger } from './proveauth/common/logger';
6
+ import CancelablePromise from './proveauth/common/cancelable-promise';
7
+ import AuthFinishStep, { AuthFinishStepFn, AuthFinishStepInput } from './proveauth/auth-finish-step';
8
+ import Authenticator from './proveauth/authenticator';
9
+ import { PhoneValidationError } from './proveauth/internal/phone-number-input';
10
+ import { OtpError, OtpStartStep, OtpStartInput, OtpStartStepFn, OtpFinishStep, OtpFinishInput, OtpFinishStepFn, OtpFinishResult, OtpFinishResultType } from './proveauth/otp';
11
+ import { InstantLinkStartInput, InstantLinkStartStep, InstantLinkStartStepFn } from './proveauth/instantlink';
12
+ export { VERSION, AuthFinishStep, AuthFinishStepFn, AuthFinishStepInput, Authenticator, AuthenticatorBuilder, AuthMessage, AuthMessageHandler, AuthResponseStatus, CancelablePromise, DeviceRole, InstantLinkStartStep, InstantLinkStartInput, InstantLinkStartStepFn, Logger, LoggerFactory, LogLevel, LogWriter, MobileAuthImplementation, OtpFinishStep, OtpFinishInput, OtpFinishResult, OtpFinishStepFn, OtpFinishResultType, OtpStartStep, OtpStartInput, OtpStartStepFn, OtpError, PhoneValidationError, };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.PhoneValidationError = exports.OtpError = exports.OtpFinishResultType = exports.MobileAuthImplementation = exports.LogLevel = exports.LoggerFactory = exports.DeviceRole = exports.CancelablePromise = exports.AuthResponseStatus = exports.AuthenticatorBuilder = exports.VERSION = void 0;
30
+ const version_1 = require("./proveauth/version");
31
+ Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
32
+ const authenticator_builder_1 = __importStar(require("./proveauth/authenticator-builder"));
33
+ exports.AuthenticatorBuilder = authenticator_builder_1.default;
34
+ Object.defineProperty(exports, "DeviceRole", { enumerable: true, get: function () { return authenticator_builder_1.DeviceRole; } });
35
+ Object.defineProperty(exports, "MobileAuthImplementation", { enumerable: true, get: function () { return authenticator_builder_1.MobileAuthImplementation; } });
36
+ const auth_response_status_1 = require("./proveauth/internal/auth-response-status");
37
+ Object.defineProperty(exports, "AuthResponseStatus", { enumerable: true, get: function () { return auth_response_status_1.AuthResponseStatus; } });
38
+ const logger_1 = require("./proveauth/common/logger");
39
+ Object.defineProperty(exports, "LoggerFactory", { enumerable: true, get: function () { return logger_1.LoggerFactory; } });
40
+ Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return logger_1.LogLevel; } });
41
+ const cancelable_promise_1 = __importDefault(require("./proveauth/common/cancelable-promise"));
42
+ exports.CancelablePromise = cancelable_promise_1.default;
43
+ const phone_number_input_1 = require("./proveauth/internal/phone-number-input");
44
+ Object.defineProperty(exports, "PhoneValidationError", { enumerable: true, get: function () { return phone_number_input_1.PhoneValidationError; } });
45
+ const otp_1 = require("./proveauth/otp");
46
+ Object.defineProperty(exports, "OtpError", { enumerable: true, get: function () { return otp_1.OtpError; } });
47
+ Object.defineProperty(exports, "OtpFinishResultType", { enumerable: true, get: function () { return otp_1.OtpFinishResultType; } });
@@ -0,0 +1,7 @@
1
+ export interface AuthFinishStepInput {
2
+ readonly authId: string;
3
+ }
4
+ export default interface AuthFinishStep {
5
+ execute: (input: AuthFinishStepInput) => Promise<void>;
6
+ }
7
+ export type AuthFinishStepFn = (input: AuthFinishStepInput) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,42 @@
1
+ import Authenticator from './authenticator';
2
+ import AuthFinishStep, { AuthFinishStepFn } from './auth-finish-step';
3
+ import AuthMessage from './internal/auth-message';
4
+ import { AuthResponseStatus } from './internal/auth-response-status';
5
+ import Platform from './internal/platform';
6
+ import { OtpFinishStep, OtpFinishStepFn, OtpStartStep, OtpStartStepFn } from './otp';
7
+ import { InstantLinkStartStep, InstantLinkStartStepFn } from './instantlink';
8
+ export type AuthMessageHandler = (message: AuthMessage) => Promise<AuthResponseStatus>;
9
+ export declare enum DeviceRole {
10
+ Primary = 0,
11
+ Secondary = 1
12
+ }
13
+ export declare enum MobileAuthImplementation {
14
+ Pixel = "pixel",
15
+ Fetch = "fetch"
16
+ }
17
+ export default class AuthenticatorBuilder {
18
+ private role;
19
+ private mobileAuthImplementation;
20
+ private authFinishStep?;
21
+ private getDisplayName?;
22
+ private getDeviceIp?;
23
+ private authMessageHandler?;
24
+ private storage?;
25
+ private platform?;
26
+ private otpStartStep?;
27
+ private otpFinishStep?;
28
+ private instantLinkStartStep?;
29
+ private instantLinkTestMode;
30
+ constructor();
31
+ withAuthFinishStep(step: AuthFinishStep | AuthFinishStepFn): AuthenticatorBuilder;
32
+ withDisplayName(displayName: string | (() => string | null) | null): AuthenticatorBuilder;
33
+ withAuthMessageHandler(handler: AuthMessageHandler): AuthenticatorBuilder;
34
+ withStorage(storage: Storage): AuthenticatorBuilder;
35
+ withPlatform(platform: Platform): AuthenticatorBuilder;
36
+ withRole(role: DeviceRole): AuthenticatorBuilder;
37
+ withMobileAuthImplementation(implementation: MobileAuthImplementation): AuthenticatorBuilder;
38
+ withDeviceIpAddress(deviceIp: string | (() => string | null) | null): AuthenticatorBuilder;
39
+ withOtpFallback(startStep: OtpStartStep | OtpStartStepFn, finishStep: OtpFinishStep | OtpFinishStepFn): AuthenticatorBuilder;
40
+ withInstantLinkFallback(startStep: InstantLinkStartStep | InstantLinkStartStepFn): AuthenticatorBuilder;
41
+ build(): Authenticator;
42
+ }
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MobileAuthImplementation = exports.DeviceRole = void 0;
7
+ const primary_authenticator_1 = __importDefault(require("./internal/primary-authenticator"));
8
+ const web_platform_1 = require("./internal/web-platform");
9
+ const device_passive_register_step_1 = __importDefault(require("./internal/device-passive-register-step"));
10
+ const device_passive_step_1 = __importDefault(require("./internal/device-passive-step"));
11
+ const device_passive_verify_step_1 = __importDefault(require("./internal/device-passive-verify-step"));
12
+ const mobile_instant_step_1 = __importDefault(require("./internal/mobile-instant-step"));
13
+ const mobile_instantlink_step_1 = __importDefault(require("./internal/mobile-instantlink-step"));
14
+ const mobile_otp_step_1 = __importDefault(require("./internal/mobile-otp-step"));
15
+ const scan_message_step_1 = __importDefault(require("./internal/scan-message-step"));
16
+ const user_mobileactive_step_1 = __importDefault(require("./internal/user-mobileactive-step"));
17
+ const secondary_authenticator_1 = __importDefault(require("./internal/secondary-authenticator"));
18
+ const device_passive_silent_step_1 = __importDefault(require("./internal/device-passive-silent-step"));
19
+ const device_passive_stepup_step_1 = __importDefault(require("./internal/device-passive-stepup-step"));
20
+ var DeviceRole;
21
+ (function (DeviceRole) {
22
+ DeviceRole[DeviceRole["Primary"] = 0] = "Primary";
23
+ DeviceRole[DeviceRole["Secondary"] = 1] = "Secondary";
24
+ })(DeviceRole = exports.DeviceRole || (exports.DeviceRole = {}));
25
+ var MobileAuthImplementation;
26
+ (function (MobileAuthImplementation) {
27
+ MobileAuthImplementation["Pixel"] = "pixel";
28
+ MobileAuthImplementation["Fetch"] = "fetch";
29
+ })(MobileAuthImplementation = exports.MobileAuthImplementation || (exports.MobileAuthImplementation = {}));
30
+ class AuthenticatorBuilder {
31
+ constructor() {
32
+ this.role = DeviceRole.Primary;
33
+ this.mobileAuthImplementation = MobileAuthImplementation.Fetch;
34
+ this.instantLinkTestMode = false;
35
+ if (typeof window !== 'undefined') {
36
+ this.storage = window.localStorage;
37
+ this.platform = new web_platform_1.WebPlatform();
38
+ }
39
+ }
40
+ withAuthFinishStep(step) {
41
+ if (typeof step === 'function') {
42
+ this.authFinishStep = {
43
+ execute: (input) => step(input),
44
+ };
45
+ }
46
+ else {
47
+ this.authFinishStep = step;
48
+ }
49
+ return this;
50
+ }
51
+ withDisplayName(displayName) {
52
+ this.getDisplayName = typeof displayName === 'function' ? displayName : () => displayName;
53
+ return this;
54
+ }
55
+ withAuthMessageHandler(handler) {
56
+ this.authMessageHandler = handler;
57
+ return this;
58
+ }
59
+ withStorage(storage) {
60
+ this.storage = storage;
61
+ return this;
62
+ }
63
+ withPlatform(platform) {
64
+ this.platform = platform;
65
+ return this;
66
+ }
67
+ withRole(role) {
68
+ this.role = role;
69
+ return this;
70
+ }
71
+ withMobileAuthImplementation(implementation) {
72
+ this.mobileAuthImplementation = implementation;
73
+ return this;
74
+ }
75
+ withDeviceIpAddress(deviceIp) {
76
+ this.getDeviceIp = typeof deviceIp === 'function' ? deviceIp : () => deviceIp;
77
+ return this;
78
+ }
79
+ withOtpFallback(startStep, finishStep) {
80
+ if (typeof startStep === 'function') {
81
+ this.otpStartStep = { execute: startStep };
82
+ }
83
+ else {
84
+ this.otpStartStep = startStep;
85
+ }
86
+ if (typeof finishStep === 'function') {
87
+ this.otpFinishStep = { execute: finishStep };
88
+ }
89
+ else {
90
+ this.otpFinishStep = finishStep;
91
+ }
92
+ return this;
93
+ }
94
+ withInstantLinkFallback(startStep) {
95
+ if (typeof startStep === 'function') {
96
+ this.instantLinkStartStep = { execute: startStep };
97
+ }
98
+ else {
99
+ this.instantLinkStartStep = startStep;
100
+ }
101
+ return this;
102
+ }
103
+ build() {
104
+ if (this.role === DeviceRole.Primary) {
105
+ return new primary_authenticator_1.default(this.platform, this.storage, this.authFinishStep, [
106
+ new device_passive_step_1.default(this.getDisplayName, this.role),
107
+ new device_passive_stepup_step_1.default(this.getDisplayName),
108
+ new device_passive_silent_step_1.default(),
109
+ new device_passive_register_step_1.default(),
110
+ new device_passive_verify_step_1.default(),
111
+ new mobile_instant_step_1.default(this.mobileAuthImplementation, this.getDeviceIp),
112
+ new mobile_otp_step_1.default(this.otpStartStep, this.otpFinishStep),
113
+ new user_mobileactive_step_1.default(),
114
+ new scan_message_step_1.default(this.authMessageHandler),
115
+ ]);
116
+ }
117
+ else {
118
+ return new secondary_authenticator_1.default(this.platform, this.storage, this.authFinishStep, [
119
+ new device_passive_step_1.default(this.getDisplayName, this.role),
120
+ new mobile_instant_step_1.default(this.mobileAuthImplementation, this.getDeviceIp),
121
+ new mobile_instantlink_step_1.default(this.instantLinkStartStep, this.getDeviceIp),
122
+ ]);
123
+ }
124
+ }
125
+ }
126
+ exports.default = AuthenticatorBuilder;