@certen.io/sdk 0.12.1 → 0.13.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.
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Signing and verifying CERTEN webhooks.
3
+ *
4
+ * The gateway has always signed every delivery, and its customer guide (`docs/verify-webhook.md`) has always told receivers to
5
+ * `import { verifyWebhookSignature } from '@certen.io/sdk'`. The SDK had no such export, so every receiver hand-rolled the HMAC —
6
+ * and the one mistake that matters here (hashing a re-serialized body instead of the bytes that arrived) is exactly what a
7
+ * hand-rolled receiver gets wrong, because the framework parsed the body before the handler ran.
8
+ *
9
+ * **The scheme** (gateway `src/webhooks/webhook-signature.ts` and `webhook.service.ts`; this file is checked against both):
10
+ *
11
+ * X-Certen-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + "." + body)>
12
+ *
13
+ * `body` is the request body. The gateway sends the *canonical JSON* of the payload (keys sorted at every level, no whitespace) as the
14
+ * body itself, so a receiver hashes the raw bytes and never has to canonicalize anything. Each attempt is signed afresh with a new `t`,
15
+ * which is why a delivery redelivered hours later still verifies.
16
+ *
17
+ * **What the signature covers, and what it does not.** `t` and the body, and nothing else. `X-Certen-Event`, `X-Certen-Delivery` and
18
+ * `X-Certen-Timestamp` are plain headers: anyone who can replay a captured (body, signature) pair inside the tolerance window can
19
+ * attach any of them. `ReceivedWebhook` therefore keeps them apart from the verified `payload`, and `timestamp` is the one taken from
20
+ * the signed header.
21
+ *
22
+ * Portable: nothing here touches `node:crypto`, `Buffer` or `process`. HMAC is built on `sha256.ts` (synchronous, so a verifier is a
23
+ * plain function in a Node handler, a Cloudflare Worker and the browser entry alike), and `webhook-signature.test.ts` holds it to
24
+ * RFC 4231 and to `node:crypto` at every length around the block boundary.
25
+ */
26
+ import type { WebhookSignatureFailure } from './errors.js';
27
+ import type { WebhookEventName, WebhookEventPayloads } from './webhook-events.js';
28
+ /** The only signature version the gateway emits today. A future one arrives alongside it in the same header as `v2=…`. */
29
+ export declare const WEBHOOK_SIGNATURE_VERSION = "v1";
30
+ /** How far `t` may sit from now, either side, before an authentic signature is refused as a replay. */
31
+ export declare const DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
32
+ export declare const WEBHOOK_SIGNATURE_HEADER = "X-Certen-Signature";
33
+ /** The event name. NOT covered by the signature. */
34
+ export declare const WEBHOOK_EVENT_HEADER = "X-Certen-Event";
35
+ /** One id per delivery, stable across retries and redelivery. NOT covered by the signature. Absent on the verification ping. */
36
+ export declare const WEBHOOK_DELIVERY_HEADER = "X-Certen-Delivery";
37
+ /** A copy of `t`. NOT covered by the signature — read `t` from the signature header, which is. */
38
+ export declare const WEBHOOK_TIMESTAMP_HEADER = "X-Certen-Timestamp";
39
+ /** HMAC-SHA256 (RFC 2104 / RFC 4231). Exported for the tests and for callers who need the primitive; not part of the package entry. */
40
+ export declare function hmacSha256(key: Uint8Array, message: Uint8Array): Uint8Array;
41
+ /**
42
+ * The gateway's canonical JSON: keys sorted at every object level, arrays in order, no whitespace. This is the string the gateway puts
43
+ * on the wire and signs, so `signWebhookPayload` needs it and a receiver that has only a parsed object can rebuild it.
44
+ *
45
+ * Matches the gateway byte for byte on JSON values (`webhook-signature.test.ts` fuzzes it against a verbatim copy of the gateway's
46
+ * implementation). It is STRICTER on what is not JSON: where the gateway turns a `Date`, `Map` or `Set` into `{}` — silently, so a
47
+ * signature over it verifies against nothing a receiver could rebuild — this throws.
48
+ *
49
+ * Prefer verifying the raw bytes. Rebuilding from a parsed object is only as faithful as the parse: a number beyond 2^53 or a duplicate
50
+ * key has already been altered by `JSON.parse` before this runs.
51
+ */
52
+ export declare function canonicalizeWebhookPayload(value: unknown): string;
53
+ /** The request body exactly as received. A `Buffer` is a `Uint8Array`. */
54
+ export type WebhookBody = string | Uint8Array | ArrayBuffer;
55
+ /**
56
+ * Request headers in any of the shapes a Node or Web framework hands over: a Fetch `Headers`, or a plain object such as Node's
57
+ * `req.headers` (names are matched case-insensitively; a repeated header arrives as an array and is joined).
58
+ */
59
+ export type WebhookHeaders = {
60
+ get(name: string): string | null | undefined;
61
+ } | {
62
+ readonly [name: string]: string | readonly string[] | undefined;
63
+ };
64
+ /** Throw `WEBHOOK_SECRET_INVALID` if `secret` could not have signed anything. For a caller that wants to fail before doing other work. */
65
+ export declare function assertWebhookSecret(secret: string | readonly string[]): void;
66
+ export type ParsedWebhookSignature = {
67
+ ok: true;
68
+ /** `t`, unix seconds. */
69
+ timestamp: number;
70
+ /** `t` exactly as written — the string that was hashed. */
71
+ timestampText: string;
72
+ /** Every `vN=` pair in header order. Only `v1` is understood; the rest are carried so a caller can say a newer scheme exists. */
73
+ signatures: Array<{
74
+ version: string;
75
+ value: string;
76
+ }>;
77
+ } | {
78
+ ok: false;
79
+ reason: 'malformed-signature';
80
+ message: string;
81
+ };
82
+ /**
83
+ * Split `t=<unix>,v1=<hex>[,v2=…]`. Strict about the parts that are signed over (one `t`, plain decimal digits; a `v1` that is 64 hex
84
+ * characters) because a lenient parse is how two parsers end up disagreeing about what was signed; ignorant of any key it does not
85
+ * know, so a header that gains a field keeps verifying.
86
+ */
87
+ export declare function parseWebhookSignatureHeader(header: string): ParsedWebhookSignature;
88
+ export interface SignedWebhook {
89
+ /** The `X-Certen-Signature` value: `t=<unix>,v1=<hex>`. */
90
+ header: string;
91
+ timestamp: number;
92
+ signatureHex: string;
93
+ /** The canonical JSON of the payload. Send EXACTLY this as the request body — the signature is over these bytes. */
94
+ canonicalPayload: string;
95
+ version: typeof WEBHOOK_SIGNATURE_VERSION;
96
+ /** The headers the gateway sends with a delivery, ready to hand to an HTTP client. */
97
+ headers: Record<string, string>;
98
+ }
99
+ export interface SignWebhookOptions {
100
+ /** Unix seconds to sign at. Default: now. */
101
+ timestamp?: number;
102
+ /** Adds `X-Certen-Event`. */
103
+ event?: string;
104
+ /** Adds `X-Certen-Delivery`. */
105
+ deliveryId?: string;
106
+ }
107
+ /**
108
+ * Sign a payload the way the gateway signs a delivery, so a receiver can be exercised without waiting for a real event: send
109
+ * `canonicalPayload` as the body with `headers`, and `verifyWebhookSignature` on the far side accepts it.
110
+ *
111
+ * This produces a signature that a receiver holding the same secret will trust. It is a test tool — the gateway is the only party that
112
+ * signs deliveries for a real endpoint — and the secret it needs is the one you stored when the endpoint was registered.
113
+ */
114
+ export declare function signWebhookPayload(secret: string, payload: unknown, options?: SignWebhookOptions): SignedWebhook;
115
+ export interface VerifyWebhookOptions {
116
+ /**
117
+ * The endpoint's signing secret. An array accepts any of several — for the window after `rotateSecret`, or while two endpoints (old
118
+ * and new secret) point at one receiver. The gateway signs with exactly one secret at a time, so listing the previous secret only
119
+ * helps a receiver that has not yet been switched over; remove it once it has.
120
+ */
121
+ secret: string | readonly string[];
122
+ /** The raw request body. Mutually exclusive with `payload`. */
123
+ body?: WebhookBody;
124
+ /**
125
+ * An already-parsed body, for a handler whose framework parsed it before you could read it. The canonical form is rebuilt and
126
+ * checked, which is only as faithful as the parse (see `canonicalizeWebhookPayload`). Prefer `body`.
127
+ */
128
+ payload?: unknown;
129
+ /** The `X-Certen-Signature` header value. Give this or `headers`. */
130
+ signature?: string | null;
131
+ /** Request headers, from which `X-Certen-Signature` is read. */
132
+ headers?: WebhookHeaders;
133
+ /** Either side of now that `t` may sit. Default 300. Must be finite; to verify an old capture pass `now`. */
134
+ toleranceSeconds?: number;
135
+ /** What time it is, as unix seconds or a Date. Default: the real clock. For tests and for checking a stored capture. */
136
+ now?: number | Date;
137
+ }
138
+ export type WebhookVerification = {
139
+ ok: true;
140
+ /** `t` from the signed header, unix seconds. */
141
+ timestamp: number;
142
+ /** `now - t`. Positive means signed in the past. */
143
+ ageSeconds: number;
144
+ version: typeof WEBHOOK_SIGNATURE_VERSION;
145
+ /** Which of the supplied secrets verified, 0-based. 0 when only one was given. */
146
+ secretIndex: number;
147
+ } | {
148
+ ok: false;
149
+ reason: Exclude<WebhookSignatureFailure, 'invalid-payload'>;
150
+ message: string;
151
+ /** When the failure looks like one of the usual mistakes, which. Safe to log. */
152
+ hint?: string;
153
+ /** Present when the signature was authentic but stale: `t` and how old it is. */
154
+ timestamp?: number;
155
+ ageSeconds?: number;
156
+ };
157
+ /**
158
+ * Is this delivery from CERTEN, intact, and recent?
159
+ *
160
+ * const v = verifyWebhookSignature({ body: rawBody, headers: req.headers, secret: process.env.CERTEN_WEBHOOK_SECRET! });
161
+ * if (!v.ok) return res.status(400).send(v.reason);
162
+ *
163
+ * Returns the verdict as data for the failures an attacker or a misconfigured proxy can cause (a bad header, a bad signature, a stale
164
+ * timestamp). THROWS for the failures only the caller can cause — no secret, a secret too short to be real, a nonsensical option —
165
+ * because those must not read as "someone sent a bad request".
166
+ *
167
+ * The signature is checked before the clock, so `timestamp-outside-tolerance` always means the sender holds a genuine signature: an
168
+ * old replay or a skewed clock, never a forgery. A match is found in constant time.
169
+ */
170
+ export declare function verifyWebhookSignature(options: VerifyWebhookOptions): WebhookVerification;
171
+ /** The proof that a webhook was authentic, as `verifyWebhookSignature` reported it. */
172
+ export type VerifiedWebhookSignature = Extract<WebhookVerification, {
173
+ ok: true;
174
+ }>;
175
+ /**
176
+ * A webhook that passed verification.
177
+ *
178
+ * `payload` and `timestamp` are authenticated. `type` and `deliveryId` are NOT: they are copied from headers the signature does not
179
+ * cover, so a party who can replay a captured delivery inside the tolerance window can relabel it. Use `type` to route, and let the
180
+ * handler read what it needs from `payload` (every transaction event carries its own `status`). Dedupe on `deliveryId` — it is stable
181
+ * across the gateway's retries and `redeliver`, which is what makes it the right idempotency key — but not to authorize.
182
+ */
183
+ export interface ReceivedWebhook<P = unknown> {
184
+ /** `X-Certen-Event`, or null if the header was not passed. UNSIGNED. */
185
+ type: string | null;
186
+ /** `X-Certen-Delivery`, or null (the verification ping has none). UNSIGNED. */
187
+ deliveryId: string | null;
188
+ /** `t` from the signed header, unix seconds. Authenticated. */
189
+ timestamp: number;
190
+ payload: P;
191
+ verification: VerifiedWebhookSignature;
192
+ }
193
+ export interface ConstructWebhookEventOptions {
194
+ secret: string | readonly string[];
195
+ /** The raw request body. */
196
+ body: WebhookBody;
197
+ /** Request headers: the signature is read from here, and `X-Certen-Event` / `X-Certen-Delivery` for the result. */
198
+ headers?: WebhookHeaders;
199
+ /** Alternative to reading the signature from `headers`. */
200
+ signature?: string | null;
201
+ toleranceSeconds?: number;
202
+ now?: number | Date;
203
+ }
204
+ /**
205
+ * Verify a delivery and parse it: the one call a handler needs.
206
+ *
207
+ * const hook = constructWebhookEvent({ body: rawBody, headers: req.headers, secret });
208
+ * if (isWebhookEvent(hook, 'transaction.completed')) await settle(hook.payload.intent_id);
209
+ *
210
+ * Throws `CertenWebhookSignatureError` (status 400, `.reason`) when the delivery is not accepted — answer 400 and nothing is
211
+ * processed — and `CertenError` (`WEBHOOK_SECRET_INVALID`) when the secret itself is unusable. Does not read `body` as text until the
212
+ * signature has held.
213
+ */
214
+ export declare function constructWebhookEvent<P = unknown>(options: ConstructWebhookEventOptions): ReceivedWebhook<P>;
215
+ /** The part of a Fetch `Request` (or a Next.js / Hono / Workers / Bun / Deno request) this needs. */
216
+ export interface WebhookRequestLike {
217
+ headers: WebhookHeaders;
218
+ arrayBuffer(): Promise<ArrayBuffer>;
219
+ }
220
+ /**
221
+ * `constructWebhookEvent` for a Fetch-style request. It reads the body with `arrayBuffer()`, so the bytes are the ones that arrived and
222
+ * there is no parsed copy to confuse the handler (do NOT call `request.json()` first: the stream is then spent).
223
+ */
224
+ export declare function constructWebhookEventFromRequest<P = unknown>(request: WebhookRequestLike, secret: string | readonly string[], options?: Pick<ConstructWebhookEventOptions, 'toleranceSeconds' | 'now'>): Promise<ReceivedWebhook<P>>;
225
+ /** Narrow a received webhook to a known event and its payload type. False for an event this SDK has no type for, which is not an error. */
226
+ export declare function isWebhookEvent<E extends WebhookEventName>(hook: ReceivedWebhook, type: E): hook is ReceivedWebhook<WebhookEventPayloads[E]> & {
227
+ type: E;
228
+ };
229
+ /** The signature fields of `GET /v1/webhooks/deliveries/{id}`. */
230
+ export interface DeliverySignatureRecord {
231
+ signature_version?: string | null;
232
+ signature_hex?: string | null;
233
+ signed_at_unix?: number | string | null;
234
+ signed_canonical_payload?: string | null;
235
+ [k: string]: unknown;
236
+ }
237
+ export type WebhookDeliveryCheck = {
238
+ ok: true;
239
+ timestamp: number;
240
+ version: typeof WEBHOOK_SIGNATURE_VERSION;
241
+ } | {
242
+ ok: false;
243
+ /** `not-signed`: no attempt has been made yet, so there is nothing to check. */
244
+ reason: 'not-signed' | 'unsupported-version' | 'malformed-record' | 'signature-mismatch';
245
+ message: string;
246
+ hint?: string;
247
+ };
248
+ /**
249
+ * Reproduce the signature the gateway recorded for a delivery attempt, from the signed bytes it also recorded.
250
+ *
251
+ * This answers "is the secret I hold the one the gateway signed this with?" without waiting for the next event: a mismatch on a
252
+ * delivery your receiver rejected means the receiver has the wrong (or a rotated-away) secret; a match means the secret is right
253
+ * and the fault is in how the receiver gets the body. There is no tolerance — this is history, not a request.
254
+ *
255
+ * The record describes the LAST attempt: each attempt re-signs and overwrites it.
256
+ */
257
+ export declare function checkWebhookDelivery(delivery: DeliverySignatureRecord, secret: string | readonly string[]): WebhookDeliveryCheck;
258
+ //# sourceMappingURL=webhook-signature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-signature.d.ts","sourceRoot":"","sources":["../src/webhook-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAElF,0HAA0H;AAC1H,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,uGAAuG;AACvG,eAAO,MAAM,iCAAiC,MAAM,CAAC;AACrD,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAC7D,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,gIAAgI;AACh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