mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-22 15:40:15 +00:00
🔒 Add Nostr authentication support with custom guard and user provider
🛠️ Integrate Nostr auth across relevant components and views 📦 Update config, routes, and service provider for Nostr auth
This commit is contained in:
64
app/Auth/NostrUser.php
Normal file
64
app/Auth/NostrUser.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Auth;
|
||||
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
|
||||
class NostrUser implements Authenticatable
|
||||
{
|
||||
protected string $pubkey;
|
||||
protected ?object $pleb;
|
||||
|
||||
public function __construct(string $pubkey)
|
||||
{
|
||||
$this->pubkey = $pubkey;
|
||||
$this->pleb = \App\Models\EinundzwanzigPleb::query()
|
||||
->where('pubkey', $pubkey)
|
||||
->first();
|
||||
}
|
||||
|
||||
public function getAuthIdentifierName(): string
|
||||
{
|
||||
return 'pubkey';
|
||||
}
|
||||
|
||||
public function getAuthIdentifier(): string
|
||||
{
|
||||
return $this->pubkey;
|
||||
}
|
||||
|
||||
public function getAuthPassword(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getRememberToken(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setRememberToken($value): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function getRememberTokenName(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAuthPasswordName(): string
|
||||
{
|
||||
return 'password';
|
||||
}
|
||||
|
||||
public function getPubkey(): string
|
||||
{
|
||||
return $this->pubkey;
|
||||
}
|
||||
|
||||
public function getPleb(): ?object
|
||||
{
|
||||
return $this->pleb;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user