Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove device-dependent encryption parameters #5557

Closed
woodenfurniture opened this issue Oct 29, 2023 · 1 comment · Fixed by shapeshift/hdwallet#654 or #5763
Closed

Remove device-dependent encryption parameters #5557

woodenfurniture opened this issue Oct 29, 2023 · 1 comment · Fixed by shapeshift/hdwallet#654 or #5763
Assignees
Milestone

Comments

@woodenfurniture
Copy link
Member

woodenfurniture commented Oct 29, 2023

Description:

While optimizing Shapeshift's runtime performance, particularly for devices with lower computational power, it's evident that the current encryption parameter benchmarking mechanism poses a bottleneck. The benchmark takes 4s to run on an M2 Mac and significantly more time on older mobile devices, causing undesirable delays during first boot. This issue aims to discuss and implement a hard-coded set of sensible defaults for encryption parameters, thereby removing the need for device-dependent benchmarks.

This issue is specific to native wallet only - other wallets are unaffected.

Additional Context

To reproduce the issue, launch the app for the first time (empty indexed db) to notice the benchmark run - it runs when the native wallet is first opened.

  • Benchmark code: argonBenchmark.ts
  • Consumption code: rawVault.ts
  • The benchmark aims to optimize for a target of 1000ms boot time but often exceeds this, especially on lower-end devices.
  • The benchmark iteself takes 4s to run on an M2 Mac and significantly more time on older mobile devices.
  • The current parameter set (e.g., 32MB buffer, 54 iterations) appears to be overkill for browser storage requirements.

Actions

  1. Hardcode sensible defaults for encryption parameters, skipping the benchmark.
  2. Conduct a performance analysis on a variety of devices to determine an optimal default set.

Acceptance criteria

  1. Performance Metrics: Demonstrate that the new hardcoded encryption parameters result in a boot time that is notably faster than the current dynamic benchmarking method, especially on lower-end devices. Aim for a boot time under 1 second for modern devices and under 3 seconds for older devices.
  2. Security Analysis: Conduct a security assessment to confirm that the hardcoded encryption parameters provide adequate protection against brute-force attacks and other vulnerabilities. The parameters should adhere to industry-standard security guidelines.
  3. Backward Compatibility: Ensure that existing users who have wallets encrypted with the old parameters can seamlessly transition to using the new hardcoded parameters without any data loss or additional steps.
  4. Cross-Device Consistency: Validate that the new hardcoded encryption parameters provide consistent boot times and security levels across a variety of devices (e.g., different models of smartphones, tablets, and desktops).
@0xean
Copy link
Contributor

0xean commented Nov 27, 2023

@woodenfurniture to take a look at pre-implementation to see what was done before this feature was added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
2 participants