🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@robinpath/auth

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@robinpath/auth

API authentication helpers (Basic, Bearer, API key, HMAC) for RobinPath

latest
npmnpm
Version
0.3.0
Version published
Weekly downloads
36
20%
Maintainers
4
Weekly downloads
 
Created
Source

@robinpath/auth

API authentication helpers: Basic, Bearer, API key, HMAC signing, and password hashing

Category Functions Auth License

Why use this module?

The auth module lets you:

  • Create a Basic authentication header from username and password
  • Parse a Basic auth header to extract username and password
  • Create a Bearer authentication header from a token
  • Extract the token from a Bearer auth header
  • Create an API key configuration for header or query parameter placement

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

robinpath add @robinpath/auth

Quick Start

No credentials needed — start using it right away:

auth.parseBasic "Basic dXNlcjpwYXNz"

Available Functions

FunctionDescription
auth.basicCreate a Basic authentication header from username and password
auth.parseBasicParse a Basic auth header to extract username and password
auth.bearerCreate a Bearer authentication header from a token
auth.parseBearerExtract the token from a Bearer auth header
auth.apiKeyCreate an API key configuration for header or query parameter placement
auth.hmacSignCreate an HMAC signature for a payload
auth.hmacVerifyVerify an HMAC signature using timing-safe comparison
auth.generateApiKeyGenerate a cryptographically secure random API key
auth.hashPasswordHash a password using PBKDF2 with a random salt
auth.verifyPasswordVerify a password against a PBKDF2 hash (timing-safe)
auth.buildAuthHeaderBuild an Authorization header from a type and credentials
auth.parseAuthHeaderParse any Authorization header into its scheme and credentials

Examples

Parse a Basic auth header to extract username and password

auth.parseBasic "Basic dXNlcjpwYXNz"

Create a Bearer authentication header from a token

auth.bearer "eyJhbGciOi..."

Extract the token from a Bearer auth header

auth.parseBearer "Bearer eyJhbGciOi..."

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/auth";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  auth.parseBasic "Basic dXNlcjpwYXNz"
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

License

MIT

Keywords

auth

FAQs

Package last updated on 06 May 2026

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