@passlock/client 0.9.19 → 0.9.22
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/README.md +30 -21
- 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/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/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/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/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/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/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/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 +24 -23
- 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/dist/authentication/authenticate.test.d.ts +0 -2
- package/dist/authentication/authenticate.test.d.ts.map +0 -1
- package/dist/authentication/authenticate.test.js +0 -111
- package/dist/authentication/authenticate.test.js.map +0 -1
- package/dist/connection/connection.test.d.ts +0 -2
- package/dist/connection/connection.test.d.ts.map +0 -1
- package/dist/connection/connection.test.js +0 -35
- package/dist/connection/connection.test.js.map +0 -1
- package/dist/email/email.test.d.ts +0 -2
- package/dist/email/email.test.d.ts.map +0 -1
- package/dist/email/email.test.js +0 -99
- package/dist/email/email.test.js.map +0 -1
- package/dist/event/event.node.test.d.ts +0 -2
- package/dist/event/event.node.test.d.ts.map +0 -1
- package/dist/event/event.node.test.js +0 -13
- package/dist/event/event.node.test.js.map +0 -1
- package/dist/event/event.test.d.ts +0 -2
- package/dist/event/event.test.d.ts.map +0 -1
- package/dist/event/event.test.js +0 -30
- package/dist/event/event.test.js.map +0 -1
- package/dist/logging/eventLogger.test.d.ts +0 -2
- package/dist/logging/eventLogger.test.d.ts.map +0 -1
- package/dist/logging/eventLogger.test.js +0 -67
- package/dist/logging/eventLogger.test.js.map +0 -1
- package/dist/registration/register.test.d.ts +0 -2
- package/dist/registration/register.test.d.ts.map +0 -1
- package/dist/registration/register.test.js +0 -104
- package/dist/registration/register.test.js.map +0 -1
- package/dist/social/social.test.d.ts +0 -2
- package/dist/social/social.test.d.ts.map +0 -1
- package/dist/social/social.test.js +0 -110
- package/dist/social/social.test.js.map +0 -1
- package/dist/storage/storage.test.d.ts +0 -2
- package/dist/storage/storage.test.d.ts.map +0 -1
- package/dist/storage/storage.test.js +0 -120
- package/dist/storage/storage.test.js.map +0 -1
- package/dist/user/user.test.d.ts +0 -2
- package/dist/user/user.test.d.ts.map +0 -1
- package/dist/user/user.test.js +0 -56
- package/dist/user/user.test.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<a href="https://github.com/passlock-dev/
|
|
2
|
+
<a href="https://github.com/passlock-dev/ts-clients">
|
|
3
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
4
|
</a>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
-
<
|
|
8
|
-
<h1 align="center">Serverless Passkeys</h1>
|
|
7
|
+
<h1 align="center">Passkeys, Social Login & More</h1>
|
|
9
8
|
|
|
9
|
+
<div align="center">
|
|
10
|
+
<picture align="center">
|
|
11
|
+
<source srcset="https://raw.githubusercontent.com/passlock-dev/ts-clients/master/README_assets/repo-banner.dark.svg" media="(prefers-color-scheme: dark)" />
|
|
12
|
+
<img align="center" width=550 height=50 src="https://raw.githubusercontent.com/passlock-dev/ts-clients/master/README_assets/repo-banner.svg" />
|
|
13
|
+
</picture>
|
|
10
14
|
<p align="center">
|
|
11
|
-
|
|
15
|
+
Typescript library for next generation authentication. Passkeys, Apple login, Google one-tap and more..
|
|
12
16
|
<br />
|
|
13
17
|
<a href="https://passlock.dev"><strong>Project website »</strong></a>
|
|
14
18
|
<br />
|
|
15
|
-
<a href="https://passlock
|
|
19
|
+
<a href="https://github.com/passlock-dev/ts-clients">GitHub</a>
|
|
20
|
+
·
|
|
21
|
+
<a href="https://d1rl0ue18b0151.cloudfront.net">Demo</a>
|
|
16
22
|
·
|
|
17
23
|
<a href="https://docs.passlock.dev">Documentation</a>
|
|
18
24
|
·
|
|
19
|
-
<a href="https://docs.passlock.dev/docs/tutorial/
|
|
25
|
+
<a href="https://docs.passlock.dev/docs/tutorial/introduction">Tutorial</a>
|
|
20
26
|
</p>
|
|
21
27
|
</div>
|
|
22
28
|
|
|
@@ -24,35 +30,38 @@
|
|
|
24
30
|
|
|
25
31
|
## Features
|
|
26
32
|
|
|
27
|
-
Passkeys and the WebAuthn API are quite complex.
|
|
33
|
+
Passkeys and the WebAuthn API are quite complex. I've taken an opinionated approach to simplify things for you. Following the 80/20 principle, I've tried to focus on the features most valuable to developers and users.
|
|
34
|
+
|
|
35
|
+
1. **🔐 Primary or secondary authentication** - 2FA or a complete replacement for passwords
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
2. **🚀 Social login** - Supporting Apple & Google. GitHub coming soon..
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
3. **☝🏻 Biometrics** - Frictionless facial or fingerprint recognition for your webapps
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
4. **🖥️ Management console** - Suspend users, disable or revoke passkeys and more..
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
5. **🕵️ Audit trail** - View a full audit trail for each user
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
6. **🖥️ Dev console** - Something not working? check the web console for details
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
7. **👌 Headless components** - You have 100% control over the UI
|
|
40
48
|
|
|
41
|
-
##
|
|
49
|
+
## Screenshots
|
|
42
50
|
|
|
43
|
-

|
|
52
|
+
<p align="center">Demo app using this library for passkey and social login</p>
|
|
53
|
+
|
|
54
|
+

|
|
44
55
|
<p align="center">Viewing a user's authentication activity on their profile page</p>
|
|
45
56
|
|
|
46
57
|
## Usage
|
|
47
58
|
|
|
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
59
|
### Register a passkey
|
|
51
60
|
|
|
52
61
|
```typescript
|
|
53
62
|
import { Passlock, PasslockError } from '@passlock/client'
|
|
54
63
|
|
|
55
|
-
// you can find these details in the settings area of
|
|
64
|
+
// you can find these details in the settings area of your Passlock console
|
|
56
65
|
const tenancyId = '...'
|
|
57
66
|
const clientId = '...'
|
|
58
67
|
|
|
@@ -65,7 +74,7 @@ const [email, givenName, familyName] = ["jdoe@gmail.com", "John", "Doe"]
|
|
|
65
74
|
// Passlock doesn't throw but instead returns a union: result | error
|
|
66
75
|
const result = await passlock.registerPasskey({ email, givenName, familyName })
|
|
67
76
|
|
|
68
|
-
// ensure
|
|
77
|
+
// ensure we're error free
|
|
69
78
|
if (!PasslockError.isError(result)) {
|
|
70
79
|
// send the token to your backend (json/fetch or hidden form field etc)
|
|
71
80
|
console.log('Token: %s', result.token)
|
|
@@ -111,6 +120,6 @@ console.log(principal.user.id)
|
|
|
111
120
|
Please see the [tutorial][tutorial] and [documentation][docs]
|
|
112
121
|
|
|
113
122
|
[contact]: https://passlock.dev/contact
|
|
114
|
-
[tutorial]: https://docs.passlock.dev/docs/tutorial/
|
|
123
|
+
[tutorial]: https://docs.passlock.dev/docs/tutorial/introduction
|
|
115
124
|
[docs]: https://docs.passlock.dev
|
|
116
|
-
[node]: https://www.npmjs.com/package/@passlock/node
|
|
125
|
+
[node]: https://www.npmjs.com/package/@passlock/node
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { InternalBrowserError, type NotSupported } from '@passlock/shared/dist/error/error.js';
|
|
2
2
|
import type { OptionsErrors, VerificationErrors } from '@passlock/shared/dist/rpc/authentication.js';
|
|
3
|
-
import {
|
|
4
|
-
import type { AuthenticationCredential,
|
|
3
|
+
import { AuthenticationClient } from '@passlock/shared/dist/rpc/authentication.js';
|
|
4
|
+
import type { AuthenticationCredential, UserVerification } from '@passlock/shared/dist/schema/passkey.js';
|
|
5
|
+
import { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
5
6
|
import { Context, Effect as E, Layer } from 'effect';
|
|
6
7
|
import { Capabilities } from '../capabilities/capabilities.js';
|
|
7
8
|
import { StorageService } from '../storage/storage.js';
|
|
@@ -16,8 +17,8 @@ export type AuthenticationService = {
|
|
|
16
17
|
authenticatePasskey: (request: AuthenticationRequest) => E.Effect<Principal, AuthenticationErrors>;
|
|
17
18
|
};
|
|
18
19
|
export declare const AuthenticationService: Context.Tag<AuthenticationService, AuthenticationService>;
|
|
19
|
-
type Dependencies = GetCredential | Capabilities | StorageService |
|
|
20
|
+
type Dependencies = GetCredential | Capabilities | StorageService | AuthenticationClient;
|
|
20
21
|
export declare const authenticatePasskey: (request: AuthenticationRequest) => E.Effect<Principal, AuthenticationErrors, Dependencies>;
|
|
21
|
-
export declare const AuthenticateServiceLive: Layer.Layer<AuthenticationService, never, Capabilities | StorageService | GetCredential |
|
|
22
|
+
export declare const AuthenticateServiceLive: Layer.Layer<AuthenticationService, never, Capabilities | StorageService | GetCredential | AuthenticationClient>;
|
|
22
23
|
export {};
|
|
23
24
|
//# sourceMappingURL=authenticate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/authentication/authenticate.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src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AC,SAAS,EAAE,oBAAoB,EAAE,YAAY,CAgCxD,CAAA;AAKD,eAAO,MAAM,uBAAuB,iHASnC,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { OptionsRes, VerificationReq, VerificationRes } from '@passlock/shared/dist/rpc/authentication.js';
|
|
2
|
-
import { RpcClient } from '@passlock/shared/dist/rpc/rpc.js';
|
|
1
|
+
import { AuthenticationClient, OptionsRes, VerificationReq, VerificationRes } from '@passlock/shared/dist/rpc/authentication.js';
|
|
3
2
|
import { IsExistingUserRes, VerifyEmailRes } from '@passlock/shared/dist/rpc/user.js';
|
|
4
|
-
import type { AuthenticationCredential } from '@passlock/shared/dist/schema/
|
|
3
|
+
import type { AuthenticationCredential } from '@passlock/shared/dist/schema/passkey.js';
|
|
5
4
|
import { Layer as L } from 'effect';
|
|
6
5
|
import { GetCredential, type AuthenticationRequest } from './authenticate.js';
|
|
7
6
|
export declare const session = "session";
|
|
@@ -17,7 +16,7 @@ export declare const rpcVerificationRes: VerificationRes;
|
|
|
17
16
|
export declare const rpcIsExistingUserRes: IsExistingUserRes;
|
|
18
17
|
export declare const rpcVerifyEmailRes: VerifyEmailRes;
|
|
19
18
|
export declare const getCredentialTest: L.Layer<GetCredential, never, never>;
|
|
20
|
-
export declare const rpcClientTest: L.Layer<
|
|
19
|
+
export declare const rpcClientTest: L.Layer<AuthenticationClient, never, never>;
|
|
21
20
|
export declare const principal: {
|
|
22
21
|
readonly token: string;
|
|
23
22
|
readonly user: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.fixture.d.ts","sourceRoot":"","sources":["../../src/authentication/authenticate.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"authenticate.fixture.d.ts","sourceRoot":"","sources":["../../src/authentication/authenticate.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,eAAe,EAChB,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AACrF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AACvF,OAAO,EAAe,KAAK,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhD,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE7E,eAAO,MAAM,OAAO,YAAY,CAAA;AAChC,eAAO,MAAM,KAAK,UAAU,CAAA;AAC5B,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,eAAO,MAAM,QAAQ,YAAY,CAAA;AACjC,eAAO,MAAM,QAAQ,QAAqB,CAAA;AAE1C,eAAO,MAAM,OAAO,EAAE,qBAErB,CAAA;AAED,eAAO,MAAM,aAAa,YAQxB,CAAA;AAEF,eAAO,MAAM,UAAU,EAAE,wBAYxB,CAAA;AAED,eAAO,MAAM,kBAAkB,iBAA+C,CAAA;AAE9E,eAAO,MAAM,kBAAkB,iBAAyD,CAAA;AAExF,eAAO,MAAM,oBAAoB,mBAAgD,CAAA;AAEjF,eAAO,MAAM,iBAAiB,gBAAwD,CAAA;AAEtF,eAAO,MAAM,iBAAiB,sCAG7B,CAAA;AAED,eAAO,MAAM,aAAa,6CAMzB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;CAAqB,CAAA;AAC3C,eAAO,MAAM,gBAAgB,+EAA4B,CAAA;AACzD,eAAO,MAAM,kBAAkB,uEAA8B,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { OptionsRes, VerificationReq, VerificationRes, } from '@passlock/shared/dist/rpc/authentication.js';
|
|
2
|
-
import { RpcClient } from '@passlock/shared/dist/rpc/rpc.js';
|
|
1
|
+
import { AuthenticationClient, OptionsRes, VerificationReq, VerificationRes, } from '@passlock/shared/dist/rpc/authentication.js';
|
|
3
2
|
import { IsExistingUserRes, VerifyEmailRes } from '@passlock/shared/dist/rpc/user.js';
|
|
4
3
|
import { Effect as E, Layer as L } from 'effect';
|
|
5
4
|
import * as Fixtures from '../test/fixtures.js';
|
|
@@ -39,17 +38,9 @@ export const rpcVerificationRes = new VerificationRes({ principal: Fixtures.prin
|
|
|
39
38
|
export const rpcIsExistingUserRes = new IsExistingUserRes({ existingUser: true });
|
|
40
39
|
export const rpcVerifyEmailRes = new VerifyEmailRes({ principal: Fixtures.principal });
|
|
41
40
|
export const getCredentialTest = L.succeed(GetCredential, GetCredential.of(() => E.succeed(credential)));
|
|
42
|
-
export const rpcClientTest = L.succeed(
|
|
43
|
-
preConnect: () => E.succeed(Fixtures.preConnectRes),
|
|
44
|
-
isExistingUser: () => E.succeed(rpcIsExistingUserRes),
|
|
45
|
-
verifyEmail: () => E.succeed(rpcVerifyEmailRes),
|
|
46
|
-
getRegistrationOptions: () => E.fail(Fixtures.notImplemented),
|
|
47
|
-
verifyRegistrationCredential: () => E.fail(Fixtures.notImplemented),
|
|
41
|
+
export const rpcClientTest = L.succeed(AuthenticationClient, AuthenticationClient.of({
|
|
48
42
|
getAuthenticationOptions: () => E.succeed(rpcOptionsRes),
|
|
49
43
|
verifyAuthenticationCredential: () => E.succeed(rpcVerificationRes),
|
|
50
|
-
registerOidc: () => E.fail(Fixtures.notImplemented),
|
|
51
|
-
authenticateOidc: () => E.fail(Fixtures.notImplemented),
|
|
52
|
-
resendVerificationEmail: () => E.fail(Fixtures.notImplemented),
|
|
53
44
|
}));
|
|
54
45
|
export const principal = Fixtures.principal;
|
|
55
46
|
export const capabilitiesTest = Fixtures.capabilitiesTest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.fixture.js","sourceRoot":"","sources":["../../src/authentication/authenticate.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"authenticate.fixture.js","sourceRoot":"","sources":["../../src/authentication/authenticate.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBA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OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;AAE9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAA;AAExF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAA;AAEtF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,OAAO,CACxC,aAAa,EACb,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAC9C,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,OAAO,CACpC,oBAAoB,EACpB,oBAAoB,CAAC,EAAE,CAAC;IACtB,wBAAwB,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IACxD,8BAA8B,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;CACpE,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAA;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseRequestOptionsFromJSON, } from '@github/webauthn-json/browser-ponyfill';
|
|
2
2
|
import { InternalBrowserError, } from '@passlock/shared/dist/error/error.js';
|
|
3
|
-
import { OptionsReq, VerificationReq } from '@passlock/shared/dist/rpc/authentication.js';
|
|
4
|
-
import {
|
|
3
|
+
import { AuthenticationClient, OptionsReq, VerificationReq } from '@passlock/shared/dist/rpc/authentication.js';
|
|
4
|
+
import { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
5
5
|
import { Context, Effect as E, Layer, flow, pipe } from 'effect';
|
|
6
6
|
import { Capabilities } from '../capabilities/capabilities.js';
|
|
7
7
|
import { StorageService } from '../storage/storage.js';
|
|
@@ -10,7 +10,7 @@ export const AuthenticationService = Context.GenericTag('@services/Authenticatio
|
|
|
10
10
|
const fetchOptions = (request) => {
|
|
11
11
|
return E.gen(function* (_) {
|
|
12
12
|
yield* _(E.logDebug('Making request'));
|
|
13
|
-
const rpcClient = yield* _(
|
|
13
|
+
const rpcClient = yield* _(AuthenticationClient);
|
|
14
14
|
const { publicKey, session } = yield* _(rpcClient.getAuthenticationOptions(request));
|
|
15
15
|
yield* _(E.logDebug('Converting Passlock options to CredentialRequestOptions'));
|
|
16
16
|
const options = yield* _(toRequestOptions({ publicKey }));
|
|
@@ -26,7 +26,7 @@ const toRequestOptions = (request) => {
|
|
|
26
26
|
const verifyCredential = (request) => {
|
|
27
27
|
return E.gen(function* (_) {
|
|
28
28
|
yield* _(E.logDebug('Making request'));
|
|
29
|
-
const rpcClient = yield* _(
|
|
29
|
+
const rpcClient = yield* _(AuthenticationClient);
|
|
30
30
|
const { principal } = yield* _(rpcClient.verifyAuthenticationCredential(request));
|
|
31
31
|
return principal;
|
|
32
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/authentication/authenticate.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/authentication/authenticate.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,2BAA2B,GAE5B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,oBAAoB,GAErB,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,eAAe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CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AAClE,CAAC,CAAA;AAKD,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC,MAAM,CACjD,qBAAqB,EACrB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IAChB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAwE,CAAC,CAAA;IAE3G,OAAO,qBAAqB,CAAC,EAAE,CAAC;QAC9B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACnE,CAAC,CAAA;AACJ,CAAC,CAAC,CACH,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { RpcConfig } from '@passlock/shared/dist/rpc/config.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ConnectionClient } from '@passlock/shared/dist/rpc/connection.js';
|
|
3
|
+
import { Dispatcher } from '@passlock/shared/dist/rpc/dispatcher.js';
|
|
3
4
|
import { Context, Effect as E, Layer } from 'effect';
|
|
4
5
|
export type ConnectionService = {
|
|
5
6
|
preConnect: () => E.Effect<void>;
|
|
6
7
|
};
|
|
7
8
|
export declare const ConnectionService: Context.Tag<ConnectionService, ConnectionService>;
|
|
8
|
-
export declare const preConnect: () => E.Effect<void, never,
|
|
9
|
-
export declare const ConnectionServiceLive: Layer.Layer<ConnectionService, never, RpcConfig |
|
|
9
|
+
export declare const preConnect: () => E.Effect<void, never, Dispatcher | ConnectionClient>;
|
|
10
|
+
export declare const ConnectionServiceLive: Layer.Layer<ConnectionService, never, RpcConfig | Dispatcher | ConnectionClient>;
|
|
10
11
|
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/connection/connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/connection/connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,EAAc,MAAM,QAAQ,CAAA;AAIhE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,iBAAiB,mDAAoE,CAAA;AAmBlG,eAAO,MAAM,UAAU,4DAA0E,CAAA;AAKjG,eAAO,MAAM,qBAAqB,kFASjC,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RpcClient } from '@passlock/shared/dist/rpc/rpc.js';
|
|
1
|
+
import { ConnectionClient, ConnectRes } from '@passlock/shared/dist/rpc/connection.js';
|
|
3
2
|
import { Layer as L } from 'effect';
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const rpcClientTest: L.Layer<RpcClient, never, never>;
|
|
3
|
+
export declare const preConnectRes: ConnectRes;
|
|
4
|
+
export declare const rpcClientTest: L.Layer<ConnectionClient, never, never>;
|
|
7
5
|
export declare const rpcConfig: {
|
|
8
6
|
endpoint: string;
|
|
9
7
|
tenancyId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.fixture.d.ts","sourceRoot":"","sources":["../../src/connection/connection.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"connection.fixture.d.ts","sourceRoot":"","sources":["../../src/connection/connection.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AACtF,OAAO,EAAe,KAAK,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhD,eAAO,MAAM,aAAa,YAAmC,CAAA;AAE7D,eAAO,MAAM,aAAa,yCAKzB,CAAA;AAED,eAAO,MAAM,SAAS;;;;CAIrB,CAAA"}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RpcClient } from '@passlock/shared/dist/rpc/rpc.js';
|
|
1
|
+
import { ConnectionClient, ConnectRes } from '@passlock/shared/dist/rpc/connection.js';
|
|
3
2
|
import { Effect as E, Layer as L } from 'effect';
|
|
4
|
-
|
|
5
|
-
export const
|
|
6
|
-
export const preConnectRes = new PreConnectRes({ warmed: true });
|
|
7
|
-
export const rpcClientTest = L.succeed(RpcClient, RpcClient.of({
|
|
3
|
+
export const preConnectRes = new ConnectRes({ warmed: true });
|
|
4
|
+
export const rpcClientTest = L.succeed(ConnectionClient, ConnectionClient.of({
|
|
8
5
|
preConnect: () => E.succeed(preConnectRes),
|
|
9
|
-
isExistingUser: () => E.fail(Fixtures.notImplemented),
|
|
10
|
-
verifyEmail: () => E.fail(Fixtures.notImplemented),
|
|
11
|
-
getRegistrationOptions: () => E.fail(Fixtures.notImplemented),
|
|
12
|
-
verifyRegistrationCredential: () => E.fail(Fixtures.notImplemented),
|
|
13
|
-
getAuthenticationOptions: () => E.fail(Fixtures.notImplemented),
|
|
14
|
-
verifyAuthenticationCredential: () => E.fail(Fixtures.notImplemented),
|
|
15
|
-
registerOidc: () => E.fail(Fixtures.notImplemented),
|
|
16
|
-
authenticateOidc: () => E.fail(Fixtures.notImplemented),
|
|
17
|
-
resendVerificationEmail: () => E.fail(Fixtures.notImplemented),
|
|
18
6
|
}));
|
|
19
7
|
export const rpcConfig = {
|
|
20
8
|
endpoint: 'https://example.com',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.fixture.js","sourceRoot":"","sources":["../../src/connection/connection.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"connection.fixture.js","sourceRoot":"","sources":["../../src/connection/connection.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AACtF,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;AAE7D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,OAAO,CACpC,gBAAgB,EAChB,gBAAgB,CAAC,EAAE,CAAC;IAClB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;CAC3C,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,QAAQ,EAAE,qBAAqB;IAC/B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACrB,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Dispatcher
|
|
1
|
+
import { ConnectionClient } from '@passlock/shared/dist/rpc/connection.js';
|
|
2
|
+
import { Dispatcher } from '@passlock/shared/dist/rpc/dispatcher.js';
|
|
3
3
|
import { Context, Effect as E, Layer, flow, pipe } from 'effect';
|
|
4
4
|
export const ConnectionService = Context.GenericTag('@services/ConnectService');
|
|
5
5
|
const hitPrincipal = pipe(E.logInfo('Pre-connecting to Principal endpoint'), E.zipRight(Dispatcher), E.flatMap(dispatcher => dispatcher.get('/token/token?warm=true')), E.asVoid, E.catchAll(() => E.void));
|
|
6
|
-
const hitRpc = pipe(E.logInfo('Pre-connecting to RPC endpoint'), E.zipRight(
|
|
6
|
+
const hitRpc = pipe(E.logInfo('Pre-connecting to RPC endpoint'), E.zipRight(ConnectionClient), E.flatMap(rpcClient => rpcClient.preConnect()), E.asVoid);
|
|
7
7
|
export const preConnect = () => pipe(E.all([hitPrincipal, hitRpc], { concurrency: 2 }), E.asVoid);
|
|
8
8
|
export const ConnectionServiceLive = Layer.effect(ConnectionService, E.gen(function* (_) {
|
|
9
9
|
const context = yield* _(E.context());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/connection/connection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/connection/connection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAQhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAoB,0BAA0B,CAAC,CAAA;AAIlG,MAAM,YAAY,GAAG,IAAI,CACvB,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,EACjD,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EACtB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC,EACjE,CAAC,CAAC,MAAM,EACR,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CACzB,CAAA;AAED,MAAM,MAAM,GAAG,IAAI,CACjB,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC,EAC3C,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAC5B,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,EAC9C,CAAC,CAAC,MAAM,CACT,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;AAKjG,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC,MAAM,CAC/C,iBAAiB,EACjB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IAChB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAA6C,CAAC,CAAA;IAEhF,OAAO,iBAAiB,CAAC,EAAE,CAAC;QAC1B,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjD,CAAC,CAAA;AACJ,CAAC,CAAC,CACH,CAAA"}
|
package/dist/effect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Duplicate, type BadRequest, type Disabled, type Forbidden, type NotFound, type NotSupported, type Unauthorized } from '@passlock/shared/dist/error/error.js';
|
|
2
|
-
import type { Principal } from '@passlock/shared/dist/schema/
|
|
2
|
+
import type { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
3
3
|
import { Context, Effect as E, Layer as L } from 'effect';
|
|
4
4
|
import type { NoSuchElementException } from 'effect/Cause';
|
|
5
5
|
import { AuthenticationService, type AuthenticationRequest } from './authentication/authenticate.js';
|
package/dist/effect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../src/effect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../src/effect.ts"],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UAAU,EAAE,MAAM,CAM7E,CAAA;AAEH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAA;AAEjG,eAAO,MAAM,eAAe,YACjB,mBAAmB,KAC3B,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,EAAE,MAAM,CAM9C,CAAA;AAEH,MAAM,MAAM,oBAAoB,GAC5B,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,SAAS,CAAA;AAEb,eAAO,MAAM,mBAAmB,YACrB,qBAAqB,KAC7B,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,oBAAoB,EAAE,MAAM,CAMhD,CAAA;AAEH,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,SAAS,CAAA;AAEb,eAAO,MAAM,eAAe,YACjB,aAAa,KACrB,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAM7C,CAAA;AAEH,eAAO,MAAM,eAAe,QAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,MAAM,CAM7E,CAAA;AAEH,eAAO,MAAM,eAAe,aAChB,QAAQ,KACjB,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,sBAAsB,CAM5C,CAAA;AAEH,eAAO,MAAM,kBAAkB,QAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAMhD,CAAA;AAEH,eAAO,MAAM,gBAAgB,YAAa,eAAe;;;;;;;;;;;;;;;8DAKtD,CAAA"}
|
package/dist/effect.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { create, get as getCredential } from '@github/webauthn-json/browser-ponyfill';
|
|
2
|
+
import { AuthenticationClientLive } from '@passlock/shared/dist/rpc/authentication.js';
|
|
3
|
+
import { ConnectionClientLive } from '@passlock/shared/dist/rpc/connection.js';
|
|
4
|
+
import { RegistrationClientLive } from '@passlock/shared/dist/rpc/registration.js';
|
|
5
|
+
import { SocialClientLive } from '@passlock/shared/dist/rpc/social.js';
|
|
6
|
+
import { UserClientLive } from '@passlock/shared/dist/rpc/user.js';
|
|
2
7
|
import { Duplicate, InternalBrowserError, } from '@passlock/shared/dist/error/error.js';
|
|
3
|
-
import { DispatcherLive, RpcClientLive, } from '@passlock/shared/dist/rpc/rpc.js';
|
|
4
8
|
import { Context, Effect as E, Layer as L, Layer, Schedule, pipe } from 'effect';
|
|
5
9
|
import { AuthenticateServiceLive, AuthenticationService, GetCredential, } from './authentication/authenticate.js';
|
|
6
10
|
import { capabilitiesLive } from './capabilities/capabilities.js';
|
|
@@ -9,6 +13,7 @@ import { EmailService, EmailServiceLive, URLQueryString } from './email/email.js
|
|
|
9
13
|
import { CreateCredential, RegistrationService, RegistrationServiceLive, } from './registration/register.js';
|
|
10
14
|
import { Storage, StorageService, StorageServiceLive, } from './storage/storage.js';
|
|
11
15
|
import { RetrySchedule, RpcConfig } from '@passlock/shared/dist/rpc/config.js';
|
|
16
|
+
import { DispatcherLive } from '@passlock/shared/dist/rpc/dispatcher.js';
|
|
12
17
|
import { SocialService, SocialServiceLive } from './social/social.js';
|
|
13
18
|
import { UserService, UserServiceLive } from './user/user.js';
|
|
14
19
|
const createCredentialLive = L.succeed(CreateCredential, CreateCredential.of((options) => pipe(E.tryPromise({
|
|
@@ -37,15 +42,19 @@ const getCredentialLive = L.succeed(GetCredential, GetCredential.of((options) =>
|
|
|
37
42
|
const schedule = Schedule.intersect(Schedule.recurs(3), Schedule.exponential('100 millis'));
|
|
38
43
|
const retryScheduleLive = L.succeed(RetrySchedule, RetrySchedule.of({ schedule }));
|
|
39
44
|
const dispatcherLive = pipe(DispatcherLive, L.provide(retryScheduleLive));
|
|
40
|
-
const
|
|
45
|
+
const connectClientLive = pipe(ConnectionClientLive, L.provide(dispatcherLive));
|
|
46
|
+
const registerClientLive = pipe(RegistrationClientLive, L.provide(dispatcherLive));
|
|
47
|
+
const authenticateClientLive = pipe(AuthenticationClientLive, L.provide(dispatcherLive));
|
|
48
|
+
const socialClientLive = pipe(SocialClientLive, L.provide(dispatcherLive));
|
|
49
|
+
const userClientLive = pipe(UserClientLive, L.provide(dispatcherLive));
|
|
41
50
|
const storageServiceLive = StorageServiceLive;
|
|
42
|
-
const userServiceLive = pipe(UserServiceLive, L.provide(
|
|
43
|
-
const registrationServiceLive = pipe(RegistrationServiceLive, L.provide(
|
|
44
|
-
const authenticationServiceLive = pipe(AuthenticateServiceLive, L.provide(
|
|
45
|
-
const connectionServiceLive = pipe(ConnectionServiceLive, L.provide(
|
|
51
|
+
const userServiceLive = pipe(UserServiceLive, L.provide(userClientLive));
|
|
52
|
+
const registrationServiceLive = pipe(RegistrationServiceLive, L.provide(registerClientLive), L.provide(userServiceLive), L.provide(capabilitiesLive), L.provide(createCredentialLive), L.provide(storageServiceLive));
|
|
53
|
+
const authenticationServiceLive = pipe(AuthenticateServiceLive, L.provide(authenticateClientLive), L.provide(capabilitiesLive), L.provide(getCredentialLive), L.provide(storageServiceLive));
|
|
54
|
+
const connectionServiceLive = pipe(ConnectionServiceLive, L.provide(connectClientLive), L.provide(dispatcherLive));
|
|
46
55
|
const urlQueryStringLive = Layer.succeed(URLQueryString, URLQueryString.of(E.sync(() => globalThis.window.location.search)));
|
|
47
|
-
const emailServiceLive = pipe(EmailServiceLive, L.provide(urlQueryStringLive), L.provide(
|
|
48
|
-
const socialServiceLive = pipe(SocialServiceLive, L.provide(
|
|
56
|
+
const emailServiceLive = pipe(EmailServiceLive, L.provide(urlQueryStringLive), L.provide(userClientLive), L.provide(capabilitiesLive), L.provide(authenticationServiceLive), L.provide(storageServiceLive));
|
|
57
|
+
const socialServiceLive = pipe(SocialServiceLive, L.provide(socialClientLive));
|
|
49
58
|
export const allRequirements = Layer.mergeAll(capabilitiesLive, userServiceLive, registrationServiceLive, authenticationServiceLive, connectionServiceLive, emailServiceLive, storageServiceLive, socialServiceLive);
|
|
50
59
|
export class Config extends Context.Tag('Config')() {
|
|
51
60
|
}
|
package/dist/effect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"effect.js","sourceRoot":"","sources":["../src/effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAErF,OAAO,
|
|
1
|
+
{"version":3,"file":"effect.js","sourceRoot":"","sources":["../src/effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAErF,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAElE,OAAO,EACL,SAAS,EACT,oBAAoB,GAOrB,MAAM,sCAAsC,CAAA;AAI7C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAGhF,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,aAAa,GAEd,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AACrF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAA;AAErG,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,GAExB,MAAM,4BAA4B,CAAA;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AC,CAAC,EAChD,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC7B,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CACvB,CAAA;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAmB,EAAE,CACrD,IAAI,CACF,cAAc,EACd,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAChD,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC7B,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CACvB,CAAA;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAwB,EAAE,EAAE,CAC3D,IAAI,CACF,aAAa,EACb,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,EACnD,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAC7B,CAAA"}
|
package/dist/email/email.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { RpcClient } from '@passlock/shared/dist/rpc/rpc.js';
|
|
2
1
|
import type { VerifyEmailErrors as RpcErrors } from '@passlock/shared/dist/rpc/user.js';
|
|
3
|
-
import
|
|
2
|
+
import { UserClient } from '@passlock/shared/dist/rpc/user.js';
|
|
3
|
+
import type { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
4
4
|
import { Context, Effect as E, Layer } from 'effect';
|
|
5
5
|
import { AuthenticationService, type AuthenticationErrors } from '../authentication/authenticate.js';
|
|
6
6
|
import { StorageService } from '../storage/storage.js';
|
|
@@ -16,7 +16,7 @@ export type EmailService = {
|
|
|
16
16
|
verifyEmailLink: () => E.Effect<Principal, VerifyEmailErrors>;
|
|
17
17
|
};
|
|
18
18
|
export declare const EmailService: Context.Tag<EmailService, EmailService>;
|
|
19
|
-
export type Dependencies = StorageService | AuthenticationService |
|
|
19
|
+
export type Dependencies = StorageService | AuthenticationService | UserClient;
|
|
20
20
|
export declare const extractCodeFromHref: () => E.Effect<string, import("effect/Cause").NoSuchElementException, URLQueryString>;
|
|
21
21
|
export declare const verifyEmail: (request: VerifyRequest) => E.Effect<Principal, VerifyEmailErrors, Dependencies>;
|
|
22
22
|
export declare const verifyEmailLink: () => E.Effect<{
|
|
@@ -35,6 +35,6 @@ export declare const verifyEmailLink: () => E.Effect<{
|
|
|
35
35
|
};
|
|
36
36
|
readonly expireAt: Date;
|
|
37
37
|
}, VerifyEmailErrors, URLQueryString | Dependencies>;
|
|
38
|
-
export declare const EmailServiceLive: Layer.Layer<EmailService, never, StorageService | AuthenticationService |
|
|
38
|
+
export declare const EmailServiceLive: Layer.Layer<EmailService, never, StorageService | AuthenticationService | URLQueryString | UserClient>;
|
|
39
39
|
export {};
|
|
40
40
|
//# sourceMappingURL=email.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/email/email.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/email/email.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,IAAI,SAAS,EAAE,MAAM,mCAAmC,CAAA;AACvF,OAAO,EAAE,UAAU,EAAkB,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,EAAqC,MAAM,QAAQ,CAAA;AACvF,OAAO,EAAE,qBAAqB,EAAE,KAAK,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAItD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAID,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,oBAAoB,CAAA;;AAIhE,qBAAa,cAAe,SAAQ,mBAGjC;CAAG;AAIN,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;IACnF,eAAe,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAA;CAC9D,CAAA;AAED,eAAO,MAAM,YAAY,yCAA6D,CAAA;AAItF,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,qBAAqB,GAAG,UAAU,CAAA;AAuC9E,eAAO,MAAM,mBAAmB,uFAO/B,CAAA;AASD,eAAO,MAAM,WAAW,YACb,aAAa,KACrB,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,EAAE,YAAY,CAarD,CAAA;AAMD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;oDAKzB,CAAA;AAKH,eAAO,MAAM,gBAAgB,wGAW5B,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VerifyEmailReq, VerifyEmailRes } from '@passlock/shared/dist/rpc/user.js';
|
|
1
|
+
import { UserClient, VerifyEmailReq, VerifyEmailRes } from '@passlock/shared/dist/rpc/user.js';
|
|
3
2
|
import { Layer as L } from 'effect';
|
|
4
3
|
import { AuthenticationService } from '../authentication/authenticate.js';
|
|
5
4
|
import { URLQueryString } from './email.js';
|
|
@@ -11,7 +10,7 @@ export declare const locationSearchTest: L.Layer<URLQueryString, never, never>;
|
|
|
11
10
|
export declare const authenticationServiceTest: L.Layer<AuthenticationService, never, never>;
|
|
12
11
|
export declare const rpcVerifyEmailReq: VerifyEmailReq;
|
|
13
12
|
export declare const rpcVerifyEmailRes: VerifyEmailRes;
|
|
14
|
-
export declare const rpcClientTest: L.Layer<
|
|
13
|
+
export declare const rpcClientTest: L.Layer<UserClient, never, never>;
|
|
15
14
|
export declare const principal: {
|
|
16
15
|
readonly token: string;
|
|
17
16
|
readonly user: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.fixture.d.ts","sourceRoot":"","sources":["../../src/email/email.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"email.fixture.d.ts","sourceRoot":"","sources":["../../src/email/email.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAC9F,OAAO,EAAe,KAAK,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,eAAO,MAAM,KAAK,UAAU,CAAA;AAC5B,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,eAAO,MAAM,QAAQ,YAAY,CAAA;AACjC,eAAO,MAAM,QAAQ,QAAqB,CAAA;AAE1C,eAAO,MAAM,kBAAkB,uCAG9B,CAAA;AAED,eAAO,MAAM,yBAAyB,8CAKrC,CAAA;AAED,eAAO,MAAM,iBAAiB,gBAAsC,CAAA;AAEpE,eAAO,MAAM,iBAAiB,gBAAwD,CAAA;AAEtF,eAAO,MAAM,aAAa,mCAOzB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;CAAqB,CAAA;AAE3C,eAAO,MAAM,WAAW,mCAAuB,CAAA;AAE/C,eAAO,MAAM,kBAAkB,uEAA8B,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VerifyEmailReq, VerifyEmailRes } from '@passlock/shared/dist/rpc/user.js';
|
|
1
|
+
import { UserClient, VerifyEmailReq, VerifyEmailRes } from '@passlock/shared/dist/rpc/user.js';
|
|
3
2
|
import { Effect as E, Layer as L } from 'effect';
|
|
4
3
|
import { AuthenticationService } from '../authentication/authenticate.js';
|
|
5
4
|
import * as Fixtures from '../test/fixtures.js';
|
|
@@ -14,16 +13,9 @@ export const authenticationServiceTest = L.succeed(AuthenticationService, Authen
|
|
|
14
13
|
}));
|
|
15
14
|
export const rpcVerifyEmailReq = new VerifyEmailReq({ token, code });
|
|
16
15
|
export const rpcVerifyEmailRes = new VerifyEmailRes({ principal: Fixtures.principal });
|
|
17
|
-
export const rpcClientTest = L.succeed(
|
|
18
|
-
preConnect: () => E.succeed({ warmed: true }),
|
|
16
|
+
export const rpcClientTest = L.succeed(UserClient, UserClient.of({
|
|
19
17
|
isExistingUser: () => E.succeed({ existingUser: true }),
|
|
20
18
|
verifyEmail: () => E.succeed(rpcVerifyEmailRes),
|
|
21
|
-
getRegistrationOptions: () => E.fail(Fixtures.notImplemented),
|
|
22
|
-
verifyRegistrationCredential: () => E.fail(Fixtures.notImplemented),
|
|
23
|
-
getAuthenticationOptions: () => E.fail(Fixtures.notImplemented),
|
|
24
|
-
verifyAuthenticationCredential: () => E.fail(Fixtures.notImplemented),
|
|
25
|
-
registerOidc: () => E.fail(Fixtures.notImplemented),
|
|
26
|
-
authenticateOidc: () => E.fail(Fixtures.notImplemented),
|
|
27
19
|
resendVerificationEmail: () => E.fail(Fixtures.notImplemented),
|
|
28
20
|
}));
|
|
29
21
|
export const principal = Fixtures.principal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.fixture.js","sourceRoot":"","sources":["../../src/email/email.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"email.fixture.js","sourceRoot":"","sources":["../../src/email/email.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAC9F,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE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EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAC/D,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;AAE3C,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAA;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,kBAAkB,CAAA"}
|
package/dist/email/email.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BadRequest } from '@passlock/shared/dist/error/error.js';
|
|
2
|
-
import {
|
|
3
|
-
import { VerifyEmailReq } from '@passlock/shared/dist/rpc/user.js';
|
|
2
|
+
import { UserClient, VerifyEmailReq } from '@passlock/shared/dist/rpc/user.js';
|
|
4
3
|
import { Context, Effect as E, Layer, Option as O, flow, identity, pipe } from 'effect';
|
|
5
4
|
import { AuthenticationService } from '../authentication/authenticate.js';
|
|
6
5
|
import { StorageService } from '../storage/storage.js';
|
|
@@ -32,7 +31,7 @@ export const verifyEmail = (request) => {
|
|
|
32
31
|
return E.gen(function* (_) {
|
|
33
32
|
const { token } = yield* _(getToken());
|
|
34
33
|
yield* _(E.logDebug('Making request'));
|
|
35
|
-
const client = yield* _(
|
|
34
|
+
const client = yield* _(UserClient);
|
|
36
35
|
const { principal } = yield* _(client.verifyEmail(new VerifyEmailReq({ token, code: request.code })));
|
|
37
36
|
return principal;
|
|
38
37
|
});
|