New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@korala/auth

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@korala/auth

HMAC authentication utilities for the Korala document signing API

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

@korala/auth

HMAC authentication utilities for the Korala document signing API.

Installation

npm install @korala/auth

Usage

Sign API requests

import { signRequest } from '@korala/auth';

const { signature, timestamp } = signRequest({
  method: 'POST',
  path: '/api/v1/documents',
  body: JSON.stringify({ name: 'Contract' }),
  secret: 'your-api-secret',
});

// Use in request headers
fetch('https://api.korala.ai/api/v1/documents', {
  method: 'POST',
  headers: {
    'X-API-Key': 'your-api-key-id',
    'X-Timestamp': String(timestamp),
    'X-Signature': signature,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Contract' }),
});

Verify webhook signatures

import { verifyWebhookSignature } from '@korala/auth';

const isValid = verifyWebhookSignature({
  payload: rawBody,
  signature: headers['x-signature'],
  timestamp: headers['x-timestamp'],
  secret: webhookSecret,
});

Note: Most users should use @korala/api-client which handles authentication automatically. This package is for advanced use cases or custom HTTP clients.

API

FunctionDescription
signRequest(opts)Generate HMAC signature + timestamp for an API request
verifySignature(opts)Verify an incoming API request signature
signWebhookPayload(payload, secret)Sign a webhook payload
verifyWebhookSignature(opts)Verify a webhook delivery signature
computeSignature(message, secret)Low-level HMAC-SHA256 computation
getTimestamp()Get current Unix timestamp in seconds
isTimestampValid(timestamp, maxAge?)Check if a timestamp is within the allowed window

Documentation

Full documentation at docs.korala.ai.

License

MIT

Keywords

korala

FAQs

Package last updated on 18 Mar 2026

Related posts