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

@humanos-ai/sdk

v1.0.10

Published

Official Humanos API SDK for TypeScript/JavaScript with automatic request signing and webhook verification

Downloads

1,408

Readme

Humanos SDK for TypeScript/JavaScript

Official TypeScript/JavaScript SDK for the Humanos API. Provides automatic request signing, webhook verification and decryption, and full API access for credential management.

npm version License: MIT

Features

  • Automatic Request Signing - All API requests are signed with HMAC-SHA256
  • Webhook Verification - Verify signatures and decrypt encrypted payloads
  • TypeScript Support - Full type definitions included
  • Simple API - Clean interface for all Humanos endpoints

Getting Started

1. Create an Account

Sign up at humanos.id and create your organization.

2. Get Your API Keys

In the Humanos Dashboard, go to Settings > API Keys and copy:

  • API Key - Used to authenticate requests
  • Signature Secret - Used to sign requests with HMAC-SHA256

3. Get Your Webhook Keys

In the Humanos Dashboard, go to Settings > Webhooks and copy:

  • Webhook Signature Secret - Used to verify incoming webhook signatures
  • Webhook Encryption Secret - Used to decrypt webhook payloads
  • Webhook Encryption Salt - Used alongside the encryption secret

4. Install the SDK

npm install @humanos-ai/sdk

5. Initialize the Client

import { HumanosClient } from "@humanos-ai/sdk";

const client = new HumanosClient({
  basePath: "https://api.humanos.id",
  apiKey: process.env.HUMANOS_API_KEY!,
  signatureSecret: process.env.HUMANOS_SIGNATURE_SECRET!,
});

6. Make Your First API Call

Fetch all your credential requests:

const response = await client.requests.getRequests();
console.log(response.data);

Usage Examples

Create a Credential Request

Send a credential request to one or more contacts using pre-configured resources:

const request = await client.requests.generate({
  contacts: ["[email protected]"],
  securityLevel: "CONTACT",
  resourcesIds: ["your-resource-id"],
});

console.log("Request ID:", request.data.id);
console.log("Credentials:", request.data.credentials);

You can also use group IDs to include all resources in a group:

const request = await client.requests.generate({
  contacts: ["[email protected]"],
  securityLevel: "CONTACT",
  groupIds: ["your-group-id"],
});

Or provide inline credential data directly:

const request = await client.requests.generate({
  contacts: ["[email protected]"],
  securityLevel: "CONTACT",
  credentials: [
    {
      scope: "onboarding",
      type: "JSON",
      name: "Service Agreement",
      data: [
        { label: "Company", type: "string", value: "Acme Corp" },
        { label: "Plan", type: "string", value: "Enterprise" },
      ],
    },
  ],
});

Receive Webhooks

Humanos sends webhook events when credentials are signed, identity checks complete, or OTPs fail. Payloads are encrypted and signed.

The SDK provides createWebhookHandler which handles signature verification and payload decryption automatically:

import express from "express";
import { createWebhookHandler, WebhookConfig } from "@humanos-ai/sdk";

const app = express();

// Use express.text() to preserve the raw body for signature verification
app.use(express.text({ type: "application/json" }));

const webhookConfig: WebhookConfig = {
  signatureSecret: process.env.HUMANOS_WEBHOOK_SIGNATURE_SECRET!,
  encryptionSecret: process.env.HUMANOS_WEBHOOK_ENCRYPTION_SECRET!,
  encryptionSalt: process.env.HUMANOS_WEBHOOK_ENCRYPTION_SALT!,
};

app.post(
  "/webhook",
  createWebhookHandler(webhookConfig, (payload) => {
    console.log("Event type:", payload.eventType);

    switch (payload.eventType) {
      case "credential":
        console.log("Credential signed:", payload.requestId);
        break;
      case "identity":
        console.log("Identity verified:", payload.requestId);
        break;
      case "otp.failed":
        console.log("OTP failed:", payload.requestId);
        break;
      case "test":
        console.log("Test event received");
        break;
    }
  }),
);

app.listen(3000, () => {
  console.log("Webhook server listening on port 3000");
});

For local development, use ngrok to expose your server:

ngrok http 3000

Then set the ngrok URL (e.g. https://xxxx.ngrok-free.app/webhook) as your webhook URL in the Humanos Dashboard under Settings > Webhooks.

API Reference

Resources

// List resources
const resources = await client.resources.getResources();

// List resource groups
const groups = await client.resources.getGroups();

// Download a credential file
const file = await client.resources.download(credentialId);

Requests

// List requests
const requests = await client.requests.getRequests();

// Get request details
const detail = await client.requests.getRequestDetail(requestId);

// Create a credential request
const request = await client.requests.generate({ ... });

// Cancel a request
await client.requests.cancelRequest(requestId);

// Resend OTP
await client.requests.resendOtp(requestId);

Users

// Create or update users
const users = await client.users.create([
  {
    contact: "[email protected]",
    internalId: "your-internal-id",
    identity: {
      fullName: "John Doe",
      birth: "1990-01-01",
      docId: "123456789",
      countryAlpha3: "USA",
    },
  },
]);

Error Handling

The SDK throws errors for failed requests. The error object includes the HTTP response when available:

try {
  const request = await client.requests.generate({ ... });
} catch (error) {
  if (error.response) {
    console.error('Status:', error.response.status);
    console.error('Body:', error.response.data);
  } else {
    console.error('Error:', error.message);
  }
}

Documentation

Support

License

MIT License - see LICENSE file for details.