vessels-sdk 0.1.0 → 0.1.1
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.cjs +6 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -110,11 +110,13 @@ var Vessels = class {
|
|
|
110
110
|
});
|
|
111
111
|
return { ok: true, events, hasMore: data.has_more ?? false };
|
|
112
112
|
}
|
|
113
|
-
// Webhook verification — call this in your webhook handler
|
|
114
|
-
// body: raw request body string
|
|
115
|
-
|
|
113
|
+
// Webhook verification — call this in your webhook handler.
|
|
114
|
+
// body: raw request body string (before JSON.parse)
|
|
115
|
+
// signature: X-Vessels-Signature header value
|
|
116
|
+
// webhookSecret: the secret shown when you created the webhook endpoint in Settings
|
|
117
|
+
verifyWebhook(body, signature, webhookSecret) {
|
|
116
118
|
if (!signature.startsWith("sha256=")) return false;
|
|
117
|
-
const expected = crypto.createHmac("sha256",
|
|
119
|
+
const expected = crypto.createHmac("sha256", webhookSecret).update(body).digest("hex");
|
|
118
120
|
const received = signature.slice(7);
|
|
119
121
|
if (expected.length !== received.length) return false;
|
|
120
122
|
let diff = 0;
|
package/dist/index.d.cts
CHANGED
|
@@ -107,7 +107,7 @@ declare class Vessels {
|
|
|
107
107
|
reasonRequiredOnReject?: boolean;
|
|
108
108
|
}): _vessels_types.ConfirmPreviewInteraction;
|
|
109
109
|
poll(options?: PollOptions): Promise<PollResponse>;
|
|
110
|
-
verifyWebhook(body: string, signature: string): boolean;
|
|
110
|
+
verifyWebhook(body: string, signature: string, webhookSecret: string): boolean;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
export { type InteractionResponseEvent, type PollEvent, type PollOptions, type PollResponse, type PushResponse, type UserMessageEvent, type VesselContext, Vessels, VesselsAuthError, type VesselsConfig, VesselsRateLimitError, VesselsValidationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ declare class Vessels {
|
|
|
107
107
|
reasonRequiredOnReject?: boolean;
|
|
108
108
|
}): _vessels_types.ConfirmPreviewInteraction;
|
|
109
109
|
poll(options?: PollOptions): Promise<PollResponse>;
|
|
110
|
-
verifyWebhook(body: string, signature: string): boolean;
|
|
110
|
+
verifyWebhook(body: string, signature: string, webhookSecret: string): boolean;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
export { type InteractionResponseEvent, type PollEvent, type PollOptions, type PollResponse, type PushResponse, type UserMessageEvent, type VesselContext, Vessels, VesselsAuthError, type VesselsConfig, VesselsRateLimitError, VesselsValidationError };
|
package/dist/index.js
CHANGED
|
@@ -108,11 +108,13 @@ var Vessels = class {
|
|
|
108
108
|
});
|
|
109
109
|
return { ok: true, events, hasMore: data.has_more ?? false };
|
|
110
110
|
}
|
|
111
|
-
// Webhook verification — call this in your webhook handler
|
|
112
|
-
// body: raw request body string
|
|
113
|
-
|
|
111
|
+
// Webhook verification — call this in your webhook handler.
|
|
112
|
+
// body: raw request body string (before JSON.parse)
|
|
113
|
+
// signature: X-Vessels-Signature header value
|
|
114
|
+
// webhookSecret: the secret shown when you created the webhook endpoint in Settings
|
|
115
|
+
verifyWebhook(body, signature, webhookSecret) {
|
|
114
116
|
if (!signature.startsWith("sha256=")) return false;
|
|
115
|
-
const expected = createHmac("sha256",
|
|
117
|
+
const expected = createHmac("sha256", webhookSecret).update(body).digest("hex");
|
|
116
118
|
const received = signature.slice(7);
|
|
117
119
|
if (expected.length !== received.length) return false;
|
|
118
120
|
let diff = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vessels-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Let your agent reach you. Official Vessels SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"typescript": "^5"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"zod": "^3.22"
|
|
31
|
+
"zod": "^3.22",
|
|
32
|
+
"@vessels/types": "workspace:*"
|
|
32
33
|
}
|
|
33
34
|
}
|