@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.
- package/package.json +1 -1
- package/src/vault.js +10 -9
package/package.json
CHANGED
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
|
-
|
|
122
|
-
//
|
|
123
|
-
|
|
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
|
|
129
|
-
* Unknown errors are re-thrown
|
|
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.");
|
|
143
|
-
if (err instanceof SuronTimeoutError) { console.error("[suron] Approval timed out.");
|
|
144
|
-
if (err instanceof
|
|
145
|
-
if (err instanceof
|
|
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
|
}
|