digitalbazaar / ed25519-verification-key-2020

Javascript library for generating and working with Ed25519VerificationKey2020 key pairs, for use with crypto-ld.
BSD 3-Clause "New" or "Revised" License
3 stars 10 forks source link

Consider throwing when private key material is absent during a call to the `signer` API #23

Open mattcollier opened 3 months ago

mattcollier commented 3 months ago

https://github.com/digitalbazaar/ed25519-verification-key-2020/blob/main/lib/Ed25519VerificationKey2020.js#L405

The signer API returns a function that only later throws if there is no private key material present. Would it be better for the signer API to throw when there is no private key material instead of returning a non-operational sign function?

dlongley commented 3 months ago

Yes, I think throwing earlier would be better.

mattcollier commented 3 months ago

Great, I believe this existing signer pattern has been used in several different key types and will need to be updated in those places as well.