-
Notifications
You must be signed in to change notification settings - Fork 135
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
feat(key-manager): add generic signing capabilities #529
Conversation
Codecov Report
@@ Coverage Diff @@
## next #529 +/- ##
==========================================
+ Coverage 67.58% 71.75% +4.17%
==========================================
Files 62 72 +10
Lines 1530 1972 +442
Branches 247 326 +79
==========================================
+ Hits 1034 1415 +381
- Misses 400 555 +155
+ Partials 96 2 -94 |
3391fab
to
402e151
Compare
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.
In general it looks great!
It would be great to have data be of type byte array, e.g., to support CBOR in the future.
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.
more of my JOSE naming schizophrenia :)
ec5c276
to
ab80721
Compare
ab80721
to
65192a3
Compare
65192a3
to
b49b57c
Compare
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.
LGTM. It just strikes me a bit that 'Ed25519' and 'EdDSA' count as two separate algorithms although they are the same.
Yes, they are identical. I added both for compatibility. |
This PR extends the signing capabilities of the
key-manager
plugin.The
key-manager
plugin now exposes akeyManagerSign
method that accepts extraalg
,enc
parameters and supports extension of the parameter object.The
enc
parameter indicates the encoding of thedata
string, defaulting toutf-8
if absent.The
alg
option should indicate an algorithm to be used.Depending on the capabilities of the KMS (one of the
AbstractKeyManagementSystem
implementations), different signatures can be requested.For example:
Secp256k1
key should be able to support:ES256K
,ES256K-R
,eth_signTransaction
,eth_signTypedData
,eth_signMessage
web3
abstraction, would only be able to do:eth_signTransaction
,eth_signTypedData
, andeth_signMessage
The capabilities of the KMS are recorded in the
IKey.meta.algorithms
array during key creation or import.Further improvements can be made to programmatically filter for KMS or key capabilities.
This PR relates to #468
Examples:
Sign a JWS payload with ES256K:
Sign an ETH transaction: