svix 2.1.0 → 2.2.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/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/request.ts +1 -1
- package/src/webhook.test.ts +2 -2
- package/src/webhook.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svix",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Svix webhooks API client and webhook verification library",
|
|
5
5
|
"author": "svix",
|
|
6
6
|
"repository": "https://github.com/svix/svix-webhooks",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"fmt": "biome format --write"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"standardwebhooks": "1.
|
|
38
|
+
"standardwebhooks": "^1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@biomejs/biome": "2.2.4",
|
package/src/request.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiException, type XOR } from "./util";
|
|
2
2
|
import type { HttpErrorOut, HTTPValidationError } from "./HttpErrors";
|
|
3
3
|
|
|
4
|
-
export const LIB_VERSION = "2.
|
|
4
|
+
export const LIB_VERSION = "2.2.0";
|
|
5
5
|
|
|
6
6
|
function getUserAgent() {
|
|
7
7
|
var fields = [`svix-libs/${LIB_VERSION}/javascript`];
|
package/src/webhook.test.ts
CHANGED
|
@@ -124,7 +124,7 @@ test("partial signature throws error", () => {
|
|
|
124
124
|
}, WebhookVerificationError);
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
test("valid signature is valid
|
|
127
|
+
test("valid signature is valid", () => {
|
|
128
128
|
const wh = new Webhook("MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw");
|
|
129
129
|
|
|
130
130
|
const testPayload = new TestPayload();
|
|
@@ -132,7 +132,7 @@ test("valid signature is valid and returns valid json", () => {
|
|
|
132
132
|
wh.verify(testPayload.payload, testPayload.header);
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
test("valid unbranded signature is valid
|
|
135
|
+
test("valid unbranded signature is valid", () => {
|
|
136
136
|
const wh = new Webhook("MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw");
|
|
137
137
|
|
|
138
138
|
const testPayload = new TestPayload();
|
package/src/webhook.ts
CHANGED
|
@@ -30,7 +30,7 @@ export class Webhook {
|
|
|
30
30
|
| WebhookRequiredHeaders
|
|
31
31
|
| WebhookUnbrandedRequiredHeaders
|
|
32
32
|
| Record<string, string>
|
|
33
|
-
):
|
|
33
|
+
): undefined {
|
|
34
34
|
const headers: Record<string, string> = {};
|
|
35
35
|
for (const key of Object.keys(headers_)) {
|
|
36
36
|
headers[key.toLowerCase()] = (headers_ as Record<string, string>)[key];
|
|
@@ -42,7 +42,7 @@ export class Webhook {
|
|
|
42
42
|
headers["webhook-timestamp"] =
|
|
43
43
|
headers["svix-timestamp"] ?? headers["webhook-timestamp"] ?? "";
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
this.inner.verify(payload, headers, { jsonParse: false });
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
public sign(msgId: string, timestamp: Date, payload: string | Buffer): string {
|