Partager via


IDeletableKeyManager.DeleteKeys(Func<IKey,Boolean>) Method

Definition

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

shouldDelete
Func<IKey,Boolean>

A predicate applied to each key. Returning true will cause the key to be deleted.

Returns

True if all attempted deletions succeeded.

Exceptions

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.

Applies to