Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::QmlTemplates::TrustStore Class Reference

The trust store: which file contents the user trusts, and where. More...

#include <trust_p.h>

Public Member Functions

 TrustStore (QString file)
 The store in file (read on every call: other processes write it too).
QString untrustedReason (const QString &path, const QString &hash, const QString &scopeKey) const
 Why a file at path with content hash isn't trusted for scopeKey, or an empty string if it is.
bool trust (const QList< TrustedFile > &files, bool everywhere, const QString &scopeKey, const QString &how, QString *error) const
 Records files as trusted, everywhere or for scopeKey only.
std::optional< QList< Entry > > entries (QString *error) const
 Every grant (none if the file doesn't exist); nothing, with error set, if it can't be read.
int revoke (const QStringList &paths, QString *error) const
 Removes every grant recorded for a file at one of paths.
int repath (const QHash< QString, QString > &moved, QString *error) const
 Changes the path of every grant recorded for a file that moved: a key of moved, to its value.

Private Attributes

QString m_file
 The store's file.

Detailed Description

The trust store: which file contents the user trusts, and where.

Member Function Documentation

◆ repath()

int Sonde::Trust::TrustStore::repath ( const QHash< QString, QString > & moved,
QString * error ) const

Changes the path of every grant recorded for a file that moved: a key of moved, to its value.

Writes the store only if a grant changed.

Returns
How many grants changed, or -1 with error set.

◆ revoke()

int Sonde::Trust::TrustStore::revoke ( const QStringList & paths,
QString * error ) const

Removes every grant recorded for a file at one of paths.

Returns
How many were removed, or -1 with error set.

◆ trust()

bool Sonde::Trust::TrustStore::trust ( const QList< TrustedFile > & files,
bool everywhere,
const QString & scopeKey,
const QString & how,
QString * error ) const

Records files as trusted, everywhere or for scopeKey only.

Parameters
how"user", "app" or "saved".
Returns
Whether the store was written; otherwise error says why.

The documentation for this class was generated from the following files: