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
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
XsiSchemaLocation
Provides XML Editors with location hints for XSD files.
public string XsiSchemaLocation
Field Value
Properties
Keys
A list of known Keys.
[UnorderedEquality]
public List<Key> Keys { get; }
Property Value
Methods
Clone()
Creates a deep copy of this TrustDB instance.
public TrustDB Clone()
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
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
stringThe fingerprint of the key to check.
domain
DomainThe domain the key should be valid for.
Returns
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
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
stringThe file to load from.
Returns
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
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
Save(string?)
Saves this TrustDB to a file.
public void Save(string? path = null)
Parameters
path
stringThe 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
stringThe fingerprint of the key to trust.
domain
DomainThe domain the key should be trusted for.
Returns
UntrustKey(string)
Stops trusting feeds signed with a specific key.
public bool UntrustKey(string fingerprint)
Parameters
fingerprint
stringThe 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
stringThe fingerprint of the key to remove.
domain
DomainThe 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
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
Returns
- bool
true if the objects are not equal; otherwise, false.