tekartik / sembast.dart

Simple io database
BSD 2-Clause "Simplified" License
780 stars 64 forks source link

Add a cleanup method for encryption codec #340

Closed timshadel closed 1 year ago

timshadel commented 1 year ago

An important security measure for production-grade encryption requires zeroing out the memory of sensitive information like encryption keys. When Database.close() is called, it should call dispose() or close() on the encryption codec to allow for this safe cleanup.

alextekartik commented 1 year ago

Since it is up to the developer to setup the codec, it is hard to decide when to clean it up so we could let the developer cleaning up the codec when calling close (most application never closes the database, what if the codec is used on 2 databases...).

If a new codec api is added - let say to support asynchronous encryption ;) - we could consider adding a onClose so that the codec can cleanup whatever it needs. But even though, I'd rather let the developer controlling that.