1
0
mirror of https://github.com/QRouland/UTPass.git synced 2026-01-10 03:26:57 +00:00

Some improvements

This commit is contained in:
2025-03-12 15:34:33 +01:00
parent 884488b9ed
commit bdb2d58ac4
14 changed files with 117 additions and 37 deletions

30
plugins/Pass/error.h Normal file
View File

@@ -0,0 +1,30 @@
// error.h
#ifndef ERROR_H
#define ERROR_H
extern "C" {
#include "rnp/rnp_err.h"
}
enum ErrorCodeShow {
UnexceptedError= 1,
BadPassphrase,
NoKeyFound,
DecryptFailed
};
ErrorCodeShow rnpErrorToErrorCodeShow(int rnpErrorCode) {
switch (rnpErrorCode) {
case RNP_ERROR_BAD_PASSWORD:
return BadPassphrase;
case RNP_ERROR_KEY_NOT_FOUND:
case RNP_ERROR_NO_SUITABLE_KEY:
return NoKeyFound;
case RNP_ERROR_DECRYPT_FAILED:
return DecryptFailed;
default:
return UnexceptedError;
}
}
#endif // ERROR_H