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

Support encrypting for multiple recipients (and add Scala 3 support) #211

Merged
merged 10 commits into from
Jan 2, 2024

Conversation

bpholt
Copy link
Member

@bpholt bpholt commented Aug 24, 2023

In order to add support for Scala 3, we need to update to Refined 0.11 and swap out Shapeless tagged types with a Scala-3 compatible library like Monix Newtypes. Since that all requires making changes to the ABI, it's a good opportunity to remove a lot of bincompat cruft that had built up, and also make the core algebras available independently. This omnibus PR does all of that.

I'm working on Scalafixes for the source-breaking changes, so hopefully we can have those ready for Scala Steward to run before this is released as v0.5.0.

@bpholt
Copy link
Member Author

bpholt commented Aug 24, 2023

@CJSmith-0141 can you take a look and let me know what you think, or if you have any questions?

@CJSmith-0141
Copy link
Contributor

Thank you for taking this up! I'll take a look at in and provide a review / feedback / ask questions.

Copy link
Contributor

@CJSmith-0141 CJSmith-0141 left a comment

Choose a reason for hiding this comment

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

Much more comprehensive than my attempt, thank you! +1

@bpholt bpholt force-pushed the encrypt-multiple-recipients branch from ed9ba93 to 3d0eaa2 Compare August 28, 2023 22:29
@bpholt bpholt marked this pull request as ready for review September 25, 2023 21:37
@bpholt bpholt requested a review from a team as a code owner September 25, 2023 21:37
@bpholt
Copy link
Member Author

bpholt commented Sep 25, 2023

I was thinking that I should hold off on merging this until the Scalafixes are done, but I just realized we can go ahead and merge—Scala Steward won't suggest updates until this is actually released, and we can hold off on that until the Scalafixes are ready. In the meantime, we can use the snapshot that will be published on the merge.

@CJSmith-0141
Copy link
Contributor

@bpholt What are you referring to with Scalafixes? Thank you for cutting a release on the 0.4.x series.

@bpholt
Copy link
Member Author

bpholt commented Sep 27, 2023

What are you referring to with Scalafixes?

e.g. a Scalafix rule to rewrite a method call from armor() to armor. I think most of the source-breaking changes introduced can be automatically rewritten, which would be nice for anyone who gets the update via Scala Steward.

Here's the list of rules I came up with:

  1. CryptoAlg constructor

    CryptoAlg[F]

    to

    CryptoAlg.resource[F]
  2. Armor parens

    cryptoAlg.armor()

    to

    cryptoAlg.armor
  3. Encrypt options

    cryptoAlg.encrypt(key, fileName = filename.value.some)

    to

    cryptoAlg.encrypt(EncryptionConfig().withFileName(filename.value.some), key)
  4. tagged types

    tagChunkSize(foo: PosInt)

    to

    ChunkSize(foo)

@CJSmith-0141
Copy link
Contributor

As an FYI @bpholt I cut a release based on this branch on my fork and have been using it in Scala 3 without issue. I couldn't figure out how to keep Scala 2.12 working, so I dropped it from my fork. If there is anything I could do to get this merged here please let me know! Is it just writing some scalafix rules? Would dropping 2.12 support here be ok?

@bpholt bpholt changed the base branch from main to series/0.5 December 29, 2023 22:59
bpholt and others added 10 commits December 29, 2023 17:00
note: this is not binary compatible with previous versions of the
library due to the interface changes required to support multiple keys.
…correct key

introducing this required LoggerFactory in places where we used to get
away with Logger, so it introduces further binary incompatibilities. as
such, the remaining compatibility shims have been cleaned up
@bpholt bpholt merged commit 72d0596 into series/0.5 Jan 2, 2024
15 checks passed
@bpholt bpholt deleted the encrypt-multiple-recipients branch January 2, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants