Skip to content

Commit b295d8d

Browse files
Document deriveBits in the EcdhPrivateKey Class (#128)
* docs: document deriveBits in EcdhPrivateKey * Update lib/src/webcrypto/webcrypto.ecdh.dart Co-authored-by: Jonas Finnemann Jensen <[email protected]> --------- Co-authored-by: Jonas Finnemann Jensen <[email protected]>
1 parent e7fbe50 commit b295d8d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/src/webcrypto/webcrypto.ecdh.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,19 @@ abstract class EcdhPrivateKey {
182182
return impl.ecdhPrivateKey_generateKey(curve);
183183
}
184184

185+
/// Derive a shared secret from two ECDH key pairs using the private key from one pair
186+
/// and the public key from another.
187+
///
188+
/// The shared secret is identical whether using A's private key and B's public key,
189+
/// or B's private key and A's public key, enabling secure key exchange between the
190+
/// two parties.
191+
///
192+
/// [length] specifies the length of the derived secret in bits.
193+
/// [publicKey] is [EcdhPublicKey] from the other party's ECDH key pair.
194+
///
195+
/// Returns a [Uint8List] containing the derived shared secret.
196+
///
197+
/// {@macro EcdhPrivateKey:example}
185198
// Note some webcrypto implementations (chrome, not firefox) supports passing
186199
// null for length (in this primitive). However, you can always know the right
187200
// length from the curve. Note p512 can provide up to: 528 bits!!!

0 commit comments

Comments
 (0)