Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
trust.cpp File Reference

Where the QML template libraries and the trust file are, and the trust store (designs 0023 and 0030). More...

#include "instance_p.h"
#include "trust_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QCryptographicHash>
#include <QtCore/QDateTime>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtCore/QSaveFile>
#include <QtCore/QStandardPaths>
#include <algorithm>
#include <functional>

Namespaces

namespace  Sonde
 Embeddable Model Context Protocol server for Qt applications.

Functions

QString Sonde::Trust::anonymous_namespace{trust.cpp}::searchUp (const QString &start, const std::function< bool(const QDir &)> &matches)
 The first directory from start upwards for which matches holds, or empty.
std::optional< QJsonArray > Sonde::Trust::anonymous_namespace{trust.cpp}::readStore (const QString &file, QString *error)
 The entries of the trust store in file (none if it doesn't exist); nothing, with error set, if it can't be read.
bool Sonde::Trust::anonymous_namespace{trust.cpp}::writeStore (const QString &file, const QJsonArray &entries, QString *error)
 Writes entries to the store in file, creating its directory.
QString Sonde::Trust::libraryName (Library library)
 "project" or "user".
QString Sonde::Trust::configDirectory ()
 Sonde's configuration directory: $XDG_CONFIG_HOME/sonde if that is set to an absolute path (on every platform), otherwise ~/.config/sonde (Linux and macOS alike) or LOCALAPPDATA%/sonde (Windows).
QString Sonde::Trust::canonicalOrClean (const QString &path)
 path made canonical if it exists, otherwise only absolute and clean.
Locations Sonde::Trust::locate (const QList< Start > &starts)
 Finds the libraries and the trust file now (the environment may change).
QString Sonde::Trust::filePath (const QString &directory, const QString &name, bool component)
 The file of template or component name in directory.
QString Sonde::Trust::sha256 (const QByteArray &data)
 The SHA-256 of data, in hex.

Variables

constexpr QStringView Sonde::Trust::anonymous_namespace{trust.cpp}::kEverywhere = u"everywhere"
 The "where" of a grant that applies in every checkout.

Detailed Description

Where the QML template libraries and the trust file are, and the trust store (designs 0023 and 0030).

Function Documentation

◆ locate()

Locations Sonde::Trust::locate ( const QList< Start > & starts)

Finds the libraries and the trust file now (the environment may change).

SONDE_QML_LIBRARY names the project library; otherwise it is the first .sonde/qml/ above any of starts, in order, else .sonde/qml/ in the first checkout (a directory with .sonde or .git) above them. SONDE_TRUST_FILE names the trust file.