mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-13 05:26:47 +00:00
✨ feat(profile): integrate email and fax fields in association profile 🆕 feat(migrations): create blind_indexes table for encrypted data 🔧 feat(model): implement CipherSweet in EinundzwanzigPleb for email encryption 🔧 config: add ciphersweet configuration file for encryption settings 🗄️ migration: add email field to einundzwanzig_plebs table for user data
43 lines
1011 B
PHP
43 lines
1011 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\AssociationStatus;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use ParagonIE\CipherSweet\BlindIndex;
|
|
use ParagonIE\CipherSweet\EncryptedRow;
|
|
use Spatie\LaravelCipherSweet\Concerns\UsesCipherSweet;
|
|
use Spatie\LaravelCipherSweet\Contracts\CipherSweetEncrypted;
|
|
|
|
class EinundzwanzigPleb extends Model implements CipherSweetEncrypted
|
|
{
|
|
use UsesCipherSweet;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'association_status' => AssociationStatus::class,
|
|
];
|
|
}
|
|
|
|
public static function configureCipherSweet(EncryptedRow $encryptedRow): void
|
|
{
|
|
$encryptedRow
|
|
->addOptionalTextField('email')
|
|
->addBlindIndex('email', new BlindIndex('email_index'));
|
|
}
|
|
|
|
public function profile()
|
|
{
|
|
return $this->hasOne(Profile::class, 'pubkey', 'pubkey');
|
|
}
|
|
|
|
public function paymentEvents()
|
|
{
|
|
return $this->hasMany(PaymentEvent::class);
|
|
}
|
|
|
|
}
|