drifter_app/lib/models/nip19/models.dart
2023-05-11 16:48:05 +03:00

72 lines
2.0 KiB
Dart

class ProfilePointer {
final String pubkey;
final List<String>? relays;
ProfilePointer({required this.pubkey, this.relays});
}
/// EventPointer is a class that represents a pointer to an event in the Nostr protocol.
class EventPointer {
/// The unique identifier of the event.
final String id;
/// A list of relays to use to reach the event.
final List<String>? relays;
/// The author of the event.
final String? author;
/// Constructs an EventPointer object with the given properties.
///
/// The [id] parameter is required and represents the unique identifier of the event.
/// The [relays] parameter is optional and represents a list of relays to use to reach the event.
/// The [author] parameter is optional and represents the author of the event.
EventPointer({required this.id, this.relays, this.author});
}
/// A pointer to a Nostr address.
///
/// The [AddressPointer] class is used to store information about a Nostr address
/// including an identifier, a public key, a kind, and a list of relays.
class AddressPointer {
/// The identifier for the address.
final String identifier;
/// The public key associated with the address.
final String pubkey;
/// The kind of the address.
final int kind;
/// The list of relays associated with the address.
final List<String>? relays;
/// Creates a new [AddressPointer] instance.
///
/// The [identifier], [pubkey], and [kind] parameters are required.
/// The [relays] parameter is optional and can be `null`.
AddressPointer({
required this.identifier,
required this.pubkey,
required this.kind,
this.relays,
});
}
class SignatureVerificationException implements Exception {
final String message;
SignatureVerificationException(this.message);
@override
String toString() => 'SignatureVerificationException: $message';
}
class ChecksumVerificationException implements Exception {
final String message;
ChecksumVerificationException(this.message);
@override
String toString() => 'ChecksumVerificationException: $message';
}