View as Markdown

Get started · Reference

CLI

The Provenance CLI, provenance, forwards your sandbox events to a URL on your machine while you build a webhook handler, and resends a webhook delivery on demand. It works with sandbox keys only; live events go to your registered webhook endpoints.

Install

The CLI needs Node 20 or later.

This package isn't on npm yet. Until then, every request in these docs runs over HTTP against the sandbox.

With access to the private Provenance repository, which your Provenance contact grants, install from it:

git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-cli-1.0.0.tgz

Sign in

provenance login asks for a sandbox key (prv_test_…), checks it with the API and stores it: in the macOS keychain or the Linux Secret Service where there is one, otherwise in a file only you can read. A live key is refused. To use a key without storing it, set PROVENANCE_KEY; it wins over the stored key. provenance logout forgets the stored key.

provenance login

Commands

CommandWhat it does
provenance loginAsks for a sandbox key, checks it and stores it.
provenance listenPrints each sandbox event as it happens.
provenance listen --forward-to URLAlso posts each event to the URL, signed like a webhook delivery.
provenance listen --events a,bForwards only the event types you list, such as mandate.approval.approved.
provenance events resend <delivery_id>Sends one webhook delivery again and prints your endpoint's answer.
provenance logoutForgets the stored key.

Every command takes --api <url> for the API's base URL. Without it, the CLI reads PROVENANCE_API.

provenance listen --forward-to http://localhost:3000/webhooks --events mandate.approval.approved,mandate.approval.declined

Verify forwarded events

provenance listen prints a whsec_ signing secret, the same every time for your account. Each forwarded event is a POST with the event as its body and these headers:

HeaderValue
Provenance-Signaturet=<unix time>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">, keyed by the secret
Provenance-Event-TypeThe event type, such as mandate.approval.approved
Provenance-Event-IdThe event ID, the same across deliveries and replays

Give the secret to your handler and verify the signature exactly as for a registered endpoint, for example with verifyWebhookSignature from @provenanceauth/sdk or verify_webhook_signature from provenanceauth-sdk.

Errors you might see

MessageWhat to do
That's a live keyLog in with a prv_test_ key. The CLI forwards sandbox events only.
No API keyRun provenance login, or set PROVENANCE_KEY.
--forward-to takes a URLPass a full URL, such as http://localhost:3000/webhooks.