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

signinid

v0.3.0

Published

Node.js SDK for SigninID sandbox email testing API

Downloads

131

Readme

SigninID Node.js SDK

Node.js SDK for the SigninID sandbox email testing API. Capture and inspect test emails with automatic OTP detection.

Homepage | Documentation

Installation

npm install signinid

Quick Start

import { SigninID } from 'signinid';

// Set SIGNINID_SECRET_KEY environment variable
const client = new SigninID();

// Wait for a new verification email to arrive
const email = await client.inbox.waitForNew({ to: '[email protected]' });

// Extract the OTP
if (email) {
  console.log('Verification code:', email.detected_otp);
}

Features

  • Full TypeScript support
  • Automatic OTP detection
  • Polling support for E2E tests (waitForNew)
  • Filter emails by sender, recipient, subject, and date
  • Page-based pagination
  • ESM and CommonJS support

API Reference

Constructor

import { SigninID } from 'signinid';

const client = new SigninID(options?: SigninIDOptions);

| Option | Type | Default | Description | |--------|------|---------|-------------| | secretKey | string | process.env.SIGNINID_SECRET_KEY | API secret key (must start with sk_live_) | | timeout | number | 30000 | Request timeout in milliseconds |

Inbox Methods

inbox.waitForNew(params?)

Wait for a new email to arrive. Polls until a new email arrives or timeout is reached.

const email = await client.inbox.waitForNew({
  to: '[email protected]',
  timeout: 30000  // 30 seconds (default)
});

if (email) {
  console.log('OTP:', email.detected_otp);
}

inbox.latest(params?)

Get the most recent inbox email.

const email = await client.inbox.latest();

// With filters
const email = await client.inbox.latest({
  to: '[email protected]',
  after: new Date('2024-01-01')
});

inbox.get(emailId)

Get a single email by ID.

const email = await client.inbox.get('550e8400-e29b-41d4-a716-446655440000');

inbox.list(params?)

List inbox email IDs with pagination.

const { data: ids, pagination } = await client.inbox.list({
  page: 1,
  per_page: 10,
  to: '[email protected]',
  from: '[email protected]',
  subject: 'verification',
  after: new Date('2024-01-01'),
  before: new Date('2024-12-31')
});

// Fetch full details for each email
for (const id of ids) {
  const email = await client.inbox.get(id);
  console.log(email.subject);
}

// Check pagination
console.log('Has more:', pagination.has_more);

Sent Methods

sent.latest(params?)

Get the most recent sent email.

const email = await client.sent.latest();

sent.get(emailId)

Get a single sent email by ID.

const email = await client.sent.get('550e8400-e29b-41d4-a716-446655440000');

sent.list(params?)

List sent email IDs with pagination.

const { data: ids, pagination } = await client.sent.list({
  page: 1,
  per_page: 10,
  to: '[email protected]'
});

Query Parameters

| Parameter | Type | Description | |-----------|------|-------------| | page | number | Page number (default: 1) | | per_page | number | Results per page (1-100, default: 10) | | from | string | Filter by sender (partial match) | | to | string | Filter by recipient (partial match) | | subject | string | Filter by subject (partial match) | | before | Date | string | Emails before this date | | after | Date | string | Emails after this date |

Types

InboxEmail

interface InboxEmail {
  email_id: string;
  from_address: string;
  from_name: string | null;
  to_addresses: string[];
  cc_addresses: string[] | null;
  subject: string | null;
  received_at: string;
  message_id: string | null;
  has_attachments: boolean;
  attachment_count: number;
  spam_score: number | null;
  spam_verdict: 'PASS' | 'FAIL' | 'GRAY' | null;
  virus_verdict: string | null;
  spf_verdict: string | null;
  dkim_verdict: string | null;
  dmarc_verdict: string | null;
  detected_otp: string | null;
  html_body: string | null;
  text_body: string | null;
}

SentEmail

interface SentEmail {
  email_id: string;
  from_address: string;
  from_name: string | null;
  to_addresses: string[];
  cc_addresses: string[] | null;
  bcc_addresses: string[] | null;
  subject: string | null;
  sent_at: string;
  message_id: string | null;
  has_attachments: boolean;
  attachment_count: number;
  spam_score: number | null;
  spam_verdict: 'PASS' | 'FAIL' | 'GRAY' | null;
  detected_otp: string | null;
  html_body: string | null;
  text_body: string | null;
}

Error Handling

import {
  SigninID,
  SigninIDError,
  AuthenticationError,
  ValidationError,
  NetworkError,
  TimeoutError,
  RateLimitError
} from 'signinid';

try {
  const email = await client.inbox.latest();
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof ValidationError) {
    console.error('Invalid parameters:', error.details);
  } else if (error instanceof RateLimitError) {
    console.error('Rate limited. Retry after:', error.retryAfter, 'seconds');
  } else if (error instanceof NetworkError) {
    console.error('Network error:', error.message);
  } else if (error instanceof TimeoutError) {
    console.error('Request timed out');
  } else {
    throw error;
  }
}

Error Types

| Error | Status | Description | |-------|--------|-------------| | AuthenticationError | 401 | Invalid or missing API key | | ValidationError | 400 | Invalid request parameters | | RateLimitError | 429 | Too many requests | | NetworkError | - | Network connectivity issue | | TimeoutError | - | Request timeout exceeded |

Examples

See the examples directory for runnable examples:

cd examples/basic
npm install
npm run build

# Run examples
npm run inbox:latest
npm run inbox:wait
npm run inbox:list
npm run sent:latest
npm run error

E2E Testing Example

import { test, expect } from '@playwright/test';
import { SigninID } from 'signinid';

test('signup with email verification', async ({ page }) => {
  const client = new SigninID();
  const testEmail = `test-${Date.now()}@your-server.signinid.com`;

  // Fill signup form
  await page.goto('/signup');
  await page.fill('[name="email"]', testEmail);
  await page.click('button[type="submit"]');

  // Wait for verification email
  const email = await client.inbox.waitForNew({
    to: testEmail,
    timeout: 30000
  });

  expect(email).not.toBeNull();
  expect(email!.detected_otp).toBeDefined();

  // Enter OTP
  await page.fill('[name="otp"]', email!.detected_otp!);
  await page.click('button[type="submit"]');

  await expect(page).toHaveURL('/dashboard');
});

Requirements

  • Node.js 18 or later

License

MIT