Skip to content

[Task] Implement key deletion in the Account #757

Open
@PhilippGackstatter

Description

@PhilippGackstatter

Description

The Storage::key_del function can be used to delete the key belonging to a verification method, but it is currently not used from the Account. The task is to decide when to delete the key material of a verification method, and implement it.

Motivation

The key material of deleted verification methods does not need to be retained, and so it should be deleted to keep the storage clean.

When to delete keys?

In theory, keys can be deleted as soon as the verification method has been deleted. One caveat comes for methods that are used to sign updates. Rotating DID document signing keys means deleting an old method from the document, but the old method is still required to sign the update that removes itself. Thus, deleting keys immediately when processing Update::DeleteMethod is not possible in general.

In theory, publishing waits for milestone confirmation, so it is safe to delete keys afterwards.

One approach (I believe suggested by @cycraig) was to compare (diff?) the old and new document during publishing, and if publishing is successful, attempt to delete all keys that were removed. "Attempt", because in a distributed setup, not all verification methods may actually have local key material. Considering distributed setups, keys also need to be removed during Account::fetch_document, because methods may have been removed from a different machine. A nice feature of this approach is that it should not require additional state to be kept.

This approach may or may not have to be discussed some more.

To-do list

Create a task-specific to-do list. Please link PRs that match the To-do list item behind the item after it has been submitted.

  • Implement key deletion in the account.

Change checklist

Add an x to the boxes that are relevant to your changes, and delete any items that are not.

  • The feature or fix is implemented in Rust and across all bindings whereas possible.
  • The feature or fix has sufficient testing coverage
  • All tests and examples build and run locally as expected
  • Every piece of code has been document according to the documentation guidelines.
  • If conceptual documentation (mdbook) and examples highlighting the feature exist, they are properly updated.
  • If the feature is not currently documented, a documentation task Issue has been opened to address this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or improvement to an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions