remove list-all-targets capability
diff --git a/src/tuf.rs b/src/tuf.rs
index 9aef6ee..36793e9 100644
--- a/src/tuf.rs
+++ b/src/tuf.rs
@@ -81,89 +81,6 @@
&self.delegations
}
- /// Return the list of all available targets.
- pub fn available_targets(&self) -> Result<HashSet<TargetPath>> {
- let _ = self.safe_root_ref()?; // ensure root still valid
- let _ = self.safe_snapshot_ref()?;
- let targets = self.safe_targets_ref()?;
- let out = targets
- .targets()
- .keys()
- .cloned()
- .collect::<HashSet<TargetPath>>();
-
- // TODO ensure meta not expired
- fn lookup<D: DataInterchange>(
- tuf: &Tuf<D>,
- role: &MetadataPath,
- parents: Vec<HashSet<TargetPath>>,
- visited: &mut HashSet<MetadataPath>,
- ) -> Option<HashSet<TargetPath>> {
- if visited.contains(role) {
- return None;
- }
- let _ = visited.insert(role.clone());
-
- let targets = match tuf.delegations.get(role) {
- Some(t) => t,
- None => return None,
- };
-
- if targets.expires() <= &Utc::now() {
- return None;
- }
-
- let mut result = HashSet::new();
- for target in targets.targets().keys() {
- if target.matches_chain(&parents) {
- let _ = result.insert(target.clone());
- }
- }
-
- match targets.delegations() {
- Some(d) => {
- for delegation in d.roles() {
- let mut new_parents = parents.clone();
- new_parents.push(delegation.paths().clone());
- if let Some(res) = lookup(tuf, delegation.role(), new_parents, visited) {
-
- for p in res.iter() {
- let _ = result.insert(p.clone());
- }
- }
- }
- }
- None => (),
- }
-
- Some(result)
- }
-
- let delegated_targets = match targets.delegations() {
- Some(delegations) => {
- let mut result = HashSet::new();
- let mut visited = HashSet::new();
- for delegation in delegations.roles() {
- if let Some(res) = lookup(
- self,
- delegation.role(),
- vec![delegation.paths().clone()],
- &mut visited,
- )
- {
- for p in res.iter() {
- let _ = result.insert(p.clone());
- }
- }
- }
- result
- }
- None => HashSet::new(),
- };
-
- Ok(out.union(&delegated_targets).map(|t| t.clone()).collect())
- }
-
/// Verify and update the root metadata.
pub fn update_root(&mut self, signed_root: SignedMetadata<D, RootMetadata>) -> Result<bool> {
signed_root.verify(
diff --git a/tests/integration.rs b/tests/integration.rs
index 1c57fa7..73ff61c 100644
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -159,11 +159,6 @@
tuf.update_delegation(&MetadataPath::new("delegation".into()).unwrap(), signed)
.unwrap();
- assert_eq!(
- tuf.available_targets().unwrap().iter().next(),
- Some(&TargetPath::new("foo".into()).unwrap())
- );
-
assert!(
tuf.target_description(&TargetPath::new("foo".into()).unwrap())
.is_ok()
@@ -351,11 +346,6 @@
tuf.update_delegation(&MetadataPath::new("delegation-b".into()).unwrap(), signed)
.unwrap();
- assert_eq!(
- tuf.available_targets().unwrap().iter().next(),
- Some(&TargetPath::new("foo".into()).unwrap())
- );
-
assert!(
tuf.target_description(&TargetPath::new("foo".into()).unwrap())
.is_ok()