Skip to content

Move encryption methods to the private API#3369

Open
imobachgs wants to merge 5 commits intomasterfrom
encryption_methods
Open

Move encryption methods to the private API#3369
imobachgs wants to merge 5 commits intomasterfrom
encryption_methods

Conversation

@imobachgs
Copy link
Copy Markdown
Contributor

@imobachgs imobachgs commented Apr 9, 2026

The storage configuration now accepts encryption method names in both snake_case and camelCase
formats. This improves consistency with the rest of the JSON API, which uses camelCase for
property names (e.g., tpmFde, pervasiveLuks2).

Changes

  • JSON Schema: Updated encryptionSwap enum to accept both formats:
    • snake_case (backward compatible): random_swap, protected_swap, secure_swap
    • camelCase (new): randomSwap, protectedSwap, secureSwap
  • Ruby Service: Added normalization in the encryption conversion layer to automatically convert camelCase to snake_case before looking up the encryption method
    in Y2Storage
  • TypeScript Types: Regenerated type definitions to reflect the updated schema
  • Tests: Added comprehensive test coverage for all six encryption method variants

Example

Users can now use either format in their configuration:

  {
    "drives": [{
      "partitions": [{
        "filesystem": { "path": "swap" },
        "encryption": "randomSwap"
      }]
    }]
  }

or the legacy format:

{
  "encryption": "random_swap"
}

Both map to the same Y2Storage::EncryptionMethod::RANDOM_SWAP internally.

Testing

  • All existing tests pass (217 examples)
  • Added 6 new test cases covering both naming conventions for all three swap encryption methods

Backward Compatibility

✅ Fully backward compatible - existing configurations using snake_case continue to work without changes.

@imobachgs imobachgs force-pushed the encryption_methods branch from 26ca753 to f3bfcbc Compare April 9, 2026 10:00
@imobachgs imobachgs force-pushed the encryption_methods branch from df7e13b to 7b3de78 Compare April 9, 2026 13:44
@imobachgs imobachgs force-pushed the encryption_methods branch from e11c687 to 5c21fe5 Compare April 9, 2026 13:54
@imobachgs imobachgs marked this pull request as ready for review April 9, 2026 14:25
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