Struct tough::RepositoryLoader [−][src]
A builder for settings with which to load a Repository
. Required settings are provided in
the RepositoryLoader::new
function. Optional parameters can be added after calling new.
Finally, call RepositoryLoader::load
to load the Repository
.
Examples
Basic usage:
let repository = RepositoryLoader::new( File::open(root).unwrap(), metadata_base_url, targets_base_url, ) .load() .unwrap();
With optional settings:
let repository = RepositoryLoader::new( File::open(root).unwrap(), metadata_base_url, targets_base_url, ) .transport(FilesystemTransport) .expiration_enforcement(ExpirationEnforcement::Unsafe) .load() .unwrap();
Implementations
impl<R: Read> RepositoryLoader<R>
[src]
pub fn new(root: R, metadata_base_url: Url, targets_base_url: Url) -> Self
[src]
Create a new RepositoryLoader
.
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.)
metadata_base_url
and targets_base_url
are the base URLs where the client can find
metadata (such as root.json) and targets (as listed in targets.json).
pub fn load(self) -> Result<Repository>
[src]
Load and verify TUF repository metadata.
pub fn transport<T: Transport + 'static>(self, transport: T) -> Self
[src]
Set the transport. If no transport has been set, DefaultTransport
will be used.
pub fn limits(self, limits: Limits) -> Self
[src]
Set a the repository Limits
.
pub fn datastore<P: Into<PathBuf>>(self, datastore: P) -> Self
[src]
Set a datastore
directory path. datastore
is a directory on a persistent filesystem.
This directory’s contents store the most recently fetched timestamp, snapshot, and targets
metadata files to detect version rollback attacks.
You may chose to provide a PathBuf
to a directory on a persistent filesystem, which must
exist prior to calling RepositoryLoader::load
. If no datastore is provided, a temporary
directory will be created and cleaned up for for you.
pub fn expiration_enforcement(self, exp: ExpirationEnforcement) -> Self
[src]
Set the ExpirationEnforcement
.
CAUTION: TUF metadata expiration dates, particularly timestamp.json
, are designed to
limit a replay attack window. By setting expiration_enforcement
to Unsafe
, you are
disabling this feature of TUF. Use Safe
unless you have a good reason to use Unsafe
.
Trait Implementations
impl<R: Clone> Clone for RepositoryLoader<R> where
R: Read,
[src]
R: Read,
fn clone(&self) -> RepositoryLoader<R>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<R: Debug> Debug for RepositoryLoader<R> where
R: Read,
[src]
R: Read,
Auto Trait Implementations
impl<R> !RefUnwindSafe for RepositoryLoader<R>
impl<R> !Send for RepositoryLoader<R>
impl<R> !Sync for RepositoryLoader<R>
impl<R> Unpin for RepositoryLoader<R> where
R: Unpin,
R: Unpin,
impl<R> !UnwindSafe for RepositoryLoader<R>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,