@nombaoss/nomba-node 0.1.1 → 0.1.2
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 +6 -4
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -406,9 +406,7 @@ const app = express();
|
|
|
406
406
|
app.post("/webhooks/nomba", express.raw({ type: "*/*" }), (req, res) => {
|
|
407
407
|
let event;
|
|
408
408
|
try {
|
|
409
|
-
event = verifyWebhook(req.body, req.headers, process.env.NOMBA_WEBHOOK_SIGNING_KEY
|
|
410
|
-
toleranceSeconds: 300,
|
|
411
|
-
});
|
|
409
|
+
event = verifyWebhook(req.body, req.headers, process.env.NOMBA_WEBHOOK_SIGNING_KEY!);
|
|
412
410
|
} catch {
|
|
413
411
|
return res.sendStatus(401);
|
|
414
412
|
}
|
|
@@ -424,7 +422,11 @@ app.post("/webhooks/nomba", express.raw({ type: "*/*" }), (req, res) => {
|
|
|
424
422
|
- The signature is compared exactly (base64 is case-sensitive) and in constant time. Surrounding whitespace in the header is ignored.
|
|
425
423
|
- `nomba-sig-value` is accepted if `nomba-signature` is absent. A `nomba-signature-algorithm` other than `HmacSHA256` is rejected.
|
|
426
424
|
- `nomba-timestamp` must be an RFC 3339 time (for example `2025-09-29T10:51:44Z`), and a `responseCode` containing `:` is rejected. Both checks stop a forged webhook from moving part of the timestamp into the signed body.
|
|
427
|
-
- `toleranceSeconds`
|
|
425
|
+
- `toleranceSeconds` rejects events whose `nomba-timestamp` is more than that many seconds from now. Leave it off (the default): see below.
|
|
426
|
+
|
|
427
|
+
**Replay protection.** Deduplicating on the signed `event.requestId` is the main defence: a replayed or retried delivery of an event you've already processed changes nothing. Nomba documents `nomba-timestamp` as the time the payload was sent, without saying whether automatic retries get a fresh one. If they keep the original, a short tolerance would reject legitimate retries after an outage. Only enable `toleranceSeconds` after confirming in the sandbox that redeliveries carry a new timestamp, and then keep it generous (for example an hour) with server clocks synced.
|
|
428
|
+
|
|
429
|
+
**Confirm money decisions with the API.** The signature doesn't cover the amount, `orderReference`, `merchantTxRef` or the card `tokenKey`. Before you fulfil, refund or store a card token, requery with `transactions.get` (`{ orderReference }` for checkout payments, `{ merchantTxRef }` for payouts) and act on its answer.
|
|
428
430
|
|
|
429
431
|
Event types are exported as `WebhookEventType`: `payment_success`, `payment_failed`, `payment_reversal`, `payout_success`, `payout_failed`, `payout_refund`. Verification uses `node:crypto`, so it works in Node, Bun, Deno and edge runtimes with Node compatibility enabled.
|
|
430
432
|
|
package/dist/index.cjs
CHANGED
|
@@ -1265,7 +1265,7 @@ var VirtualAccounts = class extends Resource {
|
|
|
1265
1265
|
};
|
|
1266
1266
|
|
|
1267
1267
|
// src/version.ts
|
|
1268
|
-
var VERSION = "0.1.
|
|
1268
|
+
var VERSION = "0.1.2";
|
|
1269
1269
|
function header(headers, name) {
|
|
1270
1270
|
if (typeof headers.get === "function") {
|
|
1271
1271
|
const v = headers.get(name);
|