@withstudiocms/auth-kit 0.1.2 → 0.1.4

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/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { Password } from './modules/password.js';
9
9
  * @returns An Effect that provides an object with a `run` method for performing scrypt operations.
10
10
  */
11
11
  export declare const makeScrypt: (config: PasswordModConfigFinal) => Effect.Effect<Effect.Effect<{
12
- run: (password: import("crypto").BinaryLike) => Effect.Effect<Buffer<ArrayBufferLike>, import("@withstudiocms/effect/scrypt").ScryptError, never>;
12
+ run: (password: import("crypto").BinaryLike) => Effect.Effect<Buffer<ArrayBufferLike>, import("effectify/scrypt").ScryptError, never>;
13
13
  }, never, never>, AuthKitError, never>;
14
14
  declare const AuthKit_base: Effect.Service.Class<AuthKit, "@withstudiocms/AuthKit", {
15
15
  readonly effect: Effect.Effect<{
@@ -20,8 +20,8 @@ declare const AuthKit_base: Effect.Service.Class<AuthKit, "@withstudiocms/AuthKi
20
20
  readonly decryptToString: (data: Uint8Array<ArrayBufferLike>) => Effect.Effect<string, import("./errors.js").DecryptionError, never>;
21
21
  }, import("./errors.js").EncryptionError, never>;
22
22
  readonly Password: Effect.Effect<{
23
- readonly hashPassword: (password: string, _salt?: string | undefined) => Effect.Effect<string, import("@withstudiocms/effect/scrypt").ScryptError, never>;
24
- readonly verifyPasswordHash: (hash: string, password: string) => Effect.Effect<boolean, import("@withstudiocms/effect/scrypt").ScryptError | import("./errors.js").PasswordError, never>;
23
+ readonly hashPassword: (password: string, _salt?: string | undefined) => Effect.Effect<string, import("effectify/scrypt").ScryptError, never>;
24
+ readonly verifyPasswordHash: (hash: string, password: string) => Effect.Effect<boolean, import("effectify/scrypt").ScryptError | import("./errors.js").PasswordError, never>;
25
25
  readonly verifyPasswordStrength: (pass: string) => Effect.Effect<string | true, import("./errors.js").PasswordError | import("./errors.js").CheckIfUnsafeError | import("@effect/platform/HttpClientError").ResponseError, never>;
26
26
  }, never, never>;
27
27
  readonly Session: Effect.Effect<{
@@ -37,17 +37,17 @@ declare const AuthKit_base: Effect.Service.Class<AuthKit, "@withstudiocms/AuthKi
37
37
  readonly User: Effect.Effect<{
38
38
  readonly verifyUsernameInput: (username: string) => Effect.Effect<string | true, import("./errors.js").CheckIfUnsafeError | import("./errors.js").UserError, never>;
39
39
  readonly createUserAvatar: (email: string) => Effect.Effect<string, import("./errors.js").UserError, never>;
40
- readonly createLocalUser: (name: string, username: string, email: string, password: string) => Effect.Effect<import("./types.js").UserData, import("@withstudiocms/effect/scrypt").ScryptError | import("./errors.js").UserError, never>;
40
+ readonly createLocalUser: (name: string, username: string, email: string, password: string) => Effect.Effect<import("./types.js").UserData, import("effectify/scrypt").ScryptError | import("./errors.js").UserError, never>;
41
41
  readonly createOAuthUser: (data: import("./types.js").UserDataInsert, oAuthFields: {
42
42
  provider: string;
43
43
  providerUserId: string;
44
44
  }) => Effect.Effect<import("./types.js").UserData, import("./errors.js").UserError, never>;
45
- readonly updateUserPassword: (userId: string, password: string) => Effect.Effect<import("./types.js").UserData, import("@withstudiocms/effect/scrypt").ScryptError | import("./errors.js").UserError, never>;
45
+ readonly updateUserPassword: (userId: string, password: string) => Effect.Effect<import("./types.js").UserData, import("effectify/scrypt").ScryptError | import("./errors.js").UserError, never>;
46
46
  readonly getUserPasswordHash: (userId: string) => Effect.Effect<string, import("./errors.js").UserError, never>;
47
47
  readonly getUserFromEmail: (email: string) => Effect.Effect<import("./types.js").CombinedUserData | null | undefined, import("./errors.js").UserError, never>;
48
48
  readonly getUserData: (context: import("astro").APIContext | import("astro").AstroGlobal<Record<string, any>, import("astro/runtime/server/index.js").AstroComponentFactory, Record<string, string | undefined>>) => Effect.Effect<import("./types.js").UserSessionData, import("./errors.js").SessionError | import("./errors.js").UserError, never>;
49
49
  readonly getUserPermissionLevel: (userData: import("./types.js").UserSessionData | import("./types.js").CombinedUserData | null) => Effect.Effect<import("./types.js").UserPermissionLevel, import("./errors.js").UserError, never>;
50
- readonly isUserAllowed: (userData: import("./types.js").UserSessionData | import("./types.js").CombinedUserData | null, requiredPerms: "owner" | "admin" | "editor" | "visitor" | "unknown") => Effect.Effect<boolean, import("./errors.js").UserError, never>;
50
+ readonly isUserAllowed: (userData: import("./types.js").UserSessionData | import("./types.js").CombinedUserData | null, requiredPerms: "unknown" | "visitor" | "editor" | "admin" | "owner") => Effect.Effect<boolean, import("./errors.js").UserError, never>;
51
51
  }, import("./errors.js").SessionError | import("./errors.js").UserError, never>;
52
52
  }, AuthKitError, AuthKitOptions>;
53
53
  }>;
