mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-05-01 12:09:45 +00:00
added qasecret support
This commit is contained in:
parent
10d0361ae1
commit
08c27ec560
@ -63,7 +63,8 @@ file(GLOB SOURCE_CPP
|
|||||||
"*.cpp" "*.h"
|
"*.cpp" "*.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} ${SOURCE_CPP})
|
add_library(${PROJECT_NAME} ${SOURCE_CPP}
|
||||||
|
qasecretservice.h qasecretservice.cpp)
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core)
|
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Core)
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
27
qasecretservice.cpp
Normal file
27
qasecretservice.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "qasecretservice.h"
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
QByteArray QuasarAppUtils::QASecretService::getByAlias(const QString &alias) {
|
||||||
|
QProcess proc;
|
||||||
|
proc.setProgram("qasecretservice");
|
||||||
|
proc.setArguments(QStringList() << "get" << "-alias" << alias);
|
||||||
|
|
||||||
|
proc.start();
|
||||||
|
|
||||||
|
proc.waitForFinished(2000);
|
||||||
|
|
||||||
|
return proc.readAllStandardOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray QuasarAppUtils::QASecretService::getByHash(const QByteArray &hash)
|
||||||
|
{
|
||||||
|
QProcess proc;
|
||||||
|
proc.setProgram("qasecretservice");
|
||||||
|
proc.setArguments(QStringList() << "get" << "-hash" << hash);
|
||||||
|
|
||||||
|
proc.start();
|
||||||
|
|
||||||
|
proc.waitForFinished(2000);
|
||||||
|
|
||||||
|
return proc.readAllStandardOutput();
|
||||||
|
}
|
33
qasecretservice.h
Normal file
33
qasecretservice.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024-2024 QuasarApp.
|
||||||
|
* Distributed under the lgplv3 software license, see the accompanying
|
||||||
|
* Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
* of this license document, but changing it is not allowed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef QASECRETSERVICE_H
|
||||||
|
#define QASECRETSERVICE_H
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
|
||||||
|
namespace QuasarAppUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The qasecretservice class This is a simeple provider of QASecretService tool
|
||||||
|
* See https://github.com/QuasarApp/SecretService
|
||||||
|
* @note Before use this class please install QASecretService to your runtime mashine.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class QASecretService
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QASecretService();
|
||||||
|
|
||||||
|
static QByteArray getByAlias(const QString& alias);
|
||||||
|
static QByteArray getByHash(const QByteArray& hash);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif // QASECRETSERVICE_H
|
Loading…
x
Reference in New Issue
Block a user