To update only the secret, we just construct the TOTPCredential as following:
TOTPCredential credential = new TOTPCredential("new_secret");
identityManager.updateCredential(user, credential);
In the case above, only the secret will be updated. The password will remain the same. To update both:
TOTPCredential credential = new TOTPCredential("password", "new_secret");
To update only the secret, we just construct the TOTPCredential as following:
TOTPCredential credential = new TOTPCredential("new_secret");
identityManager.updateCredential(user, credential);
In the case above, only the secret will be updated. The password will remain the same. To update both:
TOTPCredential credential = new TOTPCredential("password", "new_secret");
identityManager.updateCredential(user, credential);