mirror of
git://f0xx.org/ac/ac-ms-url-shortener
synced 2026-07-29 02:58:30 +03:00
initial
This commit is contained in:
26
scripts/seed_bearer.php
Executable file
26
scripts/seed_bearer.php
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__) . '/src/bootstrap.php';
|
||||
|
||||
$label = 'cli-seed';
|
||||
$canPermanent = false;
|
||||
foreach (array_slice($argv, 1) as $arg) {
|
||||
if ($arg === '--permanent') {
|
||||
$canPermanent = true;
|
||||
} elseif (str_starts_with($arg, '--label=')) {
|
||||
$label = substr($arg, 8);
|
||||
}
|
||||
}
|
||||
|
||||
$created = BearerRepository::createTrusted($label, true, $canPermanent);
|
||||
echo "Bearer token (store securely — shown once):\n";
|
||||
echo $created['token'] . "\n";
|
||||
echo "bearer_id=" . $created['id'] . " label=" . $label . "\n";
|
||||
|
||||
if ($canPermanent) {
|
||||
$signer = SignerRepository::create($label . '-signer');
|
||||
echo "Signer key (for ttl=0):\n";
|
||||
echo $signer['key'] . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user