google / webcrypto.dart

Cross-platform implementation of Web Cryptography APIs
https://pub.dev/packages/webcrypto
Apache License 2.0
81 stars 48 forks source link

Support for deriveKey Method in Key Derivation Algorithms #173

Open ruidazeng opened 5 days ago

ruidazeng commented 5 days ago

Enable support for the deriveKey method for key derivation algorithms, including ECDH, HKDF, and PBKDF2, over derivedBits. This approach allows for direct derivation of cryptographic keys from a base key and specified algorithm parameters, returning a CryptoKey object ready for immediate use. This implementation would more closely align with the Web Cryptography API specification.

jonasfj commented 8 hours ago

There some notes on the design decisions here: doc/webcrypto-parity.md.

It something we could reconsider before declaring the API stable with a 1.0.0 release.

Personally, I'm not sure we need it, we could perhaps get away with documenting how to implement deriveKey using deriveBytes and importRaw. Perhaps we can even have tests to ensure that such an implementation is compatible with the behavior the browser has.