@lightsparkdev/lightspark-sdk 1.5.0 → 1.5.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +10 -4
- package/dist/index.js +9 -3
- package/package.json +1 -1
- package/src/webhooks.ts +11 -2
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1949,7 +1949,7 @@ var import_core9 = require("@lightsparkdev/core");
|
|
|
1949
1949
|
// package.json
|
|
1950
1950
|
var package_default = {
|
|
1951
1951
|
name: "@lightsparkdev/lightspark-sdk",
|
|
1952
|
-
version: "1.5.
|
|
1952
|
+
version: "1.5.1",
|
|
1953
1953
|
description: "Lightspark JS SDK",
|
|
1954
1954
|
author: "Lightspark Inc.",
|
|
1955
1955
|
keywords: [
|
|
@@ -14488,7 +14488,7 @@ ${FRAGMENT35}
|
|
|
14488
14488
|
};
|
|
14489
14489
|
|
|
14490
14490
|
// src/webhooks.ts
|
|
14491
|
-
var
|
|
14491
|
+
var import_core14 = require("@lightsparkdev/core");
|
|
14492
14492
|
var WEBHOOKS_SIGNATURE_HEADER = "lightspark-signature";
|
|
14493
14493
|
var verifyAndParseWebhook = async (data, hexdigest, webhook_secret) => {
|
|
14494
14494
|
const { createHmac } = await import("crypto");
|
|
@@ -14523,8 +14523,14 @@ var RemoteSigningWebhookHandler = class {
|
|
|
14523
14523
|
this.#masterSeed = masterSeed;
|
|
14524
14524
|
this.validator = validator;
|
|
14525
14525
|
}
|
|
14526
|
-
handleWebhookRequest(data, webhookSignature, webhookSecret) {
|
|
14527
|
-
|
|
14526
|
+
async handleWebhookRequest(data, webhookSignature, webhookSecret) {
|
|
14527
|
+
if (!import_core14.isNode) {
|
|
14528
|
+
throw new import_core14.LightsparkSigningException(
|
|
14529
|
+
"Environment not supported for handling webhooks."
|
|
14530
|
+
);
|
|
14531
|
+
}
|
|
14532
|
+
const { wasm_handle_remote_signing_webhook_event } = await import("@lightsparkdev/crypto-wasm");
|
|
14533
|
+
const response = wasm_handle_remote_signing_webhook_event(
|
|
14528
14534
|
data,
|
|
14529
14535
|
webhookSignature,
|
|
14530
14536
|
webhookSecret,
|
package/dist/index.js
CHANGED
|
@@ -146,7 +146,7 @@ import {
|
|
|
146
146
|
// package.json
|
|
147
147
|
var package_default = {
|
|
148
148
|
name: "@lightsparkdev/lightspark-sdk",
|
|
149
|
-
version: "1.5.
|
|
149
|
+
version: "1.5.1",
|
|
150
150
|
description: "Lightspark JS SDK",
|
|
151
151
|
author: "Lightspark Inc.",
|
|
152
152
|
keywords: [
|
|
@@ -2289,7 +2289,7 @@ var LightsparkClient = class {
|
|
|
2289
2289
|
var client_default = LightsparkClient;
|
|
2290
2290
|
|
|
2291
2291
|
// src/webhooks.ts
|
|
2292
|
-
import {
|
|
2292
|
+
import { LightsparkSigningException as LightsparkSigningException4, isNode } from "@lightsparkdev/core";
|
|
2293
2293
|
var WEBHOOKS_SIGNATURE_HEADER = "lightspark-signature";
|
|
2294
2294
|
var verifyAndParseWebhook = async (data, hexdigest, webhook_secret) => {
|
|
2295
2295
|
const { createHmac } = await import("crypto");
|
|
@@ -2324,7 +2324,13 @@ var RemoteSigningWebhookHandler = class {
|
|
|
2324
2324
|
this.#masterSeed = masterSeed;
|
|
2325
2325
|
this.validator = validator;
|
|
2326
2326
|
}
|
|
2327
|
-
handleWebhookRequest(data, webhookSignature, webhookSecret) {
|
|
2327
|
+
async handleWebhookRequest(data, webhookSignature, webhookSecret) {
|
|
2328
|
+
if (!isNode) {
|
|
2329
|
+
throw new LightsparkSigningException4(
|
|
2330
|
+
"Environment not supported for handling webhooks."
|
|
2331
|
+
);
|
|
2332
|
+
}
|
|
2333
|
+
const { wasm_handle_remote_signing_webhook_event } = await import("@lightsparkdev/crypto-wasm");
|
|
2328
2334
|
const response = wasm_handle_remote_signing_webhook_event(
|
|
2329
2335
|
data,
|
|
2330
2336
|
webhookSignature,
|
package/package.json
CHANGED
package/src/webhooks.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LightsparkSigningException, isNode } from "@lightsparkdev/core";
|
|
2
2
|
import type LightsparkClient from "./client.js";
|
|
3
3
|
import { WebhookEventType } from "./objects/WebhookEventType.js";
|
|
4
4
|
|
|
@@ -65,11 +65,20 @@ export class RemoteSigningWebhookHandler {
|
|
|
65
65
|
this.validator = validator;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
handleWebhookRequest(
|
|
68
|
+
async handleWebhookRequest(
|
|
69
69
|
data: Uint8Array,
|
|
70
70
|
webhookSignature: string,
|
|
71
71
|
webhookSecret: string,
|
|
72
72
|
) {
|
|
73
|
+
if (!isNode) {
|
|
74
|
+
throw new LightsparkSigningException(
|
|
75
|
+
"Environment not supported for handling webhooks.",
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const { wasm_handle_remote_signing_webhook_event } = await import(
|
|
80
|
+
"@lightsparkdev/crypto-wasm"
|
|
81
|
+
);
|
|
73
82
|
const response = wasm_handle_remote_signing_webhook_event(
|
|
74
83
|
data,
|
|
75
84
|
webhookSignature,
|