Skip to content

docs: add tutorial to perform deriveKey using deriveBits and importRaw#205

Merged
jonasfj merged 1 commit intomasterfrom
derive-key-doc
Dec 18, 2025
Merged

docs: add tutorial to perform deriveKey using deriveBits and importRaw#205
jonasfj merged 1 commit intomasterfrom
derive-key-doc

Conversation

@HamdaanAliQuatil
Copy link
Collaborator

Closes #188

@HamdaanAliQuatil HamdaanAliQuatil requested a review from jonasfj June 30, 2025 12:41
Copy link
Member

@jonasfj jonasfj left a comment

Choose a reason for hiding this comment

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

Solid, I think we now know for sure that we don't need deriveKey, and this document serves to explain that very well.

@jonasfj
Copy link
Member

jonasfj commented Dec 18, 2025

We don't have to do it in this PR, but may I suggest that we make a test/derive_key_test.dart like:

// test/derive_key_test.dart

@TestOn('browser') // We only run these tests in the browser!
library;

void main() {
  final aliceEcdhJwk = {...
  final bobEcdhJwk = {...
  final ecdhSharedKey = '...';

  test('EchdPrivateKey.deriveBits yeild the same shared key', () {
    // Do the ECDH stuff in Dart with package:webcrypto
  });

  test('window.subtle.crypto.deriveKey yeild same shared key', () {
    // Do the ECDH stuff in Dart using package:web
    // see: https://pub.dev/documentation/web/latest/web/SubtleCrypto/deriveKey.html
  });

  ...
}

This won't compare tests between browser and BoringSSL implementation, but it'll prove that deriveBits is just as fine as deriveKey and that we have parity. And we can run the tests, so we can maintain them.

@jonasfj jonasfj merged commit f7be926 into master Dec 18, 2025
14 checks passed
@jonasfj jonasfj deleted the derive-key-doc branch December 18, 2025 10:35
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.

Tutorial for doing deriveKey using deriveBits + importRaw

2 participants