npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mifistix-cloud/auth

v2.0.5

Published

Authentication SDK for Mifistix Cloud - User authentication and session management

Downloads

402

Readme

@mifistix-cloud/auth

Authentication SDK for Mifistix Cloud - User authentication and session management.

License

This module is licensed for internal use within Mifistix only. See LICENSE for details.

Installation

npm install @mifistix-cloud/auth

Quick Start

const { initializeApp } = require('@mifistix-cloud/app');
const { getAuth, signInWithEmailAndPassword, createUserWithEmailAndPassword, signOut } = require('@mifistix-cloud/auth');

// Initialize app
const app = initializeApp({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});

// Get auth instance
const auth = getAuth(app);

// Sign in
const { user } = await signInWithEmailAndPassword(auth, '[email protected]', 'password123');
console.log('Signed in as:', user.email);

// Sign up
const { user: newUser } = await createUserWithEmailAndPassword(auth, '[email protected]', 'password123');
console.log('Created user:', newUser.uid);

// Sign out
await signOut(auth);

API Reference

getAuth(app)

Get authentication instance for an app.

Parameters:

  • app (Object, required): Initialized app instance

Returns: Auth client instance

Example:

const auth = getAuth(app);

createUserWithEmailAndPassword(auth, email, password)

Create a new user with email and password.

Parameters:

  • auth (Object): Auth instance
  • email (string, required): User email (validated)
  • password (string, required): User password (min 6 characters, validated)

Returns: Promise with { user } object

Example:

const { user } = await createUserWithEmailAndPassword(auth, '[email protected]', 'password123');

signInWithEmailAndPassword(auth, email, password)

Sign in with email and password.

Parameters:

  • auth (Object): Auth instance
  • email (string, required): User email (validated)
  • password (string, required): User password (validated)

Returns: Promise with { user } object containing token

Example:

const { user } = await signInWithEmailAndPassword(auth, '[email protected]', 'password123');
console.log('Auth token:', user.token);

signOut(auth)

Sign out current user.

Parameters:

  • auth (Object): Auth instance

Returns: Promise

Example:

await signOut(auth);

getCurrentUser(auth)

Get currently signed-in user.

Parameters:

  • auth (Object): Auth instance

Returns: User object or null

Example:

const user = getCurrentUser(auth);
if (user) {
  console.log('Current user:', user.email);
}

onAuthStateChanged(auth, callback)

Listen for authentication state changes.

Parameters:

  • auth (Object): Auth instance
  • callback (Function): Callback function that receives user object

Returns: Unsubscribe function

Example:

const unsubscribe = onAuthStateChanged(auth, (user) => {
  if (user) {
    console.log('User signed in:', user.email);
  } else {
    console.log('User signed out');
  }
});

// Later: unsubscribe();

Security Features

  • Email Validation: Validates email format before API calls
  • Password Validation: Enforces minimum 6 character password
  • Session Persistence: Securely stores session in localStorage
  • Token Management: Handles auth tokens securely
  • Error Handling: Throws AuthenticationError for auth failures
  • CSRF Protection: Project ID validation

Session Management

The auth SDK automatically:

  • Persists user session to localStorage
  • Restores session on page reload
  • Notifies listeners of auth state changes
  • Clears session on sign out

Error Handling

try {
  const { user } = await signInWithEmailAndPassword(auth, email, password);
} catch (error) {
  if (error.name === 'AuthenticationError') {
    console.error('Authentication failed:', error.message);
  } else if (error.name === 'ValidationError') {
    console.error('Invalid input:', error.message);
  }
}

Architecture

auth/
├── src/
│   ├── core/
│   │   └── AuthClient.js        # Main auth client
│   ├── services/
│   │   ├── AuthService.js       # Authentication operations
│   │   └── SessionManager.js    # Session persistence
│   ├── utils/
│   │   └── helpers.js          # Helper functions
│   ├── types/
│   │   └── index.js            # Type definitions
│   └── config/
│       └── constants.js        # Configuration constants
└── index.js

License

MIT