vessels-sdk 0.1.0 → 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/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, signature: X-Vessels-Signature header value
115
- verifyWebhook(body, signature) {
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", this.apiKey).update(body).digest("hex");
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, signature: X-Vessels-Signature header value
113
- verifyWebhook(body, signature) {
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", this.apiKey).update(body).digest("hex");
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.0",
3
+ "version": "0.1.2",
4
4
  "description": "Let your agent reach you. Official Vessels SDK.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,12 +22,13 @@
22
22
  },
23
23
  "keywords": ["ai", "agents", "vessels", "llm", "notifications"],
24
24
  "license": "MIT",
25
+ "dependencies": {
26
+ "zod": "^3.22"
27
+ },
25
28
  "devDependencies": {
26
29
  "@types/node": "^25.5.2",
30
+ "@vessels/types": "workspace:*",
27
31
  "tsup": "^8.5.1",
28
32
  "typescript": "^5"
29
- },
30
- "dependencies": {
31
- "zod": "^3.22"
32
33
  }
33
34
  }