__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Tuf;
use Tuf\Metadata\ConstraintsTrait;
/**
* Class that represents a TUF role.
*/
class Role
{
use ConstraintsTrait;
/**
* Role constructor.
*
* @param string $name
* The name of the role.
* @param int $threshold
* The role threshold.
* @param array $keyIds
* The key IDs.
*/
protected function __construct(protected string $name, protected int $threshold, protected array $keyIds)
{
}
/**
* Creates a role object from TUF metadata.
*
* @param array $roleInfo
* The role information from TUF metadata.
* @param string $name
* The name of the role.
*
* @return static
*
* @see https://theupdateframework.github.io/specification/v1.0.32#document-formats
*/
public static function createFromMetadata(array $roleInfo, string $name): Role
{
self::validate($roleInfo, static::getRoleConstraints());
return new static(
$name,
$roleInfo['threshold'],
$roleInfo['keyids']
);
}
/**
* Checks if this role's key IDs match another role's.
*
* @param \Tuf\Role $other
*
* @return bool
*/
public function keysMatch(Role $other): bool
{
return $this->keyIds === $other->keyIds;
}
/**
* Gets the role name.
*
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* Gets the threshold required.
*
* @return int
* The threshold number of signatures required for the role.
*/
public function getThreshold(): int
{
return $this->threshold;
}
/**
* Checks whether the given key is authorized for the role.
*
* @param string $keyId
* The key ID to check.
*
* @return boolean
* TRUE if the key is authorized for the given role, or FALSE
* otherwise.
*/
public function isKeyIdAcceptable(string $keyId): bool
{
return in_array($keyId, $this->keyIds, true);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Client | Folder | 0775 |
|
|
| Exception | Folder | 0775 |
|
|
| Helper | Folder | 0775 |
|
|
| Loader | Folder | 0775 |
|
|
| Metadata | Folder | 0775 |
|
|
| CanonicalJsonTrait.php | File | 2.01 KB | 0664 |
|
| DelegatedRole.php | File | 3.8 KB | 0664 |
|
| Key.php | File | 3.01 KB | 0664 |
|
| Role.php | File | 2.08 KB | 0664 |
|