generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Refactor @web5/crypto
to replace Web Crypto CryptoKey
with JWK
#318
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Frank Hinek <[email protected]>
…lify sign/verify Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
TBDocs Report ✅ No errors or warnings @web5/api
Updated @ 2023-11-28T14:17:44.712Z - Commit: |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #318 +/- ##
==========================================
+ Coverage 90.78% 91.77% +0.99%
==========================================
Files 74 73 -1
Lines 14090 15759 +1669
Branches 1390 1448 +58
==========================================
+ Hits 12791 14463 +1672
+ Misses 1273 1270 -3
Partials 26 26
|
Signed-off-by: Frank Hinek <[email protected]>
frankhinek
force-pushed
the
crypto-jwk
branch
from
November 28, 2023 14:15
5034b4a
to
d6b444d
Compare
mistermoe
approved these changes
Nov 28, 2023
csuwildcat
approved these changes
Nov 28, 2023
This was referenced Nov 28, 2023
finn-block
pushed a commit
that referenced
this pull request
Mar 19, 2024
) * Refactor Ed25519 to generateKey instead of generateKeyPair * Refactor Secp256k1 to generateKey instead of generateKeyPair and simplify sign/verify * Refactor X25519 to generateKey instead of generateKeyPair * Refactor PBKDF2 to use JWKs * Remove CryptoKeyToJwkMixin * Improve test coverage for PBKDF2 * Refactor Ed25519, Secp256k1, and X25519 to use JWKs * Refactor EcdhAlgorithm to use JWK * Refactor EcdsaAlgorithm to use JWK * Refactor EdDsaAlgorithm to use JWK * Refactor AesCtrAlgorithm to use JWK * Refactor AesCtrAlgorithm to JWK * Refactor AesGcm to use JWK * Bump @noble ciphers, curves, and hashes dependencies --------- Signed-off-by: Frank Hinek <[email protected]>
finn-block
pushed a commit
that referenced
this pull request
Mar 19, 2024
) * Refactor Ed25519 to generateKey instead of generateKeyPair * Refactor Secp256k1 to generateKey instead of generateKeyPair and simplify sign/verify * Refactor X25519 to generateKey instead of generateKeyPair * Refactor PBKDF2 to use JWKs * Remove CryptoKeyToJwkMixin * Improve test coverage for PBKDF2 * Refactor Ed25519, Secp256k1, and X25519 to use JWKs * Refactor EcdhAlgorithm to use JWK * Refactor EcdsaAlgorithm to use JWK * Refactor EdDsaAlgorithm to use JWK * Refactor AesCtrAlgorithm to use JWK * Refactor AesCtrAlgorithm to JWK * Refactor AesGcm to use JWK * Bump @noble ciphers, curves, and hashes dependencies --------- Signed-off-by: Frank Hinek <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR primarily focuses on swapping the key format used in the
@web5/crypto
package from the Web Crypto APICryptoKey
to JOSE JSON Web Key (JWK).Context
The majority of cryptography usage across the
@web5
packages deals with JOSE objects and operations. As a consequence, the use ofCryptoKey
introduces significant overhead and degraded developer experience due to the frequent need to convert to/from JWK. Using JWK as the key format for all public APIs in the@web5/crypto
package will improve these and other related issues.Note
All other packages in
web5-js
continue to depend on the prior version of thecrypto
package (v0.2.2
). While this PR was unavoidably large, breaking up the refactor of downstream packages will occur in a future PR.Changes
@web5/crypto
CryptoKey
and byte array key formats in public APIs with JSON Web Key (JWK).bytesToPrivateKey()
,bytesToPublicKey()
,privateKeyToBytes()
, andprivateKeyToBytes()
to align with the API used inweb5-kt
.generateKey()
methods now return a private key in JWK format rather than a key pair to align with the API used inweb5-kt
.@web5/crypto
package.crypto-primitive
implementations.web5-kt
,web5-js
, andweb5-rs
SDKs.@noble/ciphers
from0.1.4
to0.4.0
@noble/curves
from1.1.0
to1.2.0
@noble/hashes
from1.3.1
to1.3.2
@web5/identity-agent
package.json
that were causing build failures.