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.tgzSign 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
| Command | What it does |
|---|---|
provenance login | Asks for a sandbox key, checks it and stores it. |
provenance listen | Prints each sandbox event as it happens. |
provenance listen --forward-to URL | Also posts each event to the URL, signed like a webhook delivery. |
provenance listen --events a,b | Forwards only the event types you list, such as mandate.. |
provenance events resend <delivery_ | Sends one webhook delivery again and prints your endpoint's answer. |
provenance logout | Forgets 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:
| Header | Value |
|---|---|
Provenance-Signature | t=<unix time>,v1=<hex HMAC-SHA256 of "<t>., keyed by the secret |
Provenance-Event-Type | The event type, such as mandate. |
Provenance-Event-Id | The 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
| Message | What to do |
|---|---|
| That's a live key | Log in with a prv_ key. The CLI forwards sandbox events only. |
| No API key | Run provenance login, or set PROVENANCE_. |
--forward-to takes a URL | Pass a full URL, such as http:/. |
Related
- Test webhooks: send a test event, replay one, or forward events with the CLI
- Receive webhook events
- Webhook events
- SDKs and tools