@@ -12,7 +12,7 @@ import type { IScrypt } from '../types.js';
12
12
  * @module @withstudiocms/AuthKit/modules/password
13
13
  */
14
14
  export declare const Password: (Scrypt: IScrypt) => Effect.Effect<{
15
- readonly hashPassword: (password: string, _salt?: string | undefined) => Effect.Effect<string, import("@withstudiocms/effect/scrypt").ScryptError, never>;
16
- readonly verifyPasswordHash: (hash: string, password: string) => Effect.Effect<boolean, import("@withstudiocms/effect/scrypt").ScryptError | import("../errors.js").PasswordError, never>;
15
+ readonly hashPassword: (password: string, _salt?: string | undefined) => Effect.Effect<string, import("effectify/scrypt").ScryptError, never>;
16
+ readonly verifyPasswordHash: (hash: string, password: string) => Effect.Effect<boolean, import("effectify/scrypt").ScryptError | import("../errors.js").PasswordError, never>;
17
17
  readonly verifyPasswordStrength: (pass: string) => Effect.Effect<string | true, import("../errors.js").PasswordError | import("../errors.js").CheckIfUnsafeError | import("@effect/platform/HttpClientError").ResponseError, never>;
18
18
  }, never, never>;
@@ -35,15 +35,15 @@ import { UserPermissionLevel } from '../types.js';
35
35
  export declare const User: ({ Scrypt, session, userTools }: UserConfig) => Effect.Effect<{
36
36
  readonly verifyUsernameInput: (username: string) => Effect.Effect<string | true, import("../errors.js").CheckIfUnsafeError | UserError, never>;
37
37
  readonly createUserAvatar: (email: string) => Effect.Effect<string, UserError, never>;
38
- readonly createLocalUser: (name: string, username: string, email: string, password: string) => Effect.Effect<import("../types.js").UserData, import("@withstudiocms/effect/scrypt").ScryptError | UserError, never>;
38
+ readonly createLocalUser: (name: string, username: string, email: string, password: string) => Effect.Effect<import("../types.js").UserData, import("effectify/scrypt").ScryptError | UserError, never>;
39
39
  readonly createOAuthUser: (data: UserDataInsert, oAuthFields: {
40
40
  provider: string;
41
41
  providerUserId: string;
42
42
  }) => Effect.Effect<import("../types.js").UserData, UserError, never>;
43
- readonly updateUserPassword: (userId: string, password: string) => Effect.Effect<import("../types.js").UserData, import("@withstudiocms/effect/scrypt").ScryptError | UserError, never>;
43
+ readonly updateUserPassword: (userId: string, password: string) => Effect.Effect<import("../types.js").UserData, import("effectify/scrypt").ScryptError | UserError, never>;
44
44
  readonly getUserPasswordHash: (userId: string) => Effect.Effect<string, UserError, never>;
45
45
  readonly getUserFromEmail: (email: string) => Effect.Effect<CombinedUserData | null | undefined, UserError, never>;
46
46
  readonly getUserData: (context: APIContext | AstroGlobal<Record<string, any>, import("astro/runtime/server/index.js").AstroComponentFactory, Record<string, string | undefined>>) => Effect.Effect<UserSessionData, import("../errors.js").SessionError | UserError, never>;
47
47
  readonly getUserPermissionLevel: (userData: UserSessionData | CombinedUserData | null) => Effect.Effect<UserPermissionLevel, UserError, never>;
48
- readonly isUserAllowed: (userData: UserSessionData | CombinedUserData | null, requiredPerms: "owner" | "admin" | "editor" | "visitor" | "unknown") => Effect.Effect<boolean, UserError, never>;
48
+ readonly isUserAllowed: (userData: UserSessionData | CombinedUserData | null, requiredPerms: "unknown" | "visitor" | "editor" | "admin" | "owner") => Effect.Effect<boolean, UserError, never>;
49
49
  }, import("../errors.js").SessionError | UserError, never>;
