-
Notifications
You must be signed in to change notification settings - Fork 767
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
Asn1 validator node ed25519 #680
base: main
Are you sure you want to change the base?
Conversation
Some of the docs in here make it seem like the functions are specific to node.js buffers, etc. -- when they aren't. The docs can mention that if you're using node's API that the functions will be particularly helpful, but they should lead by saying that the functions, for example, convert a DER-formatted PKCS#8 private key to a raw private key. We may also want the functions to be something like |
f5b03bb
to
ce9cf21
Compare
0cba333
to
00f1b3d
Compare
Co-Authored-By: David I. Lehn <[email protected]> Capitalize DER in unit test descriptions. Co-Authored-By: David I. Lehn <[email protected]> Uppercase DER in docs and tests.
00f1b3d
to
a5739f5
Compare
6e427ca
to
0ec3a2c
Compare
c4a15cc
to
114722c
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.
Test suite is passing here and it's working well in crypto-ld. I'm happy with it.
Thank you @aljones15
@mattcollier sorry you had to change those consts but thanks for updating this. |
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 a few simple changes we want here then I think we can merge.
@dlongley @aljones15 I'll handle Longley's comments. |
Co-Authored-By: Dave Longley <[email protected]>
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.
I approve on the condition that the other changes I mentioned are applied.
Thanks!
569bb74
to
40c7227
Compare
@davidlehn I leave it to you to approve/merge and publish this. I'm not an owner on NPM. Thanks! |
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.
Unfortunately, looking at this with @davidlehn has pointed out that this PR actually still needs work. I checked other APIs and we don't do publicKeyFromDer
etc. We should not bake in specific buffer requirements when coming from DER since we have a bunch of other APIs that handle that stuff.
We need to change the publicKeyFromDer
API to publicKeyFromAsn1
API (same for privateKey
) and let the caller supply an ASN.1 object using our other APIs.
/** | ||
* Takes in a public key exported in DER and returns the raw key value. | ||
* | ||
* @param {NativeBuffer} publicKeyBuffer - A DER formatted public key. |
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.
Any use of NativeBuffer
in the docs should change -- this isn't a public name. It should be {Uint8Array|Buffer}
. But, that being said -- we need to change this API to take in ASN.1 input anyway, not DER.
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.
This actually is a jsdoc thing NativeBuffer here refers to a jsdoc type declared earlier in the file:
/**
* NativeBuffer is either a Buffer or a Uint8Array.
* @type {Buffer|Uint8Array}
*/
@dlongley @mattcollier this can be closed correct? another PR added this feature I believe. |
I don't know what the status is, but so we can better track it I'm linking to that other PR: #697. |
#697 was merged and released causing conflicts here. If some of this patch should still be merged, please rebase and update as needed. |
if I recall correctly this PR is not needed because it turns out the ed25519 keys use a common DER format that we already have a validator for. I believe this can be closed @dlongley |
Adds: