@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 CHANGED
@@ -4206,6 +4206,35 @@ var AppSettingsManager = class {
4206
4206
  async deleteSecretSetting(key) {
4207
4207
  await this.fetch.delete(`/api/v1/admin/settings/custom/secret/${key}`);
4208
4208
  }
4209
+ /**
4210
+ * Get the decrypted value of a user's secret setting
4211
+ *
4212
+ * This is a privileged operation that requires service_role.
4213
+ * Use this to retrieve user-specific secrets when running as a service
4214
+ * (e.g., in edge functions or background jobs).
4215
+ *
4216
+ * @param userId - The user ID whose secret to retrieve
4217
+ * @param key - Secret key
4218
+ * @returns Promise resolving to the decrypted secret value
4219
+ *
4220
+ * @example
4221
+ * ```typescript
4222
+ * // In an edge function, get a user's API key for validation
4223
+ * const apiKey = await fluxbaseService.admin.settings.app.getUserSecretValue(
4224
+ * userId,
4225
+ * 'owntracks_api_key'
4226
+ * )
4227
+ * if (apiKey !== providedKey) {
4228
+ * throw new Error('Invalid API key')
4229
+ * }
4230
+ * ```
4231
+ */
4232
+ async getUserSecretValue(userId, key) {
4233
+ const response = await this.fetch.get(
4234
+ `/api/v1/admin/settings/user/${encodeURIComponent(userId)}/secret/${encodeURIComponent(key)}/decrypt`
4235
+ );
4236
+ return response.value;
4237
+ }
4209
4238
  };
4210
4239
  var EmailTemplateManager = class {
4211
4240
  constructor(fetch2) {