Skip to content
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

Document deriveBits in the EcdhPrivateKey Class #128

Merged
merged 2 commits into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/src/webcrypto/webcrypto.ecdh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ abstract class EcdhPrivateKey {
return impl.ecdhPrivateKey_generateKey(curve);
}

/// Derive a shared secret from two ECDH key pairs using the private key from one pair
/// and the public key from another.
///
/// The shared secret is identical whether using A's private key and B's public key,
/// or B's private key and A's public key, enabling secure key exchange between the
/// two parties.
///
/// [length] specifies the length of the derived secret in bits.
jonasfj marked this conversation as resolved.
Show resolved Hide resolved
/// [publicKey] is [EcdhPublicKey] from the other party's ECDH key pair.
///
/// Returns a [Uint8List] containing the derived shared secret.
///
/// {@macro EcdhPrivateKey:example}
// Note some webcrypto implementations (chrome, not firefox) supports passing
// null for length (in this primitive). However, you can always know the right
// length from the curve. Note p512 can provide up to: 528 bits!!!
Expand Down
Loading