Skip to main content

A JavaScript/TypeScript package providing common utilities and logic shared across all Temboplus-Afloat Projects

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
64%
Published
3 weeks ago (0.1.28)
class AfloatAuth

Singleton class responsible for user authentication and session management.

Constructors

new
AfloatAuth()

Private constructor to prevent direct instantiation.

Properties

readonly
currentUser: User | undefined

Gets the currently logged-in user.

private
readonly
repo: AuthRepository

Fetches the authentication repository.

Methods

Checks if the current user has the specified permission.

private
clearSavedData(): void

Clears saved authentication data from the store and session storage.

getUserToken(): string | undefined

Retrieves the current user's authentication token.

logIn(
email: string,
password: string,
): Promise<User>

Logs in a user with the provided email and password.

logOut(): void

Logs out the current user and clears session data.

Resets the user's password.

useCurrentUser(): User | undefined

React hook that retrieves the currently authenticated user from the global store.

Static Properties

Gets the singleton instance of AfloatAuth.

Add Package

deno add jsr:@temboplus/afloat

Import symbol

import { AfloatAuth } from "@temboplus/afloat";

---- OR ----

Import directly with a jsr specifier

import { AfloatAuth } from "jsr:@temboplus/afloat";

Add Package

npx jsr add @temboplus/afloat

Import symbol

import { AfloatAuth } from "@temboplus/afloat";

Add Package

yarn dlx jsr add @temboplus/afloat

Import symbol

import { AfloatAuth } from "@temboplus/afloat";

Add Package

pnpm dlx jsr add @temboplus/afloat

Import symbol

import { AfloatAuth } from "@temboplus/afloat";

Add Package

bunx jsr add @temboplus/afloat

Import symbol

import { AfloatAuth } from "@temboplus/afloat";