@passlock/client 0.9.23 → 0.9.25
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 +15 -10
- package/README.template.md +130 -0
- package/dist/authentication/authenticate.d.ts +2 -2
- package/dist/authentication/authenticate.fixture.d.ts +1 -1
- package/dist/authentication/authenticate.fixture.js +2 -2
- package/dist/authentication/authenticate.fixture.js.map +1 -1
- package/dist/authentication/authenticate.js +1 -1
- package/dist/authentication/authenticate.js.map +1 -1
- package/dist/capabilities/capabilities.d.ts +1 -1
- package/dist/capabilities/capabilities.js +1 -1
- package/dist/capabilities/capabilities.js.map +1 -1
- package/dist/connection/connection.fixture.d.ts +1 -1
- package/dist/connection/connection.fixture.js +1 -1
- package/dist/connection/connection.fixture.js.map +1 -1
- package/dist/connection/connection.js.map +1 -1
- package/dist/effect.d.ts +3 -3
- package/dist/effect.js +6 -6
- package/dist/effect.js.map +1 -1
- package/dist/email/email.d.ts +5 -2
- package/dist/email/email.fixture.d.ts +1 -1
- package/dist/email/email.fixture.js +2 -2
- package/dist/email/email.fixture.js.map +1 -1
- package/dist/email/email.js +1 -1
- package/dist/email/email.js.map +1 -1
- package/dist/event/event.d.ts +1 -1
- package/dist/event/event.js +1 -1
- package/dist/event/event.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/logging/eventLogger.js +1 -1
- package/dist/logging/eventLogger.js.map +1 -1
- package/dist/registration/register.d.ts +2 -2
- package/dist/registration/register.fixture.d.ts +1 -1
- package/dist/registration/register.fixture.js +2 -2
- package/dist/registration/register.fixture.js.map +1 -1
- package/dist/registration/register.js +2 -2
- package/dist/registration/register.js.map +1 -1
- package/dist/rpc/authentication.d.ts +1 -1
- package/dist/rpc/authentication.js +1 -1
- package/dist/rpc/authentication.js.map +1 -1
- package/dist/rpc/client.d.ts +1 -1
- package/dist/rpc/client.js +3 -4
- package/dist/rpc/client.js.map +1 -1
- package/dist/rpc/connection.d.ts +1 -1
- package/dist/rpc/connection.js +1 -1
- package/dist/rpc/connection.js.map +1 -1
- package/dist/rpc/registration.d.ts +1 -1
- package/dist/rpc/registration.js +1 -1
- package/dist/rpc/registration.js.map +1 -1
- package/dist/rpc/social.d.ts +1 -1
- package/dist/rpc/social.js +1 -1
- package/dist/rpc/social.js.map +1 -1
- package/dist/rpc/user.d.ts +1 -1
- package/dist/rpc/user.js +1 -1
- package/dist/rpc/user.js.map +1 -1
- package/dist/social/social.d.ts +2 -2
- package/dist/social/social.fixture.d.ts +1 -1
- package/dist/social/social.fixture.js +2 -2
- package/dist/social/social.fixture.js.map +1 -1
- package/dist/social/social.js +2 -2
- package/dist/social/social.js.map +1 -1
- package/dist/storage/storage.d.ts +1 -1
- package/dist/storage/storage.fixture.js.map +1 -1
- package/dist/storage/storage.js +4 -0
- package/dist/storage/storage.js.map +1 -1
- package/dist/test/fixtures.d.ts +1 -1
- package/dist/test/fixtures.js +2 -2
- package/dist/test/fixtures.js.map +1 -1
- package/dist/user/user.d.ts +1 -1
- package/dist/user/user.fixture.d.ts +1 -1
- package/dist/user/user.fixture.js +2 -2
- package/dist/user/user.fixture.js.map +1 -1
- package/dist/user/user.js +4 -1
- package/dist/user/user.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +21 -17
- package/src/authentication/authenticate.fixture.ts +4 -2
- package/src/authentication/authenticate.test.ts +2 -1
- package/src/authentication/authenticate.ts +3 -1
- package/src/capabilities/capabilities.ts +2 -1
- package/src/connection/connection.fixture.ts +3 -1
- package/src/connection/connection.test.ts +2 -1
- package/src/connection/connection.ts +1 -0
- package/src/effect.ts +12 -18
- package/src/email/email.fixture.ts +4 -2
- package/src/email/email.test.ts +2 -1
- package/src/email/email.ts +3 -1
- package/src/event/event.node.test.ts +1 -0
- package/src/event/event.test.ts +1 -0
- package/src/event/event.ts +2 -1
- package/src/index.ts +39 -33
- package/src/logging/eventLogger.test.ts +1 -0
- package/src/logging/eventLogger.ts +1 -1
- package/src/registration/register.fixture.ts +4 -2
- package/src/registration/register.test.ts +4 -2
- package/src/registration/register.ts +4 -5
- package/src/rpc/authentication.ts +14 -2
- package/src/rpc/client.ts +5 -4
- package/src/rpc/connection.ts +8 -2
- package/src/rpc/registration.ts +12 -2
- package/src/rpc/social.ts +11 -2
- package/src/rpc/user.ts +16 -1
- package/src/social/social.fixture.ts +4 -2
- package/src/social/social.test.ts +4 -2
- package/src/social/social.ts +4 -2
- package/src/storage/storage.fixture.ts +1 -0
- package/src/storage/storage.test.ts +1 -0
- package/src/storage/storage.ts +4 -3
- package/src/test/fixtures.ts +4 -2
- package/src/user/user.fixture.ts +4 -2
- package/src/user/user.test.ts +2 -1
- package/src/user/user.ts +3 -1
- package/src/version.ts +1 -1
package/src/rpc/connection.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as S from '@effect/schema/Schema'
|
|
2
|
-
import { CONNECT_ENDPOINT, ConnectRes, type ConnectionService } from '@passlock/shared/dist/rpc/connection.js'
|
|
3
2
|
import { Context, Effect as E, Layer } from 'effect'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
CONNECT_ENDPOINT,
|
|
6
|
+
ConnectRes,
|
|
7
|
+
type ConnectionService,
|
|
8
|
+
} from '@passlock/shared/dist/rpc/connection.js'
|
|
9
|
+
|
|
4
10
|
import { Dispatcher, makeGetRequest } from './client.js'
|
|
5
11
|
|
|
6
12
|
/* Client */
|
|
@@ -21,4 +27,4 @@ export const ConnectionClientLive = Layer.effect(
|
|
|
21
27
|
preConnect: () => preConnectResolver(CONNECT_ENDPOINT),
|
|
22
28
|
}
|
|
23
29
|
}),
|
|
24
|
-
)
|
|
30
|
+
)
|
package/src/rpc/registration.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { OptionsErrors, OptionsReq, OptionsRes, VerificationErrors, VerificationReq, VerificationRes, type RegistrationService } from '@passlock/shared/dist/rpc/registration.js'
|
|
2
1
|
import { Context, Effect as E, Layer } from 'effect'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
OptionsErrors,
|
|
5
|
+
OptionsReq,
|
|
6
|
+
OptionsRes,
|
|
7
|
+
type RegistrationService,
|
|
8
|
+
VerificationErrors,
|
|
9
|
+
VerificationReq,
|
|
10
|
+
VerificationRes,
|
|
11
|
+
} from '@passlock/shared/dist/rpc/registration.js'
|
|
12
|
+
|
|
3
13
|
import { Dispatcher, makePostRequest } from './client.js'
|
|
4
14
|
|
|
5
15
|
/* Client */
|
|
@@ -28,4 +38,4 @@ export const RegistrationClientLive = Layer.effect(
|
|
|
28
38
|
verifyRegistrationCredential: req => verifyResolver('/passkey/register/verify', req),
|
|
29
39
|
}
|
|
30
40
|
}),
|
|
31
|
-
)
|
|
41
|
+
)
|
package/src/rpc/social.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { AuthOidcErrors, AuthOidcReq, PrincipalRes, RegisterOidcErrors, RegisterOidcReq, type SocialService } from '@passlock/shared/dist/rpc/social.js'
|
|
2
1
|
import { Context, Effect as E, Layer } from 'effect'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AuthOidcErrors,
|
|
5
|
+
AuthOidcReq,
|
|
6
|
+
PrincipalRes,
|
|
7
|
+
RegisterOidcErrors,
|
|
8
|
+
RegisterOidcReq,
|
|
9
|
+
type SocialService,
|
|
10
|
+
} from '@passlock/shared/dist/rpc/social.js'
|
|
11
|
+
|
|
3
12
|
import { Dispatcher, makePostRequest } from './client.js'
|
|
4
13
|
|
|
5
14
|
/* Client */
|
|
@@ -33,4 +42,4 @@ export const SocialClientLive = Layer.effect(
|
|
|
33
42
|
authenticateOidc: req => authenticateResolver(OIDC_AUTH_ENDPOINT, req),
|
|
34
43
|
}
|
|
35
44
|
}),
|
|
36
|
-
)
|
|
45
|
+
)
|
package/src/rpc/user.ts
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import * as S from '@effect/schema/Schema'
|
|
2
|
-
import { IsExistingUserReq, IsExistingUserRes, RESEND_EMAIL_ENDPOINT, ResendEmailErrors, ResendEmailReq, ResendEmailRes, USER_STATUS_ENDPOINT, VERIFY_EMAIL_ENDPOINT, VerifyEmailErrors, VerifyEmailReq, VerifyEmailRes, type UserService } from '@passlock/shared/dist/rpc/user.js'
|
|
3
2
|
import { Context, Effect as E, Layer } from 'effect'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
IsExistingUserReq,
|
|
6
|
+
IsExistingUserRes,
|
|
7
|
+
RESEND_EMAIL_ENDPOINT,
|
|
8
|
+
ResendEmailErrors,
|
|
9
|
+
ResendEmailReq,
|
|
10
|
+
ResendEmailRes,
|
|
11
|
+
USER_STATUS_ENDPOINT,
|
|
12
|
+
type UserService,
|
|
13
|
+
VERIFY_EMAIL_ENDPOINT,
|
|
14
|
+
VerifyEmailErrors,
|
|
15
|
+
VerifyEmailReq,
|
|
16
|
+
VerifyEmailRes,
|
|
17
|
+
} from '@passlock/shared/dist/rpc/user.js'
|
|
18
|
+
|
|
4
19
|
import { Dispatcher, makePostRequest } from './client.js'
|
|
5
20
|
|
|
6
21
|
/* Client */
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import * as Shared from '@passlock/shared/dist/rpc/social.js'
|
|
2
1
|
import { Effect as E, Layer as L, Option as O } from 'effect'
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
import * as Shared from '@passlock/shared/dist/rpc/social.js'
|
|
4
|
+
|
|
4
5
|
import * as Fixtures from '../test/fixtures.js'
|
|
6
|
+
import { SocialClient } from '../rpc/social.js'
|
|
5
7
|
import type { AuthenticateOidcReq } from './social.js'
|
|
6
8
|
|
|
7
9
|
export const session = 'session'
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Duplicate, NotFound } from '@passlock/shared/dist/error/error.js'
|
|
2
1
|
import { Effect as E, Layer as L, Layer, LogLevel, Logger, pipe } from 'effect'
|
|
3
2
|
import { describe, expect, test } from 'vitest'
|
|
4
3
|
import { mock } from 'vitest-mock-extended'
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
import { Duplicate, NotFound } from '@passlock/shared/dist/error/error.js'
|
|
6
|
+
|
|
6
7
|
import * as Fixture from './social.fixture.js'
|
|
8
|
+
import { SocialClient } from '../rpc/social.js'
|
|
7
9
|
import { SocialService, SocialServiceLive } from './social.js'
|
|
8
10
|
|
|
9
11
|
describe('registerOidc should', () => {
|
package/src/social/social.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Passkey authentication effects
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Context, Effect as E, Layer, flow } from 'effect'
|
|
5
|
+
|
|
5
6
|
import * as RPC from '@passlock/shared/dist/rpc/social.js'
|
|
7
|
+
import { type BadRequest, type NotSupported } from '@passlock/shared/dist/error/error.js'
|
|
6
8
|
import type { Principal } from '@passlock/shared/dist/schema/principal.js'
|
|
7
|
-
|
|
9
|
+
|
|
8
10
|
import { SocialClient } from '../rpc/social.js'
|
|
9
11
|
|
|
10
12
|
/* Requests */
|
package/src/storage/storage.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Wrapper around local storage that allows us to store
|
|
3
3
|
* authentication tokens in local storage for a short period.
|
|
4
4
|
*/
|
|
5
|
-
import type { Principal } from '@passlock/shared/dist/schema/principal.js'
|
|
6
5
|
import { Context, Effect as E, Layer, Option as O, flow, pipe } from 'effect'
|
|
7
6
|
import type { NoSuchElementException } from 'effect/Cause'
|
|
8
7
|
|
|
8
|
+
import type { Principal } from '@passlock/shared/dist/schema/principal.js'
|
|
9
|
+
|
|
9
10
|
/* Requests */
|
|
10
11
|
|
|
11
12
|
export type AuthType = 'email' | 'passkey' | 'apple' | 'google'
|
|
@@ -46,8 +47,8 @@ export const expandToken =
|
|
|
46
47
|
(s: string): O.Option<StoredToken> => {
|
|
47
48
|
const tokens = s.split(':')
|
|
48
49
|
if (tokens.length !== 2) return O.none()
|
|
49
|
-
|
|
50
|
-
const [token, expireAtString] = tokens
|
|
50
|
+
|
|
51
|
+
const [token, expireAtString] = tokens
|
|
51
52
|
if (token === undefined || expireAtString === undefined) return O.none()
|
|
52
53
|
|
|
53
54
|
const parse = O.liftThrowable(Number.parseInt)
|
package/src/test/fixtures.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Effect as E, Layer as L } from 'effect'
|
|
2
|
+
|
|
1
3
|
import { BadRequest } from '@passlock/shared/dist/error/error.js'
|
|
2
4
|
import type { Principal } from '@passlock/shared/dist/schema/principal.js'
|
|
3
|
-
|
|
5
|
+
|
|
4
6
|
import { Capabilities } from '../capabilities/capabilities.js'
|
|
5
7
|
import { StorageService, type StoredToken } from '../storage/storage.js'
|
|
6
8
|
|
|
@@ -32,7 +34,7 @@ export const principal: Principal = {
|
|
|
32
34
|
givenName: 'john',
|
|
33
35
|
familyName: 'doe',
|
|
34
36
|
email: 'john.doe@gmail.com',
|
|
35
|
-
emailVerified: false
|
|
37
|
+
emailVerified: false,
|
|
36
38
|
},
|
|
37
39
|
authStatement: {
|
|
38
40
|
authType: 'passkey',
|
package/src/user/user.fixture.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Effect as E, Layer as L, Option as O } from 'effect'
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
IsExistingUserReq,
|
|
3
5
|
IsExistingUserRes,
|
|
@@ -5,9 +7,9 @@ import {
|
|
|
5
7
|
ResendEmailRes,
|
|
6
8
|
VerifyEmailRes,
|
|
7
9
|
} from '@passlock/shared/dist/rpc/user.js'
|
|
8
|
-
|
|
9
|
-
import { UserClient } from '../rpc/user.js'
|
|
10
|
+
|
|
10
11
|
import * as Fixtures from '../test/fixtures.js'
|
|
12
|
+
import { UserClient } from '../rpc/user.js'
|
|
11
13
|
import type { ResendEmail } from './user.js'
|
|
12
14
|
|
|
13
15
|
export const email = 'jdoe@gmail.com'
|
package/src/user/user.test.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Effect as E, Layer as L, Layer, LogLevel, Logger, pipe } from 'effect'
|
|
2
2
|
import { describe, expect, test } from 'vitest'
|
|
3
3
|
import { mock } from 'vitest-mock-extended'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import * as Fixture from './user.fixture.js'
|
|
6
|
+
import { UserClient } from '../rpc/user.js'
|
|
6
7
|
import { UserService, UserServiceLive } from './user.js'
|
|
7
8
|
|
|
8
9
|
describe('isExistingUser should', () => {
|
package/src/user/user.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check for an existing user
|
|
3
3
|
*/
|
|
4
|
+
import { Context, Effect as E, Layer, flow } from 'effect'
|
|
5
|
+
|
|
4
6
|
import type { BadRequest, Disabled, NotFound } from '@passlock/shared/dist/error/error.js'
|
|
5
7
|
import { IsExistingUserReq, ResendEmailReq } from '@passlock/shared/dist/rpc/user.js'
|
|
6
8
|
import type { VerifyEmail } from '@passlock/shared/dist/schema/email.js'
|
|
7
|
-
|
|
9
|
+
|
|
8
10
|
import { UserClient } from '../rpc/user.js'
|
|
9
11
|
|
|
10
12
|
/* Requests */
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PASSLOCK_CLIENT_VERSION = '#{LATEST}#'
|
|
1
|
+
export const PASSLOCK_CLIENT_VERSION = '#{LATEST}#'
|