Skip to content

refactor(encryption): add typing and modernize IEncryptionModule - #57551

Open
joshtrichards wants to merge 24 commits into
masterfrom
jtr/chore-IEncryptionModule-typing
Open

refactor(encryption): add typing and modernize IEncryptionModule#57551
joshtrichards wants to merge 24 commits into
masterfrom
jtr/chore-IEncryptionModule-typing

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Jan 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Fully aligns IEncryptionModule interface and implementation function signatures
  • Modernizes the interface (and its implementation) by introducing strict typing
  • Drops redundant implementation docblocks (100% of essential API documentation now centralized in the interface)
  • Helpful docblocks are added to non-interface helper functions for clarity and maintainability

Should be fully backwards compatible.

P.S. $position was already a de facto string. Any type related changes indicated in this PR for that parameter merely make it match implementation (and drop some casting). And despite it's name, it's used for string concatenation (at least in the context relevant to this PR).

TODO

  • ...

Checklist

@joshtrichards joshtrichards added feature: encryption (server-side) technical debt 🧱 🤔🚀 ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Jan 14, 2026
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
They're now all well defined in the interface (and mostly already were). The rare implementation specific bits retained.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
One is always an int but the other is a string and often more than than the raw position, but an id marker (e.g. `5end`). 

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards
joshtrichards force-pushed the jtr/chore-IEncryptionModule-typing branch from 5947bef to 7ab2238 Compare February 4, 2026 20:00
@joshtrichards joshtrichards changed the title refactor(encryption): add strict type hints to IEncryptionModule refactor(encryption): add typing and modernize IEncryptionModule Feb 4, 2026
@joshtrichards
joshtrichards marked this pull request as ready for review February 4, 2026 20:08
@joshtrichards
joshtrichards requested a review from a team as a code owner February 4, 2026 20:09
@joshtrichards
joshtrichards requested review from CarlSchwan, come-nc, leftybournes, salmart-dev and sorbaugh and removed request for a team February 4, 2026 20:09
*/
namespace OCP\Encryption;

use OC\Encryption\Exceptions\DecryptionFailedException;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It’s not allowed to reference OC classes in OCP.
So either add a public interface for the exception, or document as @throws \Exception

* @throws MultiKeyEncryptException
*/
public function end($path, $position = '0') {
public function end(string $path, string $blockId = '0'): string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is technically a breaking change because of named parameters.

@susnux susnux added the community pull requests from community label Jun 9, 2026
@susnux susnux added this to the Nextcloud 35 milestone Jun 9, 2026
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community pull requests from community feature: encryption (server-side) ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) technical debt 🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants