-
Notifications
You must be signed in to change notification settings - Fork 52
feat: use noble-secp256k1 and noble-ed25519 #202
Conversation
https://github.com/paulmillr/noble-secp256k1#noble-secp256k1-- → 71.2KB (▼-44.8KB / 116KB)
this is rad! 🎉 it also seems faster |
Looks great, just need to fix up CI. |
can i just change the tests to the new error messages ? |
Sounds good, in the absence of something that will make these tests less fragile - error codes, etc. |
Had a brief look at the code of the library, and it looks quite solid, including an audit from cure53. So I am 👍 on this for what it's worth. |
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.
just needs a lint tweak
humm what do we do with the ursa stuff ? |
#203 should unblock the build |
Ha, maybe not. Well, these are actual test failures rather than build ones so that's some progress, I guess. |
i will check it asap |
@achingbrain @vasco-santos should be good to go |
await secp256k1Crypto.hashAndVerify(privKey, sig, null) | ||
} catch (err) { | ||
return // expected | ||
} | ||
throw new Error('Expected error to be thrown') | ||
}) | ||
|
||
it('errors when validating a message with an invalid signature', async () => { |
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.
why removing 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.
i just moved the test up a bit check 'does not validate when validating a message with an invalid signature', because it doesnt throw now just returns false for an invalid sig
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.
Oh I see, so this now returns a boolean false
instead of throwing an error. Can we flag that breaking change in the commit message?
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.
can you do it when you squash and merge ?
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.
sure, I can do
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
The `babel-plugin-transform-exponentiation-operator ` Babel plugin transforms `1n ** 1n` into `Math.pow(1n, 1n)` which doesn't work because `Math.pow` doesn't support BigInts - facebook/create-react-app#6907 (comment) This is used in `@noble/ed25519` which recently got added to `libp2p-crypto` - libp2p/js-libp2p-crypto#202 The fix is to change the `"browsersList"` setting to exclude ie and old android - hirosystems/stacks.js#1096 (comment)
The `babel-plugin-transform-exponentiation-operator ` Babel plugin transforms `1n ** 1n` into `Math.pow(1n, 1n)` which doesn't work because `Math.pow` doesn't support BigInts - facebook/create-react-app#6907 (comment) This is used in `@noble/ed25519` which recently got added to `libp2p-crypto` - libp2p/js-libp2p-crypto#202 The fix is to change the `"browsersList"` setting to exclude ie and old android - hirosystems/stacks.js#1096 (comment)
https://github.com/paulmillr/noble-secp256k1#noble-secp256k1--
https://github.com/paulmillr/noble-ed25519
116KB -> 70.32KB