Skip to content

Document and test maximum deriveBits length for ECDH curves#249

Open
harrshita123 wants to merge 3 commits intogoogle:masterfrom
harrshita123:issue-130-ecdh-derivebits-docs
Open

Document and test maximum deriveBits length for ECDH curves#249
harrshita123 wants to merge 3 commits intogoogle:masterfrom
harrshita123:issue-130-ecdh-derivebits-docs

Conversation

@harrshita123
Copy link
Copy Markdown
Contributor

This PR adds documentation clarifying the maximum number of bits that can be derived using EcdhPrivateKey.deriveBits for each supported elliptic curve.

It also includes tests to ensure that deriving the maximum allowed length succeeds and that requests exceeding the limit are correctly rejected.

Fixes #130

Comment thread lib/src/webcrypto/webcrypto.ecdh.dart Outdated
Co-authored-by: HamdaanAliQuatil <96776914+HamdaanAliQuatil@users.noreply.github.com>

expect(
aliceKeyPair.privateKey.deriveBits(257, bobKeyPair.publicKey),
throwsA(anyOf(isA<subtle.JSDomException>(), isA<Error>())),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this implies a different kind of issue.

I think we are supposed to catch JSDomException and make it into an Exception or an Error.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear that is probably an orthogonal issue to this PR and should be fixed separately.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it’s kind of a separate thing, I will leave it out of this PR for now so this doesn’t get messy. I can open a new issue for the JSDomException part if needed.

@jonasfj
Copy link
Copy Markdown
Member

jonasfj commented Apr 24, 2026

Please rebase, I think CI mostly works on master branch now.

@harrshita123
Copy link
Copy Markdown
Contributor Author

Please rebase, I think CI mostly works on master branch now.

I have rebased the branch onto the latest master so the CI tests can run properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the maximum length in EcdhPrivateKey.deriveBits for each curve

3 participants