package/dist/types.d.ts CHANGED
@@ -82,7 +82,7 @@ export interface OAuthData {
82
82
  * - 'visitor': A low-level permission, for users who can view content but not modify it.
83
83
  * - 'unknown': A default or fallback permission rank for users with undefined roles.
84
84
  */
85
- export declare const availablePermissionRanks: readonly ["owner", "admin", "editor", "visitor", "unknown"];
85
+ export declare const availablePermissionRanks: readonly ["unknown", "visitor", "editor", "admin", "owner"];
86
86
  /**
87
87
  * Represents the available permission ranks for a user.
88
88
  *
package/dist/types.js CHANGED
@@ -1,4 +1,4 @@
1
- const availablePermissionRanks = ["owner", "admin", "editor", "visitor", "unknown"];
1
+ const availablePermissionRanks = ["unknown", "visitor", "editor", "admin", "owner"];
2
2
  var UserPermissionLevel = /* @__PURE__ */ ((UserPermissionLevel2) => {
3
3
  UserPermissionLevel2[UserPermissionLevel2["visitor"] = 1] = "visitor";
4
4
  UserPermissionLevel2[UserPermissionLevel2["editor"] = 2] = "editor";
@@ -51,7 +51,7 @@ export declare const getDefaultUserSession: () => Effect.Effect<UserSessionData,
51
51
  * @param userData - The user session or combined user data object, or null.
52
52
  * @returns The user's permission level as an `AvailablePermissionRanks` value, or `'unknown'` if not determinable.
53
53
  */
54
- export declare const getLevel: (userData: UserSessionData | CombinedUserData | null) => Effect.Effect<"owner" | "admin" | "editor" | "visitor" | "unknown", import("../errors.js").UserError, never>;
54
+ export declare const getLevel: (userData: UserSessionData | CombinedUserData | null) => Effect.Effect<"unknown" | "visitor" | "editor" | "admin" | "owner", import("../errors.js").UserError, never>;
55
55
  /**
56
56
  * Parses the given required permission rank and returns the corresponding `UserPermissionLevel`.
57
57
  * If the provided permission rank does not match any known value, it returns `UserPermissionLevel.unknown`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withstudiocms/auth-kit",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Utilities for managing authentication",
5
5
  "author": {
6
6
  "name": "withstudiocms",
@@ -59,7 +59,7 @@
59
59
  "@oslojs/binary": "^1.0.0",
60
60
  "@oslojs/crypto": "^1.0.1",
61
61
  "@oslojs/encoding": "^1.1.0",
62
- "@withstudiocms/effect": "^0.2.0"
62
+ "@withstudiocms/effect": "^0.4.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@types/node": "^22.0.0"