IDeletableKeyManager.DeleteKeys(Func<IKey,Boolean>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Deletes keys matching a predicate.
Use with caution as deleting active keys will normally cause data loss.
public bool DeleteKeys (Func<Microsoft.AspNetCore.DataProtection.KeyManagement.IKey,bool> shouldDelete);
abstract member DeleteKeys : Func<Microsoft.AspNetCore.DataProtection.KeyManagement.IKey, bool> -> bool
Public Function DeleteKeys (shouldDelete As Func(Of IKey, Boolean)) As Boolean
Parameters
A predicate applied to each key. Returning true will cause the key to be deleted.
Returns
True if all attempted deletions succeeded.
Exceptions
If CanDeleteKeys is false.
Remarks
Deletion is stronger than revocation. A revoked key is retained and can even be (forcefully) applied. A deleted key is indistinguishable from a key that never existed.
Generally, keys should only be deleted to save space. If space is not a concern, keys should be revoked or allowed to expire instead.
This method will not mutate existing IKey instances. After calling this method, all existing IKey instances should be discarded, and GetAllKeys should be called again.