Sharing certificates now creates a Share: a public page behind an
unguessable token where the recipient views and downloads the selected
certificates individually or as a ZIP, instead of receiving links or
attachments by email.
- Share model + certificate_share pivot; expiration (1/7/30 days),
optional password (encrypted so the owner can re-view it), revocation,
and open tracking
- Public routes under shared/{token}: password unlock gate (throttled,
session-scoped), per-certificate download, on-the-fly ZIP that is
AES-256 encrypted when the share has a password, friendly 410 page
for expired/revoked links
- Share modal on the certificates index now creates the page and
reveals a copyable link + password; optional transactional email
(ShareCreatedMail) still sends the link to a recipient
- New Shares page in the sidebar to copy links, look up passwords,
revoke, and delete shares
- Old signed-URL controller and both attachment/link mailables removed;
Dutch translations updated; Pest coverage for the full lifecycle
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Share;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<Share>
|
|
*/
|
|
class ShareFactory extends Factory
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'token' => Str::random(48),
|
|
'recipient_email' => null,
|
|
'password' => null,
|
|
'expires_at' => now()->addDays(7),
|
|
'revoked_at' => null,
|
|
];
|
|
}
|
|
|
|
public function expired(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'expires_at' => now()->subDay(),
|
|
]);
|
|
}
|
|
|
|
public function revoked(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'revoked_at' => now()->subHour(),
|
|
]);
|
|
}
|
|
|
|
public function passwordProtected(string $password = 'secret-password'): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'password' => $password,
|
|
]);
|
|
}
|
|
}
|