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

@licensechain/mirror-sdk

v1.0.1

Published

LicenseChain Mirror Payload SDK (strict mode)

Readme

LicenseChain Mirror SDK

Official SDK for LicenseChain Pay Mirror Payload strict mode.

Integration guide (read this)

Rule: Integrators must not mask seller-backend failures. Prefer upstreamMessage + correct 4xx HTTP status in your BFF route.

Capabilities

| Feature | Function | |---------|----------| | Mirror payload (AES-256-GCM CLIENT_EMAIL) | buildMirrorPayload() | | Checkout URL | buildMirrorCheckoutUrl() | | Redirect callback HMAC verify | verifyCallbackSignature() | | Pay validate API | verifyPurchase()POST /api/checkout/mirror/validate |

Supported runtimes: Node.js / TypeScript (primary). Reference examples: JavaScript, PHP, Python, Go, Rust.

Limitations

  • No order API — your seller backend must create orders, enforce business rules, and return clear 4xx before redirecting to Pay.
  • No subscription renewals — use Pay POST /api/checkout/mirror/subscription/charge from your backend (see Pay Mirror API).
  • Server-side only — do not call payload builders or verification from untrusted clients.
  • Strict mode only — unsigned or legacy checkout flows are not supported.

Security: callbackSecret

The product callbackSecret (Dashboard or Core API POST /v1/products) is a shared secret used for:

  1. Encrypting Mirror payload fields on your server.
  2. Verifying redirect signature query parameters (HMAC-SHA256 over canonical query string).
  3. Verifying Pay merchant webhooks (x-lc-pay-signature — different canonicalization; see signing models doc).

Never expose callbackSecret in:

  • Browser JavaScript or mobile app bundles
  • Public git repositories or support tickets
  • Client-side WooCommerce/WordPress theme files

Store in environment variables or a secrets manager. Rotate via product PATCH/PUT if compromised.

Security best practices

  1. Fail closed — reject missing or invalid redirect signatures; do not trust LCG or status alone.
  2. Double verification — after signature check, call verifyPurchase() with license + buyer email before fulfillment.
  3. Constant-time compareverifyCallbackSignature() uses timingSafeEqual; keep this for custom implementations.
  4. HTTPS only — thanks/cancel URLs and webhook endpoints must use TLS.
  5. Separate signing models — Core API webhooks (X-Webhook-Signature), Pay webhooks (x-lc-pay-signature), and Mirror redirect HMAC use different rules. Do not reuse verification code across them without adaptation.
  6. Propagate upstream errors — when your BFF wraps checkout preparation, surface upstreamMessage and preserve 4xx status codes.

Install

npm install @licensechain/mirror-sdk

Source: github.com/LicenseChain/LicenseChain-Mirror-SDK

Usage (Node.js / TypeScript)

import {
  buildMirrorPayload,
  buildMirrorCheckoutUrl,
  verifyCallbackSignature,
  verifyPurchase
} from "@licensechain/mirror-sdk";

const { payloadBase64Url } = buildMirrorPayload({
  thanksPage: "https://seller.example.com/thanks",
  cancelUrl: "https://seller.example.com/cancel",
  callbackSecret: process.env.MIRROR_CALLBACK_SECRET!,
  token: "order_8f2a9f0c61",
  clientEmail: "[email protected]"
});

const checkoutUrl = buildMirrorCheckoutUrl(
  "https://pay.licensechain.app",
  "YOUR_PRODUCT_ID",
  payloadBase64Url
);

// Redirect customer to checkoutUrl

const callbackUrl = "https://seller.example.com/thanks?status=successful&LCG=LC-XXXX-XXXX&signature=...";
const isValid = verifyCallbackSignature(callbackUrl, process.env.MIRROR_CALLBACK_SECRET!);
if (!isValid) throw new Error("Invalid callback signature");

const validation = await verifyPurchase({
  apiBaseUrl: "https://pay.licensechain.app",
  license: "LC-XXXX-XXXX",
  email: "[email protected]"
});

if (!validation.verified) {
  throw new Error("Purchase not verified");
}

Strict mode flow

  1. Seller backend: Create order / validate listing; on failure return 4xx and a clear message (e.g. unverified ad). Surface that message in the UI — see docs/INTEGRATION.md.
  2. Build payload with TOKEN and encrypted CLIENT_EMAIL.
  3. Redirect buyer to https://pay.licensechain.app/checkout/{PRODUCT_ID}?payload=....
  4. On return, verify callback signature server-side.
  5. Use fail-closed logic: reject missing/invalid signature and do not trust URL data alone.
  6. Call POST /api/checkout/mirror/validate with license and email.
  7. Fulfill order only when response has verified: true.

Checkout API response handling (before/after)

Your server route that prepares payload may call your API first. Do not only check data.error.

Before:

if (!res.ok) throw new Error(data.error || "Failed to prepare checkout");

After:

const body = await res.json() as { error?: string; upstreamMessage?: string };
if (!res.ok) {
  const msg =
    typeof body.upstreamMessage === "string" && body.upstreamMessage.trim() !== ""
      ? body.upstreamMessage.trim()
      : (body.error ?? "Failed to prepare checkout");
  throw new Error(msg);
}

Pay Mirror API endpoints

| Method | Endpoint | Purpose | |--------|----------|---------| | POST | /api/checkout/mirror/validate | Confirm license + email after redirect | | POST | /api/checkout/mirror/subscription/charge | Charge Stripe subscription renewal (seller backend) |

Base URL: https://pay.licensechain.app

Examples

  • examples/javascript/example.mjs
  • examples/php/example.php
  • examples/python/example.py
  • examples/go/main.go
  • examples/rust/main.rs

LicenseChain API (v1)

This SDK targets LicenseChain Pay for checkout validation. Core license HTTP semantics live in the API service:

  • Production base URL: https://api.licensechain.app/v1
  • API reference: docs.licensechain.app
  • Products CRUD: GET/POST/PATCH/DELETE /v1/products (includes callbackSecret for Mirror/Pay webhooks)

License

MIT