Table of Contents

Class TrustDB

Namespace
ZeroInstall.Store.Trust
Assembly
ZeroInstall.Store.dll

A database of OpenPGP signature fingerprints the users trusts to sign Feeds coming from specific domains.

[XmlNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")]
[Equatable]
public sealed class TrustDB : ICloneable<TrustDB>, IEquatable<TrustDB>
Inheritance
TrustDB
Implements
Inherited Members
Extension Methods

Fields

XmlNamespace

The XML namespace used for storing trust-related data.

public const string XmlNamespace = "http://zero-install.sourceforge.net/2007/injector/trust"

Field Value

string

XsdLocation

The URI to retrieve an XSD containing the XML Schema information for this class in serialized form.

public const string XsdLocation = "https://docs.0install.net/specifications/trust.xsd"

Field Value

string

XsiSchemaLocation

Provides XML Editors with location hints for XSD files.

public string XsiSchemaLocation

Field Value

string

Properties

Keys

A list of known Keys.

[UnorderedEquality]
public List<Key> Keys { get; }

Property Value

List<Key>

Methods

Clone()

Creates a deep copy of this TrustDB instance.

public TrustDB Clone()

Returns

TrustDB

The new copy of the TrustDB.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

IsTrusted(string, Domain)

Checks whether a key is trusted for a specific domain.

public bool IsTrusted(string fingerprint, Domain domain)

Parameters

fingerprint string

The fingerprint of the key to check.

domain Domain

The domain the key should be valid for.

Returns

bool

Load()

Loads the TrustDB from the default locations, merging multiple files if found. Returns an empty TrustDB if no files were found.

public static TrustDB Load()

Returns

TrustDB

Exceptions

IOException

A problem occurred while reading the file.

UnauthorizedAccessException

Read access to the file is not permitted.

InvalidDataException

A problem occurred while deserializing an XML file.

Load(string)

Loads the TrustDB from a file.

public static TrustDB Load(string path)

Parameters

path string

The file to load from.

Returns

TrustDB

Exceptions

IOException

A problem occurred while reading the file.

UnauthorizedAccessException

Read access to the file is not permitted.

InvalidDataException

A problem occurred while deserializing an XML file.

LoadMachineWide()

Loads the TrustDB from the machine-wide location. Returns an empty TrustDB if the file does not exist.

public static TrustDB LoadMachineWide()

Returns

TrustDB

Exceptions

IOException

A problem occurred while reading the file or creating a directory.

UnauthorizedAccessException

Read access to the file or creating a directory is not permitted.

InvalidDataException

A problem occurred while deserializing an XML file.

LoadSafe()

Tries to load the TrustDB from the default locations, merging multiple files if found. Returns an empty TrustDB on errors.

public static TrustDB LoadSafe()

Returns

TrustDB

Save(string?)

Saves this TrustDB to a file.

public void Save(string? path = null)

Parameters

path string

The file to save to. Defaults to the location the file was loaded from or the user profile.

Exceptions

IOException

A problem occurred while writing the file.

UnauthorizedAccessException

Write access to the file is not permitted.

TrustKey(string, Domain)

Trusts feeds from a specific domain when signed with a specific key.

public TrustDB TrustKey(string fingerprint, Domain domain)

Parameters

fingerprint string

The fingerprint of the key to trust.

domain Domain

The domain the key should be trusted for.

Returns

TrustDB

The same TrustDB, for fluent-style use.

UntrustKey(string)

Stops trusting feeds signed with a specific key.

public bool UntrustKey(string fingerprint)

Parameters

fingerprint string

The fingerprint of the key to remove.

Returns

bool

true if the key was removed, false if the key was not found in the database.

UntrustKey(string, Domain)

Stops trusting feeds from a specific domain when signed with a specific key.

public bool UntrustKey(string fingerprint, Domain domain)

Parameters

fingerprint string

The fingerprint of the key to remove.

domain Domain

The domain the key should be removed for.

Returns

bool

true if the key was removed, false if the key was not found in the database.

Operators

operator ==(TrustDB?, TrustDB?)

Indicates whether the object on the left is equal to the object on the right.

public static bool operator ==(TrustDB? left, TrustDB? right)

Parameters

left TrustDB

The left object

right TrustDB

The right object

Returns

bool

true if the objects are equal; otherwise, false.

operator !=(TrustDB?, TrustDB?)

Indicates whether the object on the left is not equal to the object on the right.

public static bool operator !=(TrustDB? left, TrustDB? right)

Parameters

left TrustDB

The left object

right TrustDB

The right object

Returns

bool

true if the objects are not equal; otherwise, false.