Saltearse al contenido

lib/auth/utils/unsafeCheck

Esta página aún no está disponible en tu idioma.

Defined in: studiocms/packages/studiocms/src/lib/auth/utils/unsafeCheck.ts:27^

A service class that provides utility functions to check if a value is unsafe, such as being a reserved username or a password.

This service uses logging and effect-based programming to perform the checks.

const checkIfUnsafe = CheckIfUnsafe;
const isReservedUsername = yield* checkIfUnsafe.username('admin');
const isPassword = yield* checkIfUnsafe.password('123456');
  • any

new CheckIfUnsafe(): CheckIfUnsafe

CheckIfUnsafe

Effect.Service<CheckIfUnsafe>()(
'studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe',
{
effect: genLogger('studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe.effect')(function () {
/
Checks if a value is a reserved username
@param value - The value to check
@returns An object containing functions to check if the value is a reserved username or password
/
const username = (val: string) =>
pipeLogger('studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe.username')(
Effect.try({
try: () => usernameList.includes(val),
catch: (cause) =>
new CheckIfUnsafeError({
message: An unknown Error occurred when checking the username list: ${cause},
}),
})
);
/
Checks if a value is a password
@param value - The value to check
@returns An object containing functions to check if the value is a reserved username or password
/
const password = (val: string) =>
pipeLogger('studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe.password')(
Effect.try({
try: () => passwordList.includes(val),
catch: (cause) =>
new CheckIfUnsafeError({
message: An unknown Error occurred when checking the password list: ${cause},
}),
})
);
return {
username,
password,
};
}),
}
).constructor

Defined in: studiocms/packages/studiocms/src/lib/auth/utils/unsafeCheck.ts:6^

  • any

new CheckIfUnsafeError(): CheckIfUnsafeError

CheckIfUnsafeError

Data.TaggedError('CheckIfUnsafeError')<{
message: string;
}>.constructor