Refactor entry point and enhance native fallback logic #485 #489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the secure storage API implementation to improve maintainability and reliability. The main changes include introducing a unified native invocation utility, extracting fallback logic for non-native environments, and updating all storage-related methods to use these new patterns. Additionally, the entry point has been updated for consistency, and the exports in
package.jsonhave been corrected.Core API refactor and fallback logic improvements:
invokeNativefunction and related types to standardize calling native methods, and extracted fallback logic for all storage operations (set, get, has, delete, list, clear) into dedicated helper functions insrc/index.ts.setItem,getItem,hasItem,deleteItem,getAllItems,clearService,getSupportedSecurityLevels) to use the newinvokeNativefunction and fallback helpers, improving error handling and code clarity insrc/index.ts.Entry point and exports updates:
package.jsonfromindex.tsxtoindex.tsto match the refactored codebase.src/index.tsxand consolidated all exports insrc/index.ts.Code organization and consistency:
resolveService,NativeSensitiveInfoModule,KeychainScopedOptions) to improve code structure and type safety insrc/index.ts.src/index.ts.These changes make the secure storage API more robust and easier to maintain, especially in environments where native modules may not be available.