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

JsonWebKey Interface only for a public key? Missing private key parameter. #121

Closed
bshambaugh opened this issue Mar 11, 2022 · 2 comments
Closed
Labels
enhancement New feature or request stale

Comments

@bshambaugh
Copy link
Contributor

bshambaugh commented Mar 11, 2022

Question
Why doesn't the JsonWebKey interface define the "d" parameter for a private key?

See: JSON Web Key Parameters in :
https://www.iana.org/assignments/jose/jose.xhtml

See the interface definition in:
https://github.com/decentralized-identity/did-resolver/blob/master/src/resolver.ts#L74-L86

Context:
Current Fix
For context, I was hacking around the break up the test file https://github.com/bshambaugh/did-jwt/blob/master/src/__tests__/JWT/CommonSignerTest/CommonSignerTest.ts#L20-L22

so I could import creation of the DID document as a fuction; https://github.com/bshambaugh/did-jwt/blob/master/src/__tests__/JWT/JWT.ES256Signer.test.ts#L50-L54 and https://github.com/bshambaugh/did-jwt/blob/master/src/__tests__/JWT/JWT.ES256KSigner.test.ts#L43-L47
(other changes [unrelated to this issue] were so I could avoid use of the any type)

Originally it was: https://github.com/decentralized-identity/did-jwt/blob/master/src/__tests__/JWT.test.ts#L36-L91

@mirceanis
Copy link
Member

This parameter is intentionally omitted from the type definition to discourage unintentional publication of private key material to a DID document.
These documents are publicly resolvable so publishing a private key there never makes sense.

This does not prevent the use of key objects that contain the d property, nor any other property, since the interface is Extensible. It is only about the type seen by typescript, and IDEs.
Also, there is nothing stopping you from defining an interface that extends this with an explicit member for private key data.

@stale
Copy link

stale bot commented May 20, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

2 participants