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 🙏

© 2025 – Pkg Stats / Ryan Hefner

managercc

v1.1.11

Published

controller @ managers.center

Downloads

23

Readme

ManagerCC CLI & API

npm version License: ISC

A comprehensive Node.js CLI tool and API library for managing authentication, groups, and bearer tokens in the Managers.Center system.

🚀 Features

CLI Commands

  • Manager Authentication: Sign up, login, logout, and check status
  • Group Management: Create, list, and manage groups
  • Token Generation: Generate bearer tokens for API access
  • Public Key Management: Get and manage public keys for token verification

Node.js API

  • loginManager(email, password): Programmatic manager login
  • checkManager(managerAuth): Verify manager authentication status
  • getGroupList(managerAuth): Retrieve all manager groups
  • generateBearerToken(managerAuth, groupCode, secsToExpired?, aud?): Generate bearer token for specific group

📦 Installation

Global CLI Installation

npm install -g managercc

Local Package Installation

npm install managercc

🔧 CLI Usage

Quick Start

  1. Sign up as a manager:
managercc signup
  1. Login:
managercc login
  1. Create a group:
managercc create group
  1. List all groups:
managercc list
  1. Generate bearer token:
managercc generate bearertoken
  1. Get public key:
managercc get publickey

Available Commands

| Command | Description | Example | |---------|-------------|---------| | signup | Register a new manager account | managercc signup | | login | Login with manager credentials | managercc login | | logout | Logout current session | managercc logout | | whoami | Check current login status | managercc whoami | | create group | Create a new group | managercc create group | | list | List all manager groups | managercc list | | generate bearertoken | Generate bearer token for group | managercc generate bearertoken | | get publickey | Get manager's public key | managercc get publickey |

💻 Node.js API Usage

Basic Setup

const managercc = require('managercc');

// Login and get authentication
async function setupManager() {
    const loginResult = await managercc.loginManager('[email protected]', 'your-password');
    
    if (loginResult.success) {
        const managerAuth = loginResult.data.auth;
        console.log('Login successful:', loginResult.data.manager.suuid);
        return managerAuth;
    } else {
        console.error('Login failed:', loginResult.message);
        return null;
    }
}

Manager Authentication

// Login manager
const loginResult = await managercc.loginManager('[email protected]', 'password123');

// Check authentication status
const checkResult = await managercc.checkManager(managerAuth);
if (checkResult.success) {
    console.log('Manager authenticated:', checkResult.data.manager.name);
}

Group Management

// Get all groups
const groupsResult = await managercc.getGroupList(managerAuth);
if (groupsResult.success) {
    console.log(`Found ${groupsResult.data.total} groups:`);
    groupsResult.data.groups.forEach(group => {
        console.log(`- [${group.code}] ${group.name}`);
    });
}

Bearer Token Generation

// Generate bearer token for a specific group
const tokenResult = await managercc.generateBearerToken(managerAuth, 'group-code', 3600, 'api-client');
if (tokenResult.success) {
    console.log('Token generated successfully!');
    console.log('Token:', tokenResult.data.token);
    console.log('Expires in:', tokenResult.data.expiresIn, 'seconds');
    console.log('Audience:', tokenResult.data.audience);
} else {
    console.log('Token generation failed:', tokenResult.message);
}

Complete Workflow Example

const managercc = require('managercc');

async function completeWorkflow() {
    try {
        // 1. Login manager
        const login = await managercc.loginManager('[email protected]', 'password');
        if (!login.success) throw new Error('Login failed');
        
        // 2. Check authentication
        const check = await managercc.checkManager(login.data.auth);
        if (!check.success) throw new Error('Authentication check failed');
        
        // 3. Get groups
        const groups = await managercc.getGroupList(login.data.auth);
        if (!groups.success) throw new Error('Failed to get groups');
        
        // 4. Generate token for first group
        const firstGroup = groups.data.groups[0];
        const token = await managercc.generateBearerToken(
            login.data.auth, 
            firstGroup.code, 
            7200,  // 2 hours
            'my-app'  // audience
        );
        
        if (token.success) {
            console.log('Complete workflow successful!');
            console.log('Generated token for group:', firstGroup.code);
            console.log('Token expires in:', token.data.expiresIn, 'seconds');
        }
        
    } catch (error) {
        console.error('Workflow failed:', error.message);
    }
}

completeWorkflow();

📋 API Reference

loginManager(email, password)

Login a manager and return authentication data.

Parameters:

  • email (string): Manager's email address
  • password (string): Manager's password

Returns:

{
    success: boolean,
    message: string,
    data: {
        manager: {
            suuid: string,
            loginTime: string
        },
        auth: {
            suuid: string,
            accessToken: string
        }
    }
}

checkManager(managerAuth)

Verify manager authentication status.

Parameters:

  • managerAuth (object): Authentication object from login

Returns:

{
    success: boolean,
    message: string,
    data: {
        manager: {
            suuid: string,
            name: string,
            email: string,
            status: string,
            checkedAt: string
        },
        auth: object
    }
}

getGroupList(managerAuth)

Retrieve all groups for the authenticated manager.

Parameters:

  • managerAuth (object): Authentication object from login

Returns:

{
    success: boolean,
    message: string,
    data: {
        groups: [
            {
                index: number,
                suuid: string,
                code: string,
                name: string,
                created_at: number,
                manager_suuid: string
            }
        ],
        total: number,
        manager: {
            suuid: string,
            name: string
        }
    }
}

generateBearerToken(managerAuth, groupCode, secsToExpired?, aud?)

Generate a bearer token for a specific group.

Parameters:

  • managerAuth (object): Authentication object from login
  • groupCode (string): Code of the group to generate token for
  • secsToExpired (number, optional): Token expiration time in seconds (default: 3600)
  • aud (string, optional): Token audience (default: null)

Returns:

{
    success: boolean,
    message: string,
    data: {
        groupCode: string,
        token: string,
        expiresIn: number,
        audience: string,
        generatedAt: string,
        manager: {
            suuid: string
        }
    }
}

Example:

// Basic usage
const token = await managercc.generateBearerToken(managerAuth, 'my-group');

// With custom expiration and audience
const token = await managercc.generateBearerToken(
    managerAuth, 
    'my-group', 
    7200,        // 2 hours
    'api-client' // custom audience
);

if (token.success) {
    console.log('Token:', token.data.token);
    console.log('Expires in:', token.data.expiresIn, 'seconds');
}

📄 License

This project is licensed under the ISC License - see the LICENSE file for details.


Version: 1.1.8
Last Updated: 2025-10-17