@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.
- package/dist/authentication/authenticate.d.ts +5 -4
- package/dist/authentication/authenticate.d.ts.map +1 -1
- package/dist/authentication/authenticate.fixture.d.ts +3 -4
- package/dist/authentication/authenticate.fixture.d.ts.map +1 -1
- package/dist/authentication/authenticate.fixture.js +2 -11
- package/dist/authentication/authenticate.fixture.js.map +1 -1
- package/dist/authentication/authenticate.js +4 -4
- package/dist/authentication/authenticate.js.map +1 -1
- package/dist/authentication/authenticate.test.js +5 -5
- package/dist/authentication/authenticate.test.js.map +1 -1
- package/dist/connection/connection.d.ts +4 -3
- package/dist/connection/connection.d.ts.map +1 -1
- package/dist/connection/connection.fixture.d.ts +3 -5
- package/dist/connection/connection.fixture.d.ts.map +1 -1
- package/dist/connection/connection.fixture.js +3 -15
- package/dist/connection/connection.fixture.js.map +1 -1
- package/dist/connection/connection.js +3 -3
- package/dist/connection/connection.js.map +1 -1
- package/dist/connection/connection.test.js +6 -5
- package/dist/connection/connection.test.js.map +1 -1
- package/dist/effect.d.ts +1 -1
- package/dist/effect.d.ts.map +1 -1
- package/dist/effect.js +17 -8
- package/dist/effect.js.map +1 -1
- package/dist/email/email.d.ts +4 -4
- package/dist/email/email.d.ts.map +1 -1
- package/dist/email/email.fixture.d.ts +2 -3
- package/dist/email/email.fixture.d.ts.map +1 -1
- package/dist/email/email.fixture.js +2 -10
- package/dist/email/email.fixture.js.map +1 -1
- package/dist/email/email.js +2 -3
- package/dist/email/email.js.map +1 -1
- package/dist/email/email.test.js +5 -5
- package/dist/email/email.test.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logging/eventLogger.d.ts.map +1 -1
- package/dist/logging/eventLogger.js +15 -9
- package/dist/logging/eventLogger.js.map +1 -1
- package/dist/logging/eventLogger.test.js.map +1 -1
- package/dist/registration/register.d.ts +6 -4
- package/dist/registration/register.d.ts.map +1 -1
- package/dist/registration/register.fixture.d.ts +3 -4
- package/dist/registration/register.fixture.d.ts.map +1 -1
- package/dist/registration/register.fixture.js +2 -12
- package/dist/registration/register.fixture.js.map +1 -1
- package/dist/registration/register.js +5 -4
- package/dist/registration/register.js.map +1 -1
- package/dist/registration/register.test.js +6 -6
- package/dist/registration/register.test.js.map +1 -1
- package/dist/rpc/authentication.d.ts +9 -0
- package/dist/rpc/authentication.d.ts.map +1 -0
- package/dist/rpc/authentication.js +15 -0
- package/dist/rpc/authentication.js.map +1 -0
- package/dist/rpc/client.d.ts +27 -0
- package/dist/rpc/client.d.ts.map +1 -0
- package/dist/rpc/client.js +92 -0
- package/dist/rpc/client.js.map +1 -0
- package/dist/rpc/config.d.ts +16 -0
- package/dist/rpc/config.d.ts.map +1 -0
- package/dist/rpc/config.js +6 -0
- package/dist/rpc/config.js.map +1 -0
- package/dist/rpc/connection.d.ts +9 -0
- package/dist/rpc/connection.d.ts.map +1 -0
- package/dist/rpc/connection.js +14 -0
- package/dist/rpc/connection.js.map +1 -0
- package/dist/rpc/registration.d.ts +9 -0
- package/dist/rpc/registration.d.ts.map +1 -0
- package/dist/rpc/registration.js +15 -0
- package/dist/rpc/registration.js.map +1 -0
- package/dist/rpc/social.d.ts +11 -0
- package/dist/rpc/social.d.ts.map +1 -0
- package/dist/rpc/social.js +17 -0
- package/dist/rpc/social.js.map +1 -0
- package/dist/rpc/user.d.ts +9 -0
- package/dist/rpc/user.d.ts.map +1 -0
- package/dist/rpc/user.js +18 -0
- package/dist/rpc/user.js.map +1 -0
- package/dist/social/social.d.ts +4 -4
- package/dist/social/social.d.ts.map +1 -1
- package/dist/social/social.fixture.d.ts +1 -2
- package/dist/social/social.fixture.d.ts.map +1 -1
- package/dist/social/social.fixture.js +5 -14
- package/dist/social/social.fixture.js.map +1 -1
- package/dist/social/social.js +6 -6
- package/dist/social/social.js.map +1 -1
- package/dist/social/social.test.js +9 -9
- package/dist/social/social.test.js.map +1 -1
- package/dist/storage/storage.d.ts +1 -1
- package/dist/storage/storage.d.ts.map +1 -1
- package/dist/test/fixtures.d.ts +1 -3
- package/dist/test/fixtures.d.ts.map +1 -1
- package/dist/test/fixtures.js +0 -2
- package/dist/test/fixtures.js.map +1 -1
- package/dist/user/user.d.ts +4 -4
- package/dist/user/user.d.ts.map +1 -1
- package/dist/user/user.fixture.d.ts +2 -3
- package/dist/user/user.fixture.d.ts.map +1 -1
- package/dist/user/user.fixture.js +2 -10
- package/dist/user/user.fixture.js.map +1 -1
- package/dist/user/user.js +3 -4
- package/dist/user/user.js.map +1 -1
- package/dist/user/user.test.js +5 -5
- package/dist/user/user.test.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +10 -11
- package/src/authentication/authenticate.fixture.ts +8 -16
- package/src/authentication/authenticate.test.ts +7 -7
- package/src/authentication/authenticate.ts +13 -14
- package/src/connection/connection.fixture.ts +4 -16
- package/src/connection/connection.test.ts +7 -6
- package/src/connection/connection.ts +5 -5
- package/src/effect.ts +20 -14
- package/src/email/email.fixture.ts +3 -11
- package/src/email/email.test.ts +7 -7
- package/src/email/email.ts +5 -6
- package/src/index.ts +5 -2
- package/src/logging/eventLogger.test.ts +1 -0
- package/src/logging/eventLogger.ts +16 -10
- package/src/registration/register.fixture.ts +9 -18
- package/src/registration/register.test.ts +9 -9
- package/src/registration/register.ts +12 -13
- package/src/social/social.fixture.ts +7 -16
- package/src/social/social.test.ts +15 -15
- package/src/social/social.ts +9 -9
- package/src/storage/storage.ts +1 -1
- package/src/test/fixtures.ts +1 -3
- package/src/user/user.fixture.ts +3 -11
- package/src/user/user.test.ts +7 -7
- package/src/user/user.ts +6 -7
- 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
|
-

|
|
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
|