sliftutils 1.1.40 → 1.1.41

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/index.d.ts CHANGED
@@ -55,6 +55,7 @@ declare module "sliftutils/misc/getSecret" {
55
55
  getAllKeys(): string[];
56
56
  get(key: string): Promise<string> | undefined;
57
57
  };
58
+ export declare function setSecret(key: string, value: string): void;
58
59
 
59
60
  }
60
61
 
@@ -7,3 +7,4 @@ export declare const getSecret: {
7
7
  getAllKeys(): string[];
8
8
  get(key: string): Promise<string> | undefined;
9
9
  };
10
+ export declare function setSecret(key: string, value: string): void;
package/misc/getSecret.ts CHANGED
@@ -96,3 +96,10 @@ export const getSecret = cache(async function getSecret(key: string): Promise<st
96
96
  });
97
97
  });
98
98
  });
99
+
100
+ export function setSecret(key: string, value: string) {
101
+ if (isNode()) {
102
+ throw new Error("setSecret is only supported in the browser. We don't want to break the user's file system with setSecret in NodeJS.");
103
+ }
104
+ localStorage.setItem(getStorageKey(key), value);
105
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "1.1.40",
3
+ "version": "1.1.41",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [