-
Notifications
You must be signed in to change notification settings - Fork 56
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 Key Management in @web5/crypto
and add @web5/crypto-aws-kms
#360
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
TBDocs Report ✅ No errors or warnings @web5/api
TBDocs Report Updated at 2024-01-04T14:34:08Z |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #360 +/- ##
==========================================
- Coverage 92.79% 91.69% -1.10%
==========================================
Files 71 67 -4
Lines 16477 18176 +1699
Branches 1525 1534 +9
==========================================
+ Hits 15290 16667 +1377
- Misses 1165 1487 +322
Partials 22 22
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 🏅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, few minor things. I'll look over it again in detail but overall looks good!
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]>
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]>
…webcrypto 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]>
e853702
to
8158687
Compare
Signed-off-by: Frank Hinek <[email protected]>
…ms` (#360) * Initial refactor to JOSE types and structure * Add tests for public JSON canonicalize method * Initial commit of Crypto API types * Rename crypto-primitives to primitives * Remove barrel files and move CryptoApi to types * Refactor crypto API types * Use TypeDoc @example * Consistent usage of method parameters * Update naming and documentation structure * Bump @types/eslint to resolve duplicate error issue in @web5/crypto * Add convertDerToCompactSignature method to Secp256k1 * Rename hash type and modify CryptoApi * Bump deprecated sinon version * Remove types from dependency that is no longer used * Bump @noble dependencies * Implement SHA-256 primitive * Minor comment improvement * Local KMS initial implementation * AWS KMS initial implementation * Bump default tsconfig from ES6 to ES2022 * Improve documentation and remove old implementation * Bump @web5/crypto version * Remove @web5/crypto-aws-kms from browser tests * Remove unnecessary polyfill * Fix missing crypto global * Improve LevelStore and add tests for use with LocalKmsCrypto * Initial README updates for crypto and crypto-aws-kms packages * Remove node:crypto import from PBKDF2 now that web5-wallet polyfills webcrypto * Improve cipher alg generateKey() and add RNG docs * Mark Ed25519 and Secp256k1 key validation methods public --------- Signed-off-by: Frank Hinek <[email protected]>
…ms` (#360) * Initial refactor to JOSE types and structure * Add tests for public JSON canonicalize method * Initial commit of Crypto API types * Rename crypto-primitives to primitives * Remove barrel files and move CryptoApi to types * Refactor crypto API types * Use TypeDoc @example * Consistent usage of method parameters * Update naming and documentation structure * Bump @types/eslint to resolve duplicate error issue in @web5/crypto * Add convertDerToCompactSignature method to Secp256k1 * Rename hash type and modify CryptoApi * Bump deprecated sinon version * Remove types from dependency that is no longer used * Bump @noble dependencies * Implement SHA-256 primitive * Minor comment improvement * Local KMS initial implementation * AWS KMS initial implementation * Bump default tsconfig from ES6 to ES2022 * Improve documentation and remove old implementation * Bump @web5/crypto version * Remove @web5/crypto-aws-kms from browser tests * Remove unnecessary polyfill * Fix missing crypto global * Improve LevelStore and add tests for use with LocalKmsCrypto * Initial README updates for crypto and crypto-aws-kms packages * Remove node:crypto import from PBKDF2 now that web5-wallet polyfills webcrypto * Improve cipher alg generateKey() and add RNG docs * Mark Ed25519 and Secp256k1 key validation methods public --------- Signed-off-by: Frank Hinek <[email protected]>
…ms` (#360) * Initial refactor to JOSE types and structure * Add tests for public JSON canonicalize method * Initial commit of Crypto API types * Rename crypto-primitives to primitives * Remove barrel files and move CryptoApi to types * Refactor crypto API types * Use TypeDoc @example * Consistent usage of method parameters * Update naming and documentation structure * Bump @types/eslint to resolve duplicate error issue in @web5/crypto * Add convertDerToCompactSignature method to Secp256k1 * Rename hash type and modify CryptoApi * Bump deprecated sinon version * Remove types from dependency that is no longer used * Bump @noble dependencies * Implement SHA-256 primitive * Minor comment improvement * Local KMS initial implementation * AWS KMS initial implementation * Bump default tsconfig from ES6 to ES2022 * Improve documentation and remove old implementation * Bump @web5/crypto version * Remove @web5/crypto-aws-kms from browser tests * Remove unnecessary polyfill * Fix missing crypto global * Improve LevelStore and add tests for use with LocalKmsCrypto * Initial README updates for crypto and crypto-aws-kms packages * Remove node:crypto import from PBKDF2 now that web5-wallet polyfills webcrypto * Improve cipher alg generateKey() and add RNG docs * Mark Ed25519 and Secp256k1 key validation methods public --------- Signed-off-by: Frank Hinek <[email protected]>
Summary
This PR is largely focused on implementing the proposal in #271. Refer to that issue for more context.
Changes
@web5/crypto
algorithms-api
and child classes.CryptoApi
interface and modular types forKeyGenerator
,Signer
,Cipher
,Hasher
, etc. introduced as proposed in Refactor Key Management in@web5/crypto
#271.LocalKmsCrypto
added that provides an implementation ofCryptoApi
that uses a local key store (memory is the default but can be customized to use a persistent store).0.3.0
due to breaking changes and need to incrementally update dependent Web5 JS packages.@noble/ciphers
from0.4.0
to0.4.1
@noble/curves
from1.2.0
to1.3.2
@noble/hashes
from 1.3.2to
1.3.3`@types/ed2curve
development dependency sinceed2curve
was removed a while ago.jose
directory, which will be covered once JWT, JWS, and JWE functionality is added.@web5/crypto-aws-kms
CryptoApi
that uses AWS KMS for remote storage of keys and signing operationsAwsKeyManager
implementation:ES256K
private keys secured by AWS KMS.@web5/common
LevelStore
to support callers modifying the key / value types.LevelStore
.@web5/api
,@web5/crypto
,@web5/dids
sinon
package from15.0.2
to16.1.3
@web5/agent
,@web5/credentials
[email protected]
@web5/*
tsconfig.json
compiler optionslib
fromES6
toES2022
.