@fluxbase/sdk 0.0.1-rc.100 → 0.0.1-rc.101
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.cjs +29 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5057,6 +5057,30 @@ declare class AppSettingsManager {
|
|
|
5057
5057
|
* ```
|
|
5058
5058
|
*/
|
|
5059
5059
|
deleteSecretSetting(key: string): Promise<void>;
|
|
5060
|
+
/**
|
|
5061
|
+
* Get the decrypted value of a user's secret setting
|
|
5062
|
+
*
|
|
5063
|
+
* This is a privileged operation that requires service_role.
|
|
5064
|
+
* Use this to retrieve user-specific secrets when running as a service
|
|
5065
|
+
* (e.g., in edge functions or background jobs).
|
|
5066
|
+
*
|
|
5067
|
+
* @param userId - The user ID whose secret to retrieve
|
|
5068
|
+
* @param key - Secret key
|
|
5069
|
+
* @returns Promise resolving to the decrypted secret value
|
|
5070
|
+
*
|
|
5071
|
+
* @example
|
|
5072
|
+
* ```typescript
|
|
5073
|
+
* // In an edge function, get a user's API key for validation
|
|
5074
|
+
* const apiKey = await fluxbaseService.admin.settings.app.getUserSecretValue(
|
|
5075
|
+
* userId,
|
|
5076
|
+
* 'owntracks_api_key'
|
|
5077
|
+
* )
|
|
5078
|
+
* if (apiKey !== providedKey) {
|
|
5079
|
+
* throw new Error('Invalid API key')
|
|
5080
|
+
* }
|
|
5081
|
+
* ```
|
|
5082
|
+
*/
|
|
5083
|
+
getUserSecretValue(userId: string, key: string): Promise<string>;
|
|
5060
5084
|
}
|
|
5061
5085
|
/**
|
|
5062
5086
|
* Email Template Manager
|
package/dist/index.d.ts
CHANGED
|
@@ -5057,6 +5057,30 @@ declare class AppSettingsManager {
|
|
|
5057
5057
|
* ```
|
|
5058
5058
|
*/
|
|
5059
5059
|
deleteSecretSetting(key: string): Promise<void>;
|
|
5060
|
+
/**
|
|
5061
|
+
* Get the decrypted value of a user's secret setting
|
|
5062
|
+
*
|
|
5063
|
+
* This is a privileged operation that requires service_role.
|
|
5064
|
+
* Use this to retrieve user-specific secrets when running as a service
|
|
5065
|
+
* (e.g., in edge functions or background jobs).
|
|
5066
|
+
*
|
|
5067
|
+
* @param userId - The user ID whose secret to retrieve
|
|
5068
|
+
* @param key - Secret key
|
|
5069
|
+
* @returns Promise resolving to the decrypted secret value
|
|
5070
|
+
*
|
|
5071
|
+
* @example
|
|
5072
|
+
* ```typescript
|
|
5073
|
+
* // In an edge function, get a user's API key for validation
|
|
5074
|
+
* const apiKey = await fluxbaseService.admin.settings.app.getUserSecretValue(
|
|
5075
|
+
* userId,
|
|
5076
|
+
* 'owntracks_api_key'
|
|
5077
|
+
* )
|
|
5078
|
+
* if (apiKey !== providedKey) {
|
|
5079
|
+
* throw new Error('Invalid API key')
|
|
5080
|
+
* }
|
|
5081
|
+
* ```
|
|
5082
|
+
*/
|
|
5083
|
+
getUserSecretValue(userId: string, key: string): Promise<string>;
|
|
5060
5084
|
}
|
|
5061
5085
|
/**
|
|
5062
5086
|
* Email Template Manager
|
package/dist/index.js
CHANGED
|
@@ -4204,6 +4204,35 @@ var AppSettingsManager = class {
|
|
|
4204
4204
|
async deleteSecretSetting(key) {
|
|
4205
4205
|
await this.fetch.delete(`/api/v1/admin/settings/custom/secret/${key}`);
|
|
4206
4206
|
}
|
|
4207
|
+
/**
|
|
4208
|
+
* Get the decrypted value of a user's secret setting
|
|
4209
|
+
*
|
|
4210
|
+
* This is a privileged operation that requires service_role.
|
|
4211
|
+
* Use this to retrieve user-specific secrets when running as a service
|
|
4212
|
+
* (e.g., in edge functions or background jobs).
|
|
4213
|
+
*
|
|
4214
|
+
* @param userId - The user ID whose secret to retrieve
|
|
4215
|
+
* @param key - Secret key
|
|
4216
|
+
* @returns Promise resolving to the decrypted secret value
|
|
4217
|
+
*
|
|
4218
|
+
* @example
|
|
4219
|
+
* ```typescript
|
|
4220
|
+
* // In an edge function, get a user's API key for validation
|
|
4221
|
+
* const apiKey = await fluxbaseService.admin.settings.app.getUserSecretValue(
|
|
4222
|
+
* userId,
|
|
4223
|
+
* 'owntracks_api_key'
|
|
4224
|
+
* )
|
|
4225
|
+
* if (apiKey !== providedKey) {
|
|
4226
|
+
* throw new Error('Invalid API key')
|
|
4227
|
+
* }
|
|
4228
|
+
* ```
|
|
4229
|
+
*/
|
|
4230
|
+
async getUserSecretValue(userId, key) {
|
|
4231
|
+
const response = await this.fetch.get(
|
|
4232
|
+
`/api/v1/admin/settings/user/${encodeURIComponent(userId)}/secret/${encodeURIComponent(key)}/decrypt`
|
|
4233
|
+
);
|
|
4234
|
+
return response.value;
|
|
4235
|
+
}
|
|
4207
4236
|
};
|
|
4208
4237
|
var EmailTemplateManager = class {
|
|
4209
4238
|
constructor(fetch2) {
|