Add NIP-05 verification compatibility
This commit is contained in:
parent
2e7d12b3e6
commit
04bd6dd35d
6 changed files with 65 additions and 0 deletions
|
@ -20,6 +20,7 @@ class ProfileInline(admin.TabularInline):
|
|||
class UserAdmin(BaseUserAdmin):
|
||||
fieldsets = BaseUserAdmin.fieldsets + (
|
||||
("Profile", {"fields": ("avatar", "xmpp", "note")}),
|
||||
("Nostr", {"fields": ("nostr_key", "nostr_relays")}),
|
||||
)
|
||||
inlines = (
|
||||
PgpKeyInline,
|
||||
|
|
22
users/migrations/0018_auto_20230810_1754.py
Normal file
22
users/migrations/0018_auto_20230810_1754.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 3.2.20 on 2023-08-10 07:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("users", "0017_rename_key_pgpkey"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="user",
|
||||
name="nostr_key",
|
||||
field=models.CharField(blank=True, max_length=32, null=True, unique=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="user",
|
||||
name="nostr_relays",
|
||||
field=models.JSONField(blank=True, default=list),
|
||||
),
|
||||
]
|
|
@ -81,6 +81,19 @@ class User(ModelMeta, AbstractUser):
|
|||
help_text="SHA-256 hash of the user's OpenID URL, used for Libravatar",
|
||||
)
|
||||
|
||||
nostr_key = models.CharField(
|
||||
max_length=32,
|
||||
unique=True,
|
||||
blank=True,
|
||||
null=True,
|
||||
help_text="A Nostr public key in 32-byte hex format",
|
||||
)
|
||||
nostr_relays = models.JSONField(
|
||||
default=list,
|
||||
blank=True,
|
||||
help_text="An array of Nostr relay URLs that this public key posts to",
|
||||
)
|
||||
|
||||
@property
|
||||
def calc_email_md5(self):
|
||||
return md5(self.email.lower().encode("utf-8")).hexdigest()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue