Modules@robinpath/webhook

@robinpath/webhook

0.1.0Public

Send and verify webhooks with HMAC signatures for RobinPath

@robinpath/webhook

Send webhooks with HMAC signatures, verify incoming webhook payloads, and prevent replay attacks

Category Functions Auth License

Why use this module?

The webhook module lets you:

  • Send a webhook POST request with optional HMAC signature
  • Create an HMAC signature for a webhook payload
  • Verify a webhook HMAC signature using timing-safe comparison
  • Verify a webhook timestamp is within acceptable tolerance to prevent replay attacks
  • Parse a raw webhook body based on content type

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

Installation

npm install @robinpath/webhook

Quick Start

No credentials needed — start using it right away:

webhook.sign $payload "whsec_abc"

Available Functions

FunctionDescription
webhook.sendSend a webhook POST request with optional HMAC signature
webhook.signCreate an HMAC signature for a webhook payload
webhook.verifyVerify a webhook HMAC signature using timing-safe comparison
webhook.verifyTimestampVerify a webhook timestamp is within acceptable tolerance to prevent replay attacks
webhook.parsePayloadParse a raw webhook body based on content type
webhook.buildPayloadBuild a standardized webhook payload with event name, data, timestamp, and ID
webhook.headersBuild webhook headers including signature and timestamp
webhook.isValidUrlCheck if a string is a valid HTTP/HTTPS webhook URL

Examples

Create an HMAC signature for a webhook payload

webhook.sign $payload "whsec_abc"

Verify a webhook HMAC signature using timing-safe comparison

webhook.verify $body "whsec_abc" $signatureHeader

Verify a webhook timestamp is within acceptable tolerance to prevent replay attacks

webhook.verifyTimestamp $timestamp 60000

Integration with RobinPath

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

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

const result = await rp.executeScript(`
  webhook.sign $payload "whsec_abc"
`);

Full API Reference

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

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/webhook
Version0.1.0
LicenseMIT
Unpacked Size5.3 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

web