cc-me
v0.5.0
Published
JS client and CLI for cc.me
Readme
cc-me
ESM client for browsers, Node.js, Bun, and Deno. The library can build trampoline URLs; the CLI forwards or inspects Safe inbox deliveries.
Package: https://www.npmjs.com/package/cc-me
npm install cc-meForward an inbox to a local endpoint:
npx cc-me http://example.local:8080/webhook
pnpx cc-me http://example.local:8080/webhook
bunx cc-me http://example.local:8080/webhook
deno run -A npm:cc-me http://example.local:8080/webhookInspect a Safe inbox locally before acknowledging deliveries:
npx cc-me inspect
pnpx cc-me inspect
bunx cc-me inspect
deno run -A npm:cc-me inspectThe CLI prints the inbox URL to register with the provider. It uses
~/.cc-me.key by default, creating it if needed and reusing it later. Use
--key to choose a specific path:
npx cc-me --key ~/hooks.key http://example.local:8080/webhookYou can also set CC_ME_KEY.
import { homedir } from "node:os";
import { CcMeClient, createAlias, privateKey } from "cc-me";
const alias = await createAlias("http://example.local/auth/callback");
console.log(`OAuth callback URL: ${alias.url}`);
const key = await privateKey(`${homedir()}/.cc-me.key`);
const cc = new CcMeClient({ privateKey: key });
console.log(`Webhook URL: ${await cc.inboxUrl()}`);
const { requests } = await cc.claim({ limit: 10, poll: true });
const handled = [];
for (const request of requests) {
console.log(request.method, request.path, request.text());
handled.push(request.id);
}
await cc.ack(handled);limit is optional. Omit it to use the service default:
const { requests } = await cc.claim({ poll: true });peek returns a cursor for live inspectors and dashboards:
const page = await cc.peek({ poll: true });
const next = await cc.peek({ cursor: page.cursor, poll: true });In browsers, call privateKey() to create an in-memory key or provide your own
stored key string to new CcMeClient({ privateKey }). privateKey(path) creates
and reuses a key file on Node.js, Bun, and Deno, keeping it private to the user
on Unix-like systems.
