Currently running tpm2-totp generate with a secret already stored results in
Calling Esys_GetRandom for 20 bytes
Calling Esys_CreatePrimary
WARNING:esys:src/tss2-esys/api/Esys_NV_DefineSpace.c:333:Esys_NV_DefineSpace_Finish() Received TPM Error
ERROR:esys:src/tss2-esys/api/Esys_NV_DefineSpace.c:122:Esys_NV_DefineSpace() Esys Finish ErrorCode (0x0000014c)
ERROR in tpm2totp_storeKey_nv (src/libtpm2-totp.c:590): 0x0000014c
ERROR in main (src/tpm2-totp.c:337): 0x0000014c
We should at least use tss2-rc to also return a human-readable error message like "NV Index or persistent object already defined".
Additionally custom error message for common error cases, e.g. "Secret already stored, use tpm2-totp calculate to show the TOTP or tpm2-totp clean to delete the stored secret", would be nice as well.
Currently running
tpm2-totp generate
with a secret already stored results inWe should at least use
tss2-rc
to also return a human-readable error message like "NV Index or persistent object already defined".Additionally custom error message for common error cases, e.g. "Secret already stored, use tpm2-totp calculate to show the TOTP or tpm2-totp clean to delete the stored secret", would be nice as well.