@suronai/sdk 0.1.34 → 0.1.36

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/vault.js +10 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suronai/sdk",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "description": "App SDK for Suron — await vault() to load secrets",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/vault.js CHANGED
@@ -118,15 +118,15 @@ export async function vault(options = {}) {
118
118
 
119
119
  let privateKey = await fetchKey(apiUrl, requestId);
120
120
  decryptEnv(privateKey, configPath);
121
- privateKey = "";
122
- // Note: JS strings are immutable there is no way to scrub the value from
123
- // heap memory. The reference is dropped here and will be GC'd normally.
121
+ // JS strings are immutable — assigning "" does not overwrite heap memory.
122
+ // The reference is dropped here so the GC can reclaim it normally.
123
+ privateKey = ""; // drop reference
124
124
  }
125
125
 
126
126
  /**
127
127
  * Drop-in safe wrapper around vault().
128
- * Handles all known Suron errors with a console.error + process.exit(1).
129
- * Unknown errors are re-thrown so the caller still sees them.
128
+ * Handles all known Suron errors (including SuronRateLimitError) with
129
+ * a console.error + process.exit(1). Unknown errors are re-thrown.
130
130
  *
131
131
  * Usage:
132
132
  * import { config } from "@suronai/sdk";
@@ -139,10 +139,11 @@ export async function config(options = {}) {
139
139
  try {
140
140
  await vault(options);
141
141
  } catch (err) {
142
- if (err instanceof SuronDeniedError) { console.error("[suron] Boot denied."); process.exit(1); }
143
- if (err instanceof SuronTimeoutError) { console.error("[suron] Approval timed out."); process.exit(1); }
144
- if (err instanceof SuronConfigError) { console.error("[suron]", err.message); process.exit(1); }
145
- if (err instanceof SuronAppNotFoundError) { console.error("[suron]", err.message); process.exit(1); }
142
+ if (err instanceof SuronDeniedError) { console.error("[suron] Boot denied."); process.exit(1); }
143
+ if (err instanceof SuronTimeoutError) { console.error("[suron] Approval timed out."); process.exit(1); }
144
+ if (err instanceof SuronRateLimitError) { console.error("[suron]", err.message); process.exit(1); }
145
+ if (err instanceof SuronConfigError) { console.error("[suron]", err.message); process.exit(1); }
146
+ if (err instanceof SuronAppNotFoundError) { console.error("[suron]", err.message); process.exit(1); }
146
147
  throw err;
147
148
  }
148
149
  }