@lightsparkdev/lightspark-sdk 1.5.0 → 1.5.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/CHANGELOG.md +13 -0
- package/dist/index.cjs +11 -5
- package/dist/index.js +10 -4
- package/package.json +2 -2
- package/src/webhooks.ts +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @lightsparkdev/lightspark-sdk
|
|
2
2
|
|
|
3
|
+
## 1.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [da1e0b2]
|
|
8
|
+
- @lightsparkdev/core@1.0.13
|
|
9
|
+
|
|
10
|
+
## 1.5.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- e77aa92: - fix runtime error in non-node environments by dynamically importing crypto-wasm for node environments
|
|
15
|
+
|
|
3
16
|
## 1.5.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
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.2",
|
|
1953
1953
|
description: "Lightspark JS SDK",
|
|
1954
1954
|
author: "Lightspark Inc.",
|
|
1955
1955
|
keywords: [
|
|
@@ -2037,7 +2037,7 @@ var package_default = {
|
|
|
2037
2037
|
},
|
|
2038
2038
|
license: "Apache-2.0",
|
|
2039
2039
|
dependencies: {
|
|
2040
|
-
"@lightsparkdev/core": "1.0.
|
|
2040
|
+
"@lightsparkdev/core": "1.0.13",
|
|
2041
2041
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
2042
2042
|
"auto-bind": "^5.0.1",
|
|
2043
2043
|
"crypto-browserify": "^3.12.0",
|
|
@@ -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.2",
|
|
150
150
|
description: "Lightspark JS SDK",
|
|
151
151
|
author: "Lightspark Inc.",
|
|
152
152
|
keywords: [
|
|
@@ -234,7 +234,7 @@ var package_default = {
|
|
|
234
234
|
},
|
|
235
235
|
license: "Apache-2.0",
|
|
236
236
|
dependencies: {
|
|
237
|
-
"@lightsparkdev/core": "1.0.
|
|
237
|
+
"@lightsparkdev/core": "1.0.13",
|
|
238
238
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
239
239
|
"auto-bind": "^5.0.1",
|
|
240
240
|
"crypto-browserify": "^3.12.0",
|
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightsparkdev/lightspark-sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Lightspark JS SDK",
|
|
5
5
|
"author": "Lightspark Inc.",
|
|
6
6
|
"keywords": [
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"license": "Apache-2.0",
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@lightsparkdev/core": "1.0.
|
|
91
|
+
"@lightsparkdev/core": "1.0.13",
|
|
92
92
|
"@lightsparkdev/crypto-wasm": "0.1.2",
|
|
93
93
|
"auto-bind": "^5.0.1",
|
|
94
94
|
"crypto-browserify": "^3.12.0",
|
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,
|