Make name required in ApiKey entity

This commit is contained in:
Alejandro Celaya 2024-11-05 23:31:10 +01:00
parent 1b9c8377ae
commit f6d70c599e
2 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ final readonly class ApiKeyMeta
// If a name was not provided, fall back to the key
if (empty($name)) {
// If the key was auto-generated, fall back to a "censored" version of the UUID, otherwise simply use the
// If the key was auto-generated, fall back to a redacted version of the UUID, otherwise simply use the
// plain key as fallback name
$name = $key === null
? sprintf('%s-****-****-****-************', substr($resolvedKey, offset: 0, length: 8))

View File

@ -24,7 +24,7 @@ class ApiKey extends AbstractEntity
*/
private function __construct(
public readonly string $key,
public readonly string|null $name = null,
public readonly string $name,
public readonly Chronos|null $expirationDate = null,
private bool $enabled = true,
private Collection $roles = new ArrayCollection(),