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

@kenmon/email-otp-authenticator

v1.0.0-pre.3

Published

Email OTP authenticator for Kenmon

Readme

@kenmon/email-otp-authenticator

Email OTP authenticator for Kenmon.

Installation

npm install @kenmon/email-otp-authenticator

Usage

import { KenmonEmailOTPAuthenticator } from '@kenmon/email-otp-authenticator'

const emailOTP = new KenmonEmailOTPAuthenticator({
  mailer: new MyMailer(),
  otpStorage: new MyOTPStorage(),
  otpTtl: 300, // 5 minutes (optional)
  otpLength: 6, // (optional)
  emailFrom: '[email protected]',
})

// Send OTP
const result = await emailOTP.sendOTP('[email protected]')
if (result.success) {
  const { otpId, signature } = result.data
  // Show signature to user for verification
}

// Verify OTP
const verifyResult = await emailOTP.verifyOTP({
  email: '[email protected]',
  otpId: 'otp-id-from-send',
  code: '123456',
})
if (verifyResult.success) {
  const identifier = verifyResult.data // { type: 'email-otp', value: '[email protected]' }
}

Configuration

mailer (required)

You must implement this yourself. Instance of KenmonMailer for sending emails via your email service (SendGrid, AWS SES, etc.).

class MyMailer extends KenmonMailer {
  async sendEmail(params: {
    from: string
    to: string | string[]
    subject: string
    textContent?: string
    htmlContent?: string
  }): Promise<void> {
    // Send via your email service
  }
}

otpStorage (required)

You must implement this yourself. Implementation of KenmonEmailOTPStorage for OTP persistence in your database.

class MyOTPStorage implements KenmonEmailOTPStorage {
  async createOTP(
    email: string,
    code: string,
    expiresAt: Date,
    signature: string,
  ): Promise<KenmonEmailOTP> {
    // Save OTP to database and return it
  }

  async getOTPById(id: string): Promise<KenmonEmailOTP | null> {
    // Fetch OTP from database by ID
  }

  async markOTPAsUsed(id: string): Promise<void> {
    // Mark OTP as used in database
  }
}

emailFrom (required)

Sender email address.

otpTtl (optional)

OTP lifetime in seconds. Default: 300 (5 minutes)

otpLength (optional)

OTP code length. Default: 6

emailSubject (optional)

Function to generate email subject: (code: string, signature: string, otpTtl: number) => string

emailTextContent (optional)

Function to generate plain text email body: (code: string, signature: string, otpTtl: number) => string

emailHtmlContent (optional)

Function to generate HTML email body: (code: string, signature: string, otpTtl: number) => string

Custom Email Content

You can customize email content using generator functions:

new KenmonEmailOTPAuthenticator({
  mailer: new MyMailer(),
  otpStorage: new MyOTPStorage(),
  emailFrom: '[email protected]',
  emailSubject: (code, signature, otpTtl) => `Your code: ${code}`,
  emailTextContent: (code, signature, otpTtl) =>
    `Code: ${code}\nSignature: ${signature}\nExpires in ${otpTtl}s`,
  emailHtmlContent: (code, signature, otpTtl) =>
    `<h1>${code}</h1><p>Signature: ${signature}</p><p>Expires: ${otpTtl}s</p>`,
})

See Also