@passlock/client 0.9.19 → 0.9.21

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 (135) hide show
  1. package/dist/authentication/authenticate.d.ts +5 -4
  2. package/dist/authentication/authenticate.d.ts.map +1 -1
  3. package/dist/authentication/authenticate.fixture.d.ts +3 -4
  4. package/dist/authentication/authenticate.fixture.d.ts.map +1 -1
  5. package/dist/authentication/authenticate.fixture.js +2 -11
  6. package/dist/authentication/authenticate.fixture.js.map +1 -1
  7. package/dist/authentication/authenticate.js +4 -4
  8. package/dist/authentication/authenticate.js.map +1 -1
  9. package/dist/authentication/authenticate.test.js +5 -5
  10. package/dist/authentication/authenticate.test.js.map +1 -1
  11. package/dist/connection/connection.d.ts +4 -3
  12. package/dist/connection/connection.d.ts.map +1 -1
  13. package/dist/connection/connection.fixture.d.ts +3 -5
  14. package/dist/connection/connection.fixture.d.ts.map +1 -1
  15. package/dist/connection/connection.fixture.js +3 -15
  16. package/dist/connection/connection.fixture.js.map +1 -1
  17. package/dist/connection/connection.js +3 -3
  18. package/dist/connection/connection.js.map +1 -1
  19. package/dist/connection/connection.test.js +6 -5
  20. package/dist/connection/connection.test.js.map +1 -1
  21. package/dist/effect.d.ts +1 -1
  22. package/dist/effect.d.ts.map +1 -1
  23. package/dist/effect.js +17 -8
  24. package/dist/effect.js.map +1 -1
  25. package/dist/email/email.d.ts +4 -4
  26. package/dist/email/email.d.ts.map +1 -1
  27. package/dist/email/email.fixture.d.ts +2 -3
  28. package/dist/email/email.fixture.d.ts.map +1 -1
  29. package/dist/email/email.fixture.js +2 -10
  30. package/dist/email/email.fixture.js.map +1 -1
  31. package/dist/email/email.js +2 -3
  32. package/dist/email/email.js.map +1 -1
  33. package/dist/email/email.test.js +5 -5
  34. package/dist/email/email.test.js.map +1 -1
  35. package/dist/index.d.ts +4 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/logging/eventLogger.d.ts.map +1 -1
  39. package/dist/logging/eventLogger.js +15 -9
  40. package/dist/logging/eventLogger.js.map +1 -1
  41. package/dist/logging/eventLogger.test.js.map +1 -1
  42. package/dist/registration/register.d.ts +6 -4
  43. package/dist/registration/register.d.ts.map +1 -1
  44. package/dist/registration/register.fixture.d.ts +3 -4
  45. package/dist/registration/register.fixture.d.ts.map +1 -1
  46. package/dist/registration/register.fixture.js +2 -12
  47. package/dist/registration/register.fixture.js.map +1 -1
  48. package/dist/registration/register.js +5 -4
  49. package/dist/registration/register.js.map +1 -1
  50. package/dist/registration/register.test.js +6 -6
  51. package/dist/registration/register.test.js.map +1 -1
  52. package/dist/rpc/authentication.d.ts +9 -0
  53. package/dist/rpc/authentication.d.ts.map +1 -0
  54. package/dist/rpc/authentication.js +15 -0
  55. package/dist/rpc/authentication.js.map +1 -0
  56. package/dist/rpc/client.d.ts +27 -0
  57. package/dist/rpc/client.d.ts.map +1 -0
  58. package/dist/rpc/client.js +92 -0
  59. package/dist/rpc/client.js.map +1 -0
  60. package/dist/rpc/config.d.ts +16 -0
  61. package/dist/rpc/config.d.ts.map +1 -0
  62. package/dist/rpc/config.js +6 -0
  63. package/dist/rpc/config.js.map +1 -0
  64. package/dist/rpc/connection.d.ts +9 -0
  65. package/dist/rpc/connection.d.ts.map +1 -0
  66. package/dist/rpc/connection.js +14 -0
  67. package/dist/rpc/connection.js.map +1 -0
  68. package/dist/rpc/registration.d.ts +9 -0
  69. package/dist/rpc/registration.d.ts.map +1 -0
  70. package/dist/rpc/registration.js +15 -0
  71. package/dist/rpc/registration.js.map +1 -0
  72. package/dist/rpc/social.d.ts +11 -0
  73. package/dist/rpc/social.d.ts.map +1 -0
  74. package/dist/rpc/social.js +17 -0
  75. package/dist/rpc/social.js.map +1 -0
  76. package/dist/rpc/user.d.ts +9 -0
  77. package/dist/rpc/user.d.ts.map +1 -0
  78. package/dist/rpc/user.js +18 -0
  79. package/dist/rpc/user.js.map +1 -0
  80. package/dist/social/social.d.ts +4 -4
  81. package/dist/social/social.d.ts.map +1 -1
  82. package/dist/social/social.fixture.d.ts +1 -2
  83. package/dist/social/social.fixture.d.ts.map +1 -1
  84. package/dist/social/social.fixture.js +5 -14
  85. package/dist/social/social.fixture.js.map +1 -1
  86. package/dist/social/social.js +6 -6
  87. package/dist/social/social.js.map +1 -1
  88. package/dist/social/social.test.js +9 -9
  89. package/dist/social/social.test.js.map +1 -1
  90. package/dist/storage/storage.d.ts +1 -1
  91. package/dist/storage/storage.d.ts.map +1 -1
  92. package/dist/test/fixtures.d.ts +1 -3
  93. package/dist/test/fixtures.d.ts.map +1 -1
  94. package/dist/test/fixtures.js +0 -2
  95. package/dist/test/fixtures.js.map +1 -1
  96. package/dist/user/user.d.ts +4 -4
  97. package/dist/user/user.d.ts.map +1 -1
  98. package/dist/user/user.fixture.d.ts +2 -3
  99. package/dist/user/user.fixture.d.ts.map +1 -1
  100. package/dist/user/user.fixture.js +2 -10
  101. package/dist/user/user.fixture.js.map +1 -1
  102. package/dist/user/user.js +3 -4
  103. package/dist/user/user.js.map +1 -1
  104. package/dist/user/user.test.js +5 -5
  105. package/dist/user/user.test.js.map +1 -1
  106. package/dist/version.d.ts +2 -0
  107. package/dist/version.d.ts.map +1 -0
  108. package/dist/version.js +2 -0
  109. package/dist/version.js.map +1 -0
  110. package/package.json +10 -11
  111. package/src/authentication/authenticate.fixture.ts +8 -16
  112. package/src/authentication/authenticate.test.ts +7 -7
  113. package/src/authentication/authenticate.ts +13 -14
  114. package/src/connection/connection.fixture.ts +4 -16
  115. package/src/connection/connection.test.ts +7 -6
  116. package/src/connection/connection.ts +5 -5
  117. package/src/effect.ts +20 -14
  118. package/src/email/email.fixture.ts +3 -11
  119. package/src/email/email.test.ts +7 -7
  120. package/src/email/email.ts +5 -6
  121. package/src/index.ts +5 -2
  122. package/src/logging/eventLogger.test.ts +1 -0
  123. package/src/logging/eventLogger.ts +16 -10
  124. package/src/registration/register.fixture.ts +9 -18
  125. package/src/registration/register.test.ts +9 -9
  126. package/src/registration/register.ts +12 -13
  127. package/src/social/social.fixture.ts +7 -16
  128. package/src/social/social.test.ts +15 -15
  129. package/src/social/social.ts +9 -9
  130. package/src/storage/storage.ts +1 -1
  131. package/src/test/fixtures.ts +1 -3
  132. package/src/user/user.fixture.ts +3 -11
  133. package/src/user/user.test.ts +7 -7
  134. package/src/user/user.ts +6 -7
  135. package/README.md +0 -116
package/README.md DELETED
@@ -1,116 +0,0 @@
1
- <div align="center">
2
- <a href="https://github.com/passlock-dev/passkeys-frontend">
3
- <img src="https://github.com/passlock-dev/passkeys-frontend/assets/208345/53ee00d3-8e6c-49ea-b43c-3f901450c73b" alt="Passlock logo" width="80" height="80">
4
- </a>
5
- </div>
6
-
7
- <a name="readme-top"></a>
8
- <h1 align="center">Serverless Passkeys</h1>
9
-
10
- <p align="center">
11
- Passkey authentication for your web apps. Supports React, Angular, Vue, SvelteKit & others.
12
- <br />
13
- <a href="https://passlock.dev"><strong>Project website »</strong></a>
14
- <br />
15
- <a href="https://passlock.dev/#demo">Demo</a>
16
- ·
17
- <a href="https://docs.passlock.dev">Documentation</a>
18
- ·
19
- <a href="https://docs.passlock.dev/docs/tutorial/intro">Tutorial</a>
20
- </p>
21
- </div>
22
-
23
- <br />
24
-
25
- ## Features
26
-
27
- Passkeys and the WebAuthn API are quite complex. We've taken an opinionated approach to simplify things for you. Following the 80/20 principle we've tried to focus on the features most valuable to developers and users. We welcome feature requests so do [get in touch][contact].
28
-
29
- 1. **🔐 Primary & secondary authentication** - Replace password based logins with passkeys, or use passkeys alongside passwords for secondary authentication.
30
-
31
- 2. **☝🏻 Biometrics** - We've made it really easy to implement facial or fingerprint recognition in your webapps.
32
-
33
- 3. **🔐 Step up authentication** - Require biometric or PIN verification for some operations, whilst allowing one-tap authentication for others.
34
-
35
- 4. **🚀 Social login** - Quickly add social login to your web application.
36
-
37
- 5. **🖥️ Full management console** - Manage all security related aspects of your userbase through a web based console.
38
-
39
- 6. **🕵️ Audit trail** - View a full audit trail for each user: when they add a new passkey, when they login, verify their email address and much more.
40
-
41
- ## Screenshot
42
-
43
- ![Passlock user profile](https://github.com/passlock-dev/passkeys/assets/208345/a4a5c4b8-86cb-4076-bd26-7c29ed2151c6)
44
- <p align="center">Viewing a user's authentication activity on their profile page</p>
45
-
46
- ## Usage
47
-
48
- Use this library to generate a secure token, representing passkey registration or authentication. Send the token to your backend for verification (see below)
49
-
50
- ### Register a passkey
51
-
52
- ```typescript
53
- import { Passlock, PasslockError } from '@passlock/client'
54
-
55
- // you can find these details in the settings area of the Passlock console
56
- const tenancyId = '...'
57
- const clientId = '...'
58
-
59
- const passlock = new Passlock({ tenancyId, clientId })
60
-
61
- // to register a new passkey, call registerPasskey(). We're using placeholders for
62
- // the user data. You should grab this from an HTML form, React store, Redux etc.
63
- const [email, givenName, familyName] = ["jdoe@gmail.com", "John", "Doe"]
64
-
65
- // Passlock doesn't throw but instead returns a union: result | error
66
- const result = await passlock.registerPasskey({ email, givenName, familyName })
67
-
68
- // ensure Passlock didn't return an error
69
- if (!PasslockError.isError(result)) {
70
- // send the token to your backend (json/fetch or hidden form field etc)
71
- console.log('Token: %s', result.token)
72
- }
73
- ```
74
-
75
- ### Authenticate using a passkey
76
-
77
- ```typescript
78
- import { Passlock, PasslockError } from '@passlock/client'
79
-
80
- const tenancyId = '...'
81
- const clientId = '...'
82
-
83
- const passlock = new Passlock({ tenancyId, clientId })
84
- const result = await passlock.authenticatePasskey()
85
-
86
- if (!PasslockError.isError(result)) {
87
- // send the token to your backend for verification
88
- console.log('Token: %s', result.token)
89
- }
90
- ```
91
-
92
- ### Backend verification
93
-
94
- Verify the token and obtain the passkey registration or authentication details. You can make a simple GET request to `https://api.passlock.dev/{tenancyId}/token/{token}` or use the [@passlock/node][node] library:
95
-
96
- ```typescript
97
- import { Passlock } from '@passlock/node'
98
-
99
- // API Keys can be found in your passlock console
100
- const passlock = new Passlock({ tenancyId, apiKey })
101
-
102
- // token comes from your frontend
103
- const principal = await passlock.fetchPrincipal({ token })
104
-
105
- // get the user id
106
- console.log(principal.user.id)
107
- ```
108
-
109
- ## More information
110
-
111
- Please see the [tutorial][tutorial] and [documentation][docs]
112
-
113
- [contact]: https://passlock.dev/contact
114
- [tutorial]: https://docs.passlock.dev/docs/tutorial/intro
115
- [docs]: https://docs.passlock.dev
116
- [node]: https://www.npmjs.com/package/@passlock/node