mavunta-cli 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/mavunta.mjs +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ mavunta events --limit 20
|
|
|
39
39
|
| Variable | Purpose |
|
|
40
40
|
| --- | --- |
|
|
41
41
|
| `MAVUNTA_SECRET_KEY` | Your `cwk_test_…` / `cwk_live_…` key (required) |
|
|
42
|
-
| `MAVUNTA_BASE_URL` | Override the API base (default `
|
|
42
|
+
| `MAVUNTA_BASE_URL` | Override the API base (default: `sandbox-api.mavunta.com/v1` for cwk_test_ keys, `api.mavunta.com/v1` for live) |
|
|
43
43
|
|
|
44
44
|
Webhooks forwarded by `listen` are signed exactly like production: `Mavunta-Signature` is HMAC-SHA256 (hex) over `` `${Mavunta-Timestamp}.${rawBody}` ``. Verify them with [`@mavunta/sdk`](https://www.npmjs.com/package/@mavunta/sdk)'s `webhooks.verify`.
|
|
45
45
|
|
package/bin/mavunta.mjs
CHANGED
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
import { createHmac, randomBytes } from 'node:crypto'
|
|
6
6
|
|
|
7
7
|
const VERSION = '1.0.0'
|
|
8
|
-
const
|
|
8
|
+
const LIVE_BASE = 'https://api.mavunta.com/v1'
|
|
9
|
+
const SANDBOX_BASE = 'https://sandbox-api.mavunta.com/v1'
|
|
10
|
+
// Test keys are served on the sandbox host, live keys on the live host; the
|
|
11
|
+
// key in the environment picks the default. MAVUNTA_BASE_URL still overrides.
|
|
12
|
+
const KEY_FOR_BASE = process.env.MAVUNTA_SECRET_KEY || process.env.MAVUNTA_API_KEY || ''
|
|
13
|
+
const BASE = (
|
|
14
|
+
process.env.MAVUNTA_BASE_URL || (KEY_FOR_BASE.startsWith('cwk_test_') ? SANDBOX_BASE : LIVE_BASE)
|
|
15
|
+
).replace(/\/$/, '')
|
|
9
16
|
const KEY = process.env.MAVUNTA_SECRET_KEY || process.env.MAVUNTA_API_KEY || ''
|
|
10
17
|
|
|
11
18
|
const HELP = `mavunta — Mavunta Pay CLI (v${VERSION})
|
|
@@ -21,7 +28,7 @@ Usage:
|
|
|
21
28
|
|
|
22
29
|
Environment:
|
|
23
30
|
MAVUNTA_SECRET_KEY your cwk_test_… / cwk_live_… key (required)
|
|
24
|
-
MAVUNTA_BASE_URL override the API base (default
|
|
31
|
+
MAVUNTA_BASE_URL override the API base (default: sandbox-api.mavunta.com for cwk_test_ keys, api.mavunta.com for live)`
|
|
25
32
|
|
|
26
33
|
function die(msg, code = 1) {
|
|
27
34
|
console.error(msg)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mavunta-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Mavunta Pay command-line tools: verify keys, trigger sandbox webhooks, and forward live events to your local server for webhook testing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chainwaka Technologies",
|