nostr publish event fix
This commit is contained in:
@@ -20,6 +20,10 @@ class User {
|
||||
/// Optional Nostr profile data (if logged in via Nostr).
|
||||
final NostrProfile? nostrProfile;
|
||||
|
||||
/// Optional Nostr private key (nsec) if logged in with nsec.
|
||||
/// This is stored to enable event publishing. Only set if user logged in with nsec.
|
||||
final String? nostrPrivateKey;
|
||||
|
||||
/// Creates a [User] instance.
|
||||
///
|
||||
/// [id] - Unique identifier for the user.
|
||||
@@ -27,12 +31,14 @@ class User {
|
||||
/// [token] - Optional authentication token.
|
||||
/// [createdAt] - Session creation timestamp (defaults to current time).
|
||||
/// [nostrProfile] - Optional Nostr profile data.
|
||||
/// [nostrPrivateKey] - Optional Nostr private key (nsec) for event publishing.
|
||||
User({
|
||||
required this.id,
|
||||
required this.username,
|
||||
this.token,
|
||||
int? createdAt,
|
||||
this.nostrProfile,
|
||||
this.nostrPrivateKey,
|
||||
}) : createdAt = createdAt ?? DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
/// Creates a [User] from a Map (e.g., from database or JSON).
|
||||
@@ -45,6 +51,7 @@ class User {
|
||||
nostrProfile: map['nostr_profile'] != null
|
||||
? NostrProfile.fromJson(map['nostr_profile'] as Map<String, dynamic>)
|
||||
: null,
|
||||
nostrPrivateKey: map['nostr_private_key'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,6 +63,7 @@ class User {
|
||||
'token': token,
|
||||
'created_at': createdAt,
|
||||
'nostr_profile': nostrProfile?.toJson(),
|
||||
'nostr_private_key': nostrPrivateKey,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -66,6 +74,7 @@ class User {
|
||||
String? token,
|
||||
int? createdAt,
|
||||
NostrProfile? nostrProfile,
|
||||
String? nostrPrivateKey,
|
||||
}) {
|
||||
return User(
|
||||
id: id ?? this.id,
|
||||
@@ -73,6 +82,7 @@ class User {
|
||||
token: token ?? this.token,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
nostrProfile: nostrProfile ?? this.nostrProfile,
|
||||
nostrPrivateKey: nostrPrivateKey ?? this.nostrPrivateKey,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user