[−][src]Struct tough::Repository
A TUF repository.
You can create a Repository
using the load
method.
Methods
impl<'a, T: Transport> Repository<'a, T>
[src]
pub fn load<R: Read>(
transport: &'a T,
settings: Settings<'a, R>
) -> Result<Self>
[src]
transport: &'a T,
settings: Settings<'a, R>
) -> Result<Self>
Load and verify TUF repository metadata.
root
is a Read
er for the trusted root metadata file, which you must ship with your
software using an out-of-band process. It should be a copy of the most recent root.json
from your repository. (It's okay if it becomes out of date later; the client establishes
trust up to the most recent root.json file.)
datastore
is a Path
to a directory on a persistent filesystem. This directory's
contents store the most recently fetched timestamp, snapshot, and targets metadata files.
The directory must exist prior to calling this method.
max_root_size
and max_timestamp_size
are the maximum size for the root.json and
timestamp.json files, respectively, downloaded from the repository. These must be
sufficiently large such that future updates to your repository's key management strategy
will still be supported, but sufficiently small such that you are protected against an
endless data attack (defined by TUF as an attacker responding to clients with extremely
large files that interfere with the client's system).
metadata_base_url
and target_base_url
are the HTTP(S) base URLs for where the client
can find metadata (such as root.json) and targets (as listed in targets.json).
pub fn targets(&self) -> &HashMap<String, Target>
[src]
Returns the list of targets present in the repository.
pub fn read_target(&self, name: &str) -> Result<Option<impl Read>>
[src]
Fetches a target from the repository.
If the repository metadata is expired or there is an issue making the request, Err
is
returned.
If the requested target is not listed in the repository metadata, Ok(None)
is returned.
Otherwise, a reader is returned, which provides streaming access to the target contents
before its checksum is validated. If the maximum size is reached or there is a checksum
mismatch, the reader returns a std::io::Error
. Consumers of this library must not use
data from the reader if it returns an error.
Trait Implementations
impl<'a, T: Clone + Transport> Clone for Repository<'a, T>
[src]
fn clone(&self) -> Repository<'a, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T: Debug + Transport> Debug for Repository<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> Send for Repository<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Sync for Repository<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Repository<'a, T>
impl<'a, T> UnwindSafe for Repository<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> RefUnwindSafe for Repository<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self