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

chore(backup): add encrypted stream [WPB-10575] #3154

Merged

Conversation

vitorhugods
Copy link
Member

@vitorhugods vitorhugods commented Dec 7, 2024

StoryWPB-10575 Cross Platform Backup: Write common backup / restore library


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Backups should be encrypted. We need to add support for this in the multiplatform library

Solutions

Rely on libsodium and the Kotlin Multiplatform bindings for it.

We can use libsodium's Secret Stream, which allows us to split encrypted messages in chunks, so we don't need to load the whole backup into memory.

This PR adds a wrapper around it, that uses Okio's Sink/Source to read/write data in streams.

On a future PR, I'll add the code that will actually call this, with data being backed up, etc.

This was originally implemented within :cryptography, but was only used for BackUps and the code could use a bit of refactoring.

Maybe in the future it can be in its own :secret-stream module.

Dependencies

Needs releases with:

Testing

Test Coverage

  • I have added automated test to this contribution

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@echoes-hq echoes-hq bot added the echoes: product-roadmap/feature Work contributing to adding a new feature as part of the product roadmap. label Dec 7, 2024
@vitorhugods vitorhugods force-pushed the backup/chore/add-encrypted-stream branch from de9f33f to 45ef225 Compare December 7, 2024 03:23
Copy link
Contributor

github-actions bot commented Dec 7, 2024

Test Results

3 337 tests   3 230 ✅  5m 33s ⏱️
  568 suites    107 💤
  568 files        0 ❌

Results for commit 03d563a.

♻️ This comment has been updated with latest results.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Dec 7, 2024

Datadog Report

Branch report: backup/chore/add-encrypted-stream
Commit report: 1b18739
Test service: kalium-jvm

✅ 0 Failed, 3230 Passed, 107 Skipped, 37.4s Total Time

@vitorhugods vitorhugods marked this pull request as ready for review December 9, 2024 17:31
@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (epic/multiplatform-backup@3a7656d). Learn more about missing BASE report.

Additional details and impacted files
@@                     Coverage Diff                      @@
##             epic/multiplatform-backup    #3154   +/-   ##
============================================================
  Coverage                             ?   54.03%           
============================================================
  Files                                ?     1246           
  Lines                                ?    36152           
  Branches                             ?     3656           
============================================================
  Hits                                 ?    19533           
  Misses                               ?    15208           
  Partials                             ?     1411           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a7656d...03d563a. Read the comment docs.

Copy link
Contributor

@Garzas Garzas left a comment

Choose a reason for hiding this comment

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

Looking good 🎖️ Just one question about tests

@vitorhugods vitorhugods merged commit 77f183f into epic/multiplatform-backup Dec 10, 2024
21 checks passed
@vitorhugods vitorhugods deleted the backup/chore/add-encrypted-stream branch December 10, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap/feature Work contributing to adding a new feature as part of the product roadmap. 👕 size: L type: chore 🧹
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants