Search code examples
eclipse-hono

Deleting Credentials in Hono


Based on this swagger documentation(https://www.eclipse.org/hono/docs/api/management/#/credentials/setAllCredentials), there is currently no way to delete credentials in Hono. Credentials are deleted when the device registration is removed (cascade effect).

Now, according to a note in the PUT /credentials/{tenantId}/{deviceId} swagger documentation of Hono,

"Note that N does not contain any of the existing credentials objects c-E for which no corresponding credentials object c-U with the same device ID, type and authentication identifier exists. This way, existing credentials can be deleted."

I have a difficulty parsing this statement.

Does this mean there is a separate way to delete a credential (aside from the cascade effect of deleting the device registration) via PUT?


Solution

  • This method is intended to be used for deleting specific credentials of a device. For example, if you had created two password credentials A and B with adjacent (or overlapping) validity periods, you might want to remove credentials A once their validity period has passed. In order to do so you can use a PUT request that only contains credential B's identifier but omits the identifier of credential A.