Skip to content

feat: Add encrypted and custom flag cache storage to the Electron SDK - #2224

Draft
joker23 wants to merge 1 commit into
skz/electron-sdk-next-net-modulefrom
skz/electron-sdk-next-storage
Draft

joker23 wants to merge 1 commit into
skz/electron-sdk-next-net-modulefrom
skz/electron-sdk-next-storage

Conversation

@joker23

@joker23 joker23 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Reworks the Electron flag cache and adds two options:

  • storage replaces the built-in file cache with an app-supplied LDElectronStorage (get, set, clear). The SDK catches and logs its errors.
  • encryptStorage encrypts the built-in cache with Electron's safeStorage and writes it to its own ldcache.enc file. A plain-text cache from an earlier run is deleted. When encryption is not available, including Linux with the basic_text backend, flags stay in memory only and the SDK logs a warning.

The built-in cache moves into an SDK-owned ldclient-user-cache directory under userData, created with mode 0o700, and the symlink check now guards that directory. ElectronPlatform takes the validated options object, which also carries wrapperName and wrapperVersion into the SDK info.

Additional context

resetElectronStorage is @internal again. The contract-test entity still imports it at runtime.

Related tickets

sdk-2172

@joker23
joker23 force-pushed the skz/electron-sdk-next-storage branch from 7860ebd to cfcda97 Compare November 20, 2026 17:49
@joker23
joker23 added this pull request to stack #2019 November 20, 2026 17:55
@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 19243 bytes
Compressed size limit: 33000
Uncompressed size: 106351 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 34596 bytes
Compressed size limit: 35500
Uncompressed size: 123487 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26376 bytes
Compressed size limit: 44000
Uncompressed size: 171444 bytes

*
* This option has no effect when {@link ElectronOptions.storage} is set.
*
* Defaults to `false`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open to discussion on whether or not we want to make this default to true ... false is chosen to be closer to previous version of the SDK

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant