Include standalone HKDF implementation for v1.local tokens#6
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6 +/- ##
============================================
+ Coverage 82.82% 82.94% +0.11%
- Complexity 246 250 +4
============================================
Files 52 54 +2
Lines 722 727 +5
Branches 53 53
============================================
+ Hits 598 603 +5
Misses 94 94
Partials 30 30
Continue to review full report at Codecov.
|
|
Nice! I’ll take a look! |
Now that we have more than one option for V1 Local tokens HKDF and BC, a `BaseV1LocalCryptoProvider` has been added. This reduces what is needed to implement a V1LocalCryptoProvider to a single method.
|
@zbiljic, I hadn't seen this lib before, very nice. I sent a few tweaks to your branch: https://github.com/zbiljic/jpaseto/pull/1 If you are happy with that merge it into, your branch, and then I'll pull it in, and cut a release. After that, I'll try to add a table to the readme and list out the advantages of each implementation (and the spec versions they support), BC, HKDF, libsodium. Thoughts? |
|
Yeah, your changes look great. (I did not want to make some core edits to someones project.) |
Add BaseV1LocalCryptoProvider
I have created new
V1LocalCryptoProviderclass that replaces Bouncy Castle dependency for HKDF project (https://github.com/patrickfav/hkdf).For anyone needing only 'v1.local' tokens this should result in MUCH smaller dependency (~11 KB for HKDF vs. ~4.3 MB for Bouncy Castle).
My idea is that this can be used when size of end JAR may be constraint, such is for Android or AWS Lambda functions.
Please note update to
README.mdfile, that is only part I question whether I made acceptable change. Main change should be simple.As far as testing goes, I have copied
V1LocalITand changed one method, where the encryption is now done via HKDF provider and decryption using Bouncy Castle provider. I felt this was enough, as other test cases would require changes to core library (or some other creative approach) as the library depends on using first implementation for provider found usingServiceLoader.