open-index/open-npm huggingface dataset:
npm package: 2fa-utils
Description: TOTP and HOTP utilities.
Author: Boran Seckin
Latest version: 1.2.6

# Two-Factor Authentication
[![npm](https://img.shields.io/npm/v/2fa-utils?style=for-the-badge)](https://www.npmjs.com/package/2fa-utils)
[![Build](https://img.shields.io/github/actions/workflow/status/boranseckin/2fa-utils/node.js.yml?style=for-the-badge)](https://github.com/boranseckin/2fa-utils/actions/workflows/node.js.yml)
[![Codecov](https://img.shields.io/codecov/c/gh/boranseckin/2fa-utils?style=for-the-badge)](https://codecov.io/gh/boranseckin/2fa-utils)

Using the algorithm provided in [RFC 4226](https://tools.ietf.org/rfc/rfc4226), can generate and verify HMAC-based one-time password (HOTP) and time-based one-time password (TOTP).

## Features
- Generate base-32 encoded secrets.
- Generate HMAC-based one-time passwords (HOTP) at a specific length.
- Generate time-based HOTPs at a specific amount of windows.
- Verify generated tokens.

## Usage
### Generating Secret
For each account, a secret must be generated and shared between the server and the client. This secret will be used to create and verify HOTPs.
```js
const secret = twoFA.generateSecret();
```

### Generating HOTP
HOTP requires a base32-encoded secret and a counter with time-step.
```js
// Generate base32 secret
const secret = twoFA.generateSecret();
// Create counter with 30 seconds interval 
const counter = Math.floor(Date.now() / 30000);

const hotp = twoFA.generateHOTP(secret, counter, 6)
```

### Generating TOTP
Generating TOTP allows you to get a HOTP in a specific time window.
```js
const secret = twoFA.generateSecret();

// Get the current time window's token
const currentTotp = twoFA.generateTOTP(secret, 0);

// Get the future time window's token (1 window ahead)
const futureTotp = twoFA.generateTOTP(secret, 1);

// Get the past time window's token (1 window behind)
const pastTotp = twoFA.generateTOTP(secret, -1);
```

### Verifying HOTP
Verify tokens supplied via user input.
```js
function verifyHOTP(inputToken) {
  const secret = twoFA.generateSecret();
  const counter = Math.floor(Date.now() / 30000);

  // Actual token generated by the server
  const actualToken = twoFA.generateHOTP(secret, counter)

  if (inputToken === actualToken) return true;
  return false
}
```

### Verifying TOTP
Verify tokens supploed via user input with a time tolerance.
```js
const secret = twoFA.generateSecret();

const inputToken = '111111';

/* This will return true if the input token 
  - is currently valid,
  - was previously valid in the last window,
  - will be valid in the next window.
*/
const isTokenValid = twoFA.verifyTOTP(inputToken, secret, 1);
```

## Dependencies
- [hi-base32](https://www.npmjs.com/package/hi-base32)

## Author
- Boran Seckin

## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
npm package: 2faa-mcp
Description: MCP server for generating and verifying TOTP 2FA codes. Use with Claude Code, Claude Desktop, or any MCP client.
Latest version: 1.0.0

# @2faa/mcp-server

MCP (Model Context Protocol) server for generating and verifying TOTP 2FA codes. Allows AI agents to handle two-factor authentication programmatically.

## Tools

### `generate_totp`

Generate a TOTP code from a secret key.

**Parameters:**
- `secret` (required) — Base32 encoded secret key or `otpauth://` URI
- `digits` — Number of digits (default: 6)
- `period` — Time period in seconds (default: 30)
- `algorithm` — `SHA1` | `SHA256` | `SHA512` (default: SHA1)

**Returns:** Current code, next code, seconds remaining, and configuration details.

### `verify_totp`

Verify if a TOTP code is valid for a given secret.

**Parameters:**
- `secret` (required) — Base32 encoded secret key or `otpauth://` URI
- `code` (required) — The TOTP code to verify
- `window` — Number of time windows to check before/after current (default: 1)

**Returns:** Whether the code is valid and the time delta.

## Setup

### Build

```bash
cd mcp
npm install
npm run build
```

### Claude Code

Add to your Claude Code MCP settings (`~/.claude/settings.json` or project `.mcp.json`):

```json
{
  "mcpServers": {
    "2faa": {
      "command": "node",
      "args": ["/absolute/path/to/2faa/mcp/dist/index.js"]
    }
  }
}
```

### Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "2faa": {
      "command": "node",
      "args": ["/absolute/path/to/2faa/mcp/dist/index.js"]
    }
  }
}
```

### npx (after publishing)

```json
{
  "mcpServers": {
    "2faa": {
      "command": "npx",
      "args": ["-y", "@2faa/mcp-server"]
    }
  }
}
```

## Example Usage

Once configured, ask your AI agent:

- "Generate a TOTP code for secret JBSWY3DPEHPK3PXP"
- "Verify code 123456 against secret JBSWY3DPEHPK3PXP"
- "Generate a 2FA code from this otpauth URI: otpauth://totp/GitHub:user?secret=ABCDEF..."

## License

MIT
npm package: 2fab64
Description: A Secure Auth Package For APIS 2FAbcrypt64
Author: Ducky
Latest version: 1.0.1

# 2FAB64
2FAB is a secure auth token generator
Source code:

```js
const { Database } = require("bun:sqlite");
const db = new Database();

const inMemoryStore = db.query(`
CREATE TABLE IF NOT EXISTS tokenStore (
  token TEXT,
  uses INTEGER,
  usesLimit INTEGER, -- Make sure this column exists to match your INSERT statement
  date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
`).run()


  

const deleteToken = db.query("DELETE FROM tokenStore WHERE token = $token");
function randomString(length) {
    let result = '';
    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    const charactersLength = characters.length;
    let counter = 0;
    while (counter < length) {
        result += characters.charAt(Math.floor(Math.random() * charactersLength));
        counter += 1;
    }
    return result;
}

async function generateSecureToken(cost, stringLength, uses) {
    const token = await Bun.password.hash(randomString(stringLength), {
        algorithm: "bcrypt",
        cost: cost,
    });
    db.query("INSERT INTO tokenStore (token, uses, usesLimit) VALUES ($token, $uses, $usesLimit)")
    .run({ $token: token, $uses:  0, $usesLimit: uses });
    return await token
}

async function validateSecureToken(token) {
    if (!inMemoryStore.get({ $token: token })) {
        const findTokenData = inMemoryStore.get({ $token: token });
        if (findTokenData.uses > findTokenData.usesLimit || findTokenData == findTokenData.usesLimit) {
            return false
        }
        return false
    }
    return true
}

async function destroySecureToken(token) {
    // Query to check if the token exists
    const tokenExistsQuery = db.query("SELECT * FROM tokenStore WHERE token = $token");
    // Execute the query with the given token
    const tokenData = await tokenExistsQuery.get({ $token: token });
    if (!tokenData) {
        console.error("Token does not exist");
        return;
    }
    // If the token exists, delete it
    deleteToken.run({ $token: token });
    console.log("Token destroyed");
}


module.exports = { destroySecureToken, validateSecureToken, generateSecureToken }
```
npm package: 2famsg
Description: Retrieves 2FA codes from Apple Messages
Author: Daniel Sieradski
Latest version: 0.2.5
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# 2famsg

[![npm](https://img.shields.io/npm/dt/2famsg.svg)](https://www.npmjs.com/package/2famsg) [![npm](https://img.shields.io/npm/v/2famsg.svg)](https://www.npmjs.com/package/utfu) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Twitter: @selfagency_llc](https://img.shields.io/twitter/follow/selfagency_llc.svg?style=social)](https://twitter.com/selfagency_llc)

Retrieve 2FA codes from Apple Messages on MacOS as JSON output with CLI or API

## Installation

```sh
npm install -g 2famsg || yarn global add 2famsg
```

## CLI Usage

```txt
2famsg [-a | --alfred] [-d | --database DATABASE_PATH] [-q | --query QUERY_TERM]
```

Also available via `npx` but loads much more slowly.

### CLI Options

- `-a` or `--alfred` \[`Boolean`\]: Format output for [Alfred](https://www.alfredapp.com/)
- `-d` or `--database` \[`String`\]: Specify database path (Default: `~/Library/Messages/chat.db`)
- `-q` or `--query` \[`String`\]: Term by which to filter results (eg., `facebook` or `amazon`)

## Node Module Usage

```javascript
const twoFactorMsg = require('2famsg')
const codes = async () =>
  await twoFactorMsg({
    query: 'facebook'
  })
```

### Module Options

- `alfred` \[`Boolean`\]: Format output for [Alfred](https://www.alfredapp.com/)
- `database` \[`String`\]: Specify database path (Default: `~/Library/Messages/chat.db`)
- `query` \[`String`\]: Term by which to filter results (eg., `facebook` or `amazon`)

## Build Binaries

```sh
npm run build:sqlite
npm run build:bin
```

## Author

👤 **Daniel Sieradski <hello@self.agency>**

- Website: [self.agency](https://self.agency)
- Twitter: [@selfagency_llc](https://twitter.com/selfagency_llc)
- GitLab: [@selfagency](https://gitlab.com/selfagency)

## Acknowledgements

The [SQLite query](https://gitlab.com/selfagency/2famsg/-/blob/master/src/query.js) was lifted from [Scott Carpenter](https://github.com/squatto/)'s [alfred-imessage-2fa](https://github.com/squatto/alfred-imessage-2fa) Alfred workflow, which I modified somewhat. Scott's project was a great start but I was looking for a more robust solution and decided to build one in a language in which I felt more comfortable jamming on the code.

## Contributing

Contributions, issues and feature requests are welcome! Feel free to check [issues page](https://gitlab.com/selfagency/2famsg/issues).

## Show your support

Give a ⭐️ if this project helped you!