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>
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('shares', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
|
$table->string('token', 64)->unique();
|
|
$table->string('recipient_email')->nullable();
|
|
$table->text('password')->nullable();
|
|
$table->dateTime('expires_at');
|
|
$table->dateTime('revoked_at')->nullable();
|
|
$table->unsignedInteger('access_count')->default(0);
|
|
$table->dateTime('last_accessed_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['user_id', 'expires_at']);
|
|
});
|
|
|
|
Schema::create('certificate_share', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('certificate_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('share_id')->constrained()->cascadeOnDelete();
|
|
|
|
$table->unique(['certificate_id', 'share_id']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('certificate_share');
|
|
Schema::dropIfExists('shares');
|
|
}
|
|
};
|