@elizaos/project-tee-starter 1.5.12-alpha.2 → 1.5.12

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.js CHANGED
@@ -28455,8 +28455,7 @@ var require_dist5 = __commonJS((exports) => {
28455
28455
  return result;
28456
28456
  }
28457
28457
  close(code, data) {
28458
- if (this.socket)
28459
- this.socket.close(code || 1000, data);
28458
+ this.socket.close(code || 1000, data);
28460
28459
  }
28461
28460
  setAutoReconnect(reconnect) {
28462
28461
  this.reconnect = reconnect;
@@ -28467,18 +28466,6 @@ var require_dist5 = __commonJS((exports) => {
28467
28466
  setMaxReconnects(max_reconnects) {
28468
28467
  this.max_reconnects = max_reconnects;
28469
28468
  }
28470
- getCurrentReconnects() {
28471
- return this.current_reconnects;
28472
- }
28473
- getMaxReconnects() {
28474
- return this.max_reconnects;
28475
- }
28476
- isReconnecting() {
28477
- return this.reconnect_timer_id !== undefined;
28478
- }
28479
- willReconnect() {
28480
- return this.reconnect && (this.max_reconnects === 0 || this.current_reconnects < this.max_reconnects);
28481
- }
28482
28469
  _connect(address, options) {
28483
28470
  clearTimeout(this.reconnect_timer_id);
28484
28471
  this.socket = this.webSocketFactory(address, options);
@@ -28537,9 +28524,6 @@ var require_dist5 = __commonJS((exports) => {
28537
28524
  this.current_reconnects++;
28538
28525
  if (this.reconnect && (this.max_reconnects > this.current_reconnects || this.max_reconnects === 0))
28539
28526
  this.reconnect_timer_id = setTimeout(() => this._connect(address, options), this.reconnect_interval);
28540
- else if (this.reconnect && this.max_reconnects > 0 && this.current_reconnects >= this.max_reconnects) {
28541
- setTimeout(() => this.emit("max_reconnects_reached", code, reason), 1);
28542
- }
28543
28527
  });
28544
28528
  }
28545
28529
  };
@@ -35192,7 +35176,7 @@ var configSchema = z.object({
35192
35176
  if (!val)
35193
35177
  return true;
35194
35178
  return ["OFF", "LOCAL", "DOCKER", "PRODUCTION"].includes(val);
35195
- }, { message: "TEE_MODE must be one of: OFF, LOCAL, DOCKER, PRODUCTION" }),
35179
+ }, "TEE_MODE must be one of: OFF, LOCAL, DOCKER, PRODUCTION"),
35196
35180
  TEE_VENDOR: z.string().optional().transform((val) => {
35197
35181
  if (false) {}
35198
35182
  return val;
@@ -35200,33 +35184,34 @@ var configSchema = z.object({
35200
35184
  if (!val)
35201
35185
  return true;
35202
35186
  return val === "phala";
35203
- }, { message: "TEE_VENDOR must be: phala" }),
35187
+ }, "TEE_VENDOR must be: phala"),
35204
35188
  WALLET_SECRET_SALT: z.string().optional().transform((val) => {
35205
35189
  if (false) {}
35206
35190
  if (!val) {
35207
35191
  logger.warn("Warning: Wallet secret salt is not provided");
35208
- return val;
35209
35192
  }
35210
- return val.trim();
35211
- }).refine((val) => {
35212
- if (val === undefined)
35213
- return true;
35214
- if (!val || val.length === 0)
35215
- return false;
35216
- return val.length >= 8;
35217
- }, {
35218
- message: "Wallet secret salt must be at least 8 characters long for security (excluding whitespace)"
35193
+ return val;
35219
35194
  }).refine((val) => {
35220
- if (val === undefined)
35195
+ if (!val)
35221
35196
  return true;
35222
- if (!val || val.length === 0)
35223
- return false;
35224
- return val.length <= 128;
35225
- }, { message: "Wallet secret salt must not exceed 128 characters (excluding whitespace)" })
35197
+ const trimmedVal = val.trim();
35198
+ return trimmedVal.length >= 8 && trimmedVal.length <= 128;
35199
+ }, (val) => {
35200
+ if (!val)
35201
+ return { message: "Wallet secret salt is required" };
35202
+ const trimmedVal = val.trim();
35203
+ if (trimmedVal.length < 8) {
35204
+ return { message: "Wallet secret salt must be at least 8 characters long for security" };
35205
+ }
35206
+ if (trimmedVal.length > 128) {
35207
+ return { message: "Wallet secret salt must not exceed 128 characters" };
35208
+ }
35209
+ return { message: "Invalid wallet secret salt" };
35210
+ })
35226
35211
  });
35227
35212
  var createTeeServiceConfig = (runtime) => ({
35228
35213
  teeClient: new import_dstack_sdk.TappdClient,
35229
- secretSalt: (process.env.WALLET_SECRET_SALT || "secret_salt").trim(),
35214
+ secretSalt: process.env.WALLET_SECRET_SALT || "secret_salt",
35230
35215
  runtime
35231
35216
  });
35232
35217
  var deriveEcdsaKeypair = (deriveKeyResponse) => {
@@ -35323,22 +35308,7 @@ var teeStarterPlugin = {
35323
35308
  }
35324
35309
  } catch (error) {
35325
35310
  if (error instanceof z.ZodError) {
35326
- const hasInvalidMode = error.issues.some((e) => e.path[0] === "TEE_MODE" && e.message.includes("TEE_MODE must be"));
35327
- if (hasInvalidMode) {
35328
- const teeError = error.issues.find((e) => e.path[0] === "TEE_MODE");
35329
- throw new Error(teeError?.message || "TEE_MODE must be one of: OFF, LOCAL, DOCKER, PRODUCTION");
35330
- }
35331
- const hasInvalidVendor = error.issues.some((e) => e.path[0] === "TEE_VENDOR" && e.message.includes("TEE_VENDOR must be"));
35332
- if (hasInvalidVendor) {
35333
- const vendorError = error.issues.find((e) => e.path[0] === "TEE_VENDOR");
35334
- throw new Error(vendorError?.message || "TEE_VENDOR must be: phala");
35335
- }
35336
- const hasSaltError = error.issues.some((e) => e.path[0] === "WALLET_SECRET_SALT");
35337
- if (hasSaltError) {
35338
- const saltError = error.issues.find((e) => e.path[0] === "WALLET_SECRET_SALT");
35339
- throw new Error(saltError?.message || "Invalid wallet secret salt");
35340
- }
35341
- throw new Error("Invalid plugin configuration");
35311
+ throw new Error(`Invalid plugin configuration: ${error.errors.map((e) => e.message).join(", ")}`);
35342
35312
  }
35343
35313
  throw error;
35344
35314
  }
@@ -35666,5 +35636,5 @@ export {
35666
35636
  StarterService
35667
35637
  };
35668
35638
 
35669
- //# debugId=8F12EBB04074C17A64756E2164756E21
35639
+ //# debugId=9407D5FBB03532A064756E2164756E21
35670
35640
  //# sourceMappingURL=index.js.map