🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@contactsmanager/server

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contactsmanager/server

Node.js SDK for ContactsManager.io API for secure authentication and token generation

1.2.0
latest
Source
npm
Version published
Weekly downloads
56
-16.42%
Maintainers
1
Weekly downloads
 
Created
Source

ContactsManager Node.js SDK

A Node.js SDK for the ContactsManager API that handles authentication and token generation for contactsmanager.io integration.

Overview

The ContactsManager SDK enables developers to easily integrate social features into their applications. It provides secure authentication and token management, helping you build features like activity feeds, follow/unfollow functionality, and contact management while ensuring user data privacy and security.

Installation

npm install @contactsmanager/server

Usage

const { ContactsManagerClient } = require("@contactsmanager/server");

// Initialize the client
const client = new ContactsManagerClient({
  apiKey: "your_api_key",
  apiSecret: "your_api_secret",
  orgId: "your_org_id",
});

// Generate a token for a user
async function generateUserToken() {
  try {
    const tokenResponse = await client.generateToken({
      userId: "user123",
      deviceInfo: {
        // Optional
        deviceType: "mobile",
        os: "Android",
        appVersion: "1.0.0",
      },
    });

    console.log(`Token: ${tokenResponse.token}`);
    console.log(`Expires at: ${tokenResponse.expiresAt}`);
  } catch (error) {
    console.error("Error generating token:", error);
  }
}

generateUserToken();

Features

  • Simple API for generating JWT tokens for contactsmanager.io services
  • TypeScript support with type definitions
  • Comprehensive test coverage
  • Support for custom token expiration
  • Promise-based API
  • Military-grade security for user data protection

Advanced Usage

Custom Token Expiration

By default, tokens expire after 24 hours (86400 seconds). You can customize this:

// Generate a token that expires in 1 hour
const tokenResponse = await client.generateToken({
  userId: "user123",
  expirationSeconds: 3600, // 1 hour
});

Requirements

  • Node.js 14+
  • jsonwebtoken >= 9.0.0

Development

Setting up development environment

# Clone the repository
git clone https://github.com/arpwal/contactmanager.git
cd contactmanager/sdk/nodejs

# Install dependencies
npm install

# Run tests
npm test

Releasing new versions

The SDK uses an automated process for releases:

  • Update the version in package.json using npm:

    npm version patch # or minor, or major
    
  • Commit and push the change to the main branch:

    git push origin main --follow-tags
    
  • The GitHub Actions workflow will automatically:

    • Run all tests
    • Build the package
    • Publish to npm (using the NPM_TOKEN stored in GitHub secrets)
    • Create a new GitHub release with the version tag

Alternatively, you can manually trigger the workflow by going to the "Actions" tab in the GitHub repository and using the "Run workflow" button on the "Build and Publish" workflow.

License

MIT License

About ContactsManager.io

ContactsManager.io provides a platform for app developers to integrate social features into their applications. Our SDK ensures that contact information stays with users only, with multi-layer encryption and military-grade security to prevent spam and data misuse.

For more information and documentation, visit contactsmanager.io.

Keywords

contacts

FAQs

Package last updated on 25 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts