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

aegis-auth-navchetna

v1.0.3

Published

Aegis Auth is a unified identity management system providing memory-safe Rust-based authentication. Consolidation of disparate identity providers into a single canonical source.

Readme

<<<<<<< HEAD

Aegis Auth - JavaScript SDK

Aegis Auth is a unified identity management system providing memory-safe Rust-based authentication. Consolidation of disparate identity providers into a single canonical source.

Aegis Auth by Navchetna Technologies.
Securing the future of decentralized identity.
© 2026 Standard Core v3.


Official JavaScript SDK for the Aegis Authentication System. Supports traditional authentication, WebAuthn/Passkeys, MFA, and more.

Installation

Via CDN

<script src="https://cdn.jsdelivr.net/npm/aegis-auth-navchetna@latest/aegis-sdk.min.js"></script>

Via npm

npm install aegis-auth-navchetna

Via yarn

yarn add aegis-auth-navchetna

Quick Start

CDN Usage

<!DOCTYPE html>
<html>
<head>
    <script src="https://cdn.jsdelivr.net/npm/@aegis/auth-sdk@latest/aegis-sdk.min.js"></script>
</head>
<body>
    <script>
        const aegis = Aegis.create({
            apiKey: 'your-api-key-here'
        });

        // Login example
        aegis.login('[email protected]', 'password')
            .then(response => {
                console.log('Logged in:', response.user);
            })
            .catch(error => {
                console.error('Login failed:', error);
            });
    </script>
</body>
</html>

ES6 Module Usage

import Aegis from 'aegis-auth-navchetna';

const aegis = Aegis.create({
    apiKey: 'your-api-key-here',
    baseURL: 'https://your-aegis-instance.com' // Optional
});

CommonJS Usage

const Aegis = require('aegis-auth-navchetna');

const aegis = Aegis.create({
    apiKey: 'your-api-key-here'
});

Configuration

const aegis = Aegis.create({
    apiKey: 'your-api-key-here',           // Required: Your project API key
    baseURL: 'https://your-instance.com'   // Optional: Custom Aegis instance URL
});

Authentication Methods

Email/Password Authentication

Login

try {
    const response = await aegis.login('[email protected]', 'password');
    console.log('User:', response.user);
    console.log('Access Token:', response.access_token);
} catch (error) {
    console.error('Login failed:', error.message);
}

Register

try {
    const response = await aegis.register({
        email: '[email protected]',
        password: 'securePassword123',
        first_name: 'John',
        last_name: 'Doe'
    });
    console.log('Registration successful:', response);
} catch (error) {
    console.error('Registration failed:', error.message);
}

Logout

await aegis.logout();

WebAuthn/Passkeys

Check WebAuthn Support

if (aegis.isWebAuthnSupported()) {
    console.log('WebAuthn is supported');
} else {
    console.log('WebAuthn is not supported');
}

Register WebAuthn Credential

try {
    const response = await aegis.startWebAuthnRegistration();
    console.log('WebAuthn credential registered:', response);
} catch (error) {
    console.error('WebAuthn registration failed:', error.message);
}

Login with WebAuthn

try {
    const response = await aegis.startWebAuthnLogin();
    console.log('WebAuthn login successful:', response.user);
} catch (error) {
    console.error('WebAuthn login failed:', error.message);
}

Multi-Factor Authentication (MFA)

Enable MFA

try {
    const response = await aegis.enableMFA();
    console.log('QR Code:', response.qr_code);
    console.log('Secret:', response.secret);
    console.log('Backup Codes:', response.backup_codes);
} catch (error) {
    console.error('MFA enable failed:', error.message);
}

Verify MFA Code

try {
    const response = await aegis.verifyMFA('123456');
    console.log('MFA verified:', response);
} catch (error) {
    console.error('MFA verification failed:', error.message);
}

Disable MFA

try {
    await aegis.disableMFA('123456');
    console.log('MFA disabled');
} catch (error) {
    console.error('MFA disable failed:', error.message);
}

Password Reset

Request Password Reset

try {
    await aegis.forgotPassword('[email protected]');
    console.log('Password reset email sent');
} catch (error) {
    console.error('Password reset request failed:', error.message);
}

Reset Password

try {
    await aegis.resetPassword('reset-token', 'newPassword123');
    console.log('Password reset successful');
} catch (error) {
    console.error('Password reset failed:', error.message);
}

User Profile Management

Get User Profile

try {
    const profile = await aegis.getProfile();
    console.log('User profile:', profile);
} catch (error) {
    console.error('Failed to get profile:', error.message);
}

Update User Profile

try {
    const response = await aegis.updateProfile({
        first_name: 'Jane',
        last_name: 'Smith',
        phone: '+1234567890'
    });
    console.log('Profile updated:', response);
} catch (error) {
    console.error('Profile update failed:', error.message);
}

Token Management

Check Authentication Status

if (aegis.isAuthenticated()) {
    console.log('User is authenticated');
    console.log('Current user:', aegis.getUser());
} else {
    console.log('User is not authenticated');
}

Get Access Token

const token = aegis.getAccessToken();
if (token) {
    console.log('Access token:', token);
}

Manual Token Refresh

try {
    const response = await aegis.refreshAccessToken();
    console.log('Token refreshed:', response);
} catch (error) {
    console.error('Token refresh failed:', error.message);
}

Event Handling

The SDK emits events for various authentication states:

// Listen for login events
aegis.on('login', (user) => {
    console.log('User logged in:', user);
});

// Listen for logout events
aegis.on('logout', () => {
    console.log('User logged out');
});

// Listen for token refresh events
aegis.on('tokenRefresh', (user) => {
    console.log('Token refreshed for user:', user);
});

// Listen for error events
aegis.on('error', (errorData) => {
    console.error('SDK Error:', errorData.error);
    console.error('Endpoint:', errorData.endpoint);
});

Advanced Usage

Custom Request Headers

const response = await aegis.request('/custom/endpoint', {
    method: 'POST',
    headers: {
        'Custom-Header': 'value'
    },
    body: { data: 'example' }
});

Skip Authentication for Public Endpoints

const response = await aegis.request('/public/endpoint', {
    skipAuth: true
});

Error Handling

The SDK throws descriptive errors that you can catch and handle:

try {
    await aegis.login('[email protected]', 'wrongpassword');
} catch (error) {
    if (error.message.includes('Invalid credentials')) {
        // Handle invalid credentials
        console.log('Please check your email and password');
    } else if (error.message.includes('Network')) {
        // Handle network errors
        console.log('Please check your internet connection');
    } else {
        // Handle other errors
        console.log('An unexpected error occurred');
    }
}

Browser Compatibility

  • Chrome 67+
  • Firefox 60+
  • Safari 13+
  • Edge 79+

WebAuthn features require HTTPS in production.

TypeScript Support

The SDK includes TypeScript definitions:

import Aegis, { AegisConfig, User, AuthResponse } from 'aegis-auth-navchetna';

const config: AegisConfig = {
    apiKey: 'your-api-key'
};

const aegis = Aegis.create(config);

aegis.login('[email protected]', 'password')
    .then((response: AuthResponse) => {
        const user: User = response.user;
        console.log('Logged in user:', user);
    });

Security Best Practices

  1. Never expose your API key in client-side code in production
  2. Use HTTPS in production environments
  3. Implement proper error handling to avoid exposing sensitive information
  4. Store tokens securely - the SDK uses localStorage by default
  5. Implement logout functionality to clear tokens when users sign out

Support


Aegis Auth by Navchetna Technologies
Securing the future of decentralized identity
© 2026 Standard Core v3

License

MIT License - see LICENSE file for details.

aegis-auth-sdk

Aegis Auth is a unified identity management system providing memory-safe Rust-based authentication. Consolidation of disparate identity providers into a single canonical source.

746fc2c4376c26a198a776b3dbc55aa02e19befa