arn-secure-url
v0.0.4
Published
AES-256-GCM encrypt/decrypt for URL-safe payloads + helpers for pixel tracking and unsubscribe URLs.
Maintainers
Readme
arn-secure-url
AES-256-GCM encrypt/decrypt for URL-safe payloads + helpers for pixel tracking and unsubscribe URLs.
Zero dependencies — uses Node.js built-in crypto.
Install
npm install arn-secure-urlUsage
Encrypt / Decrypt
import { encryptUrl, decryptUrl } from "arn-secure-url";
const encrypted = encryptUrl({ campaign_id: "abc", list_data_id: "def" });
// → "URL-safe-base64-string"
const decrypted = decryptUrl(encrypted);
// → { campaign_id: "abc", list_data_id: "def" }Build Pixel Tracking URL (email open)
import { buildPixelUrl } from "arn-secure-url";
const url = buildPixelUrl({
domain: "https://pixel.domain.com", // string or array (picks random)
campaign_id: "a1b2c3d4-...",
list_data_id: "f1e2d3c4-...",
});
// → "https://pixel.domain.com/tracking-pixel.gif?q=ENCRYPTED"Build ClickBank Unsubscribe URL (path-based)
import { buildUnsubUrl } from "arn-secure-url";
const url = buildUnsubUrl({
domain: "https://cb-worker.domain.com", // string or array (picks random)
campaign_id: "a1b2c3d4-...",
list_data_id: "f1e2d3c4-...",
});
// → "https://cb-worker.domain.com/aBcDeFgHiJkLm..."Build CPA Unsubscribe URL (path-based)
import { buildCpaUnsubUrl } from "arn-secure-url";
const url = buildCpaUnsubUrl({
domain: "https://cpa-unsub.domain.com", // string or array (picks random)
client_id: "550e8400-e29b-...",
});
// → "https://cpa-unsub.domain.com/aBcDeFgHiJkLm..."API
| Function | Description |
|----------|-------------|
| encryptUrl(data) | Encrypt object → URL-safe base64 string |
| decryptUrl(input) | Decrypt URL-safe base64 → object |
| buildPixelUrl({domain, campaign_id, list_data_id}) | Pixel URL: /tracking-pixel.gif?q=ENCRYPTED |
| buildUnsubUrl({domain, campaign_id, list_data_id}) | CB unsub URL: path-based /ENCRYPTED |
| buildCpaUnsubUrl({domain, client_id}) | CPA unsub URL: path-based /ENCRYPTED |
All domain fields accept string or string[] — if array, picks one at random.
