Package-level declarations

Types

Link copied to clipboard
data class AmountTag(val amount: Long) : Tag
Link copied to clipboard
data class Bolt11Tag(val bolt11: String) : Tag
Link copied to clipboard
data class Downvote(val eventId: ByteString, val authorPubKey: PubKey, val tags: List<Tag> = listOf(EventTag(eventId), PubKeyTag(authorPubKey))) : Reaction

Specialised reaction indicating a downvote.

Link copied to clipboard
data class EmojiReact(val emoji: String, val eventId: ByteString, val authorPubKey: PubKey, val tags: List<Tag> = listOf(EventTag(eventId), PubKeyTag(authorPubKey))) : Reaction

Any reaction that isn't an upvote or downvote.

Link copied to clipboard
data class EncryptedDm(val to: PubKey, val cipherText: CipherText, val tags: List<Tag> = listOf(PubKeyTag(to))) : EventContent

An encrypted direct message. Event kind 4, as defined in nip-04.

Link copied to clipboard
data class Event(val id: ByteString, @Json(name = "pubkey") val pubKey: ByteString, @Json(name = "created_at") val createdAt: Instant, val kind: Int, val tags: List<List<String>>, val content: String, val sig: ByteString)

The primitive type understood by relays, as per nip-01

Link copied to clipboard
interface EventContent

A type that can be signed and converted into an Event

Link copied to clipboard
data class EventDeletion(val message: String = "", val eventIds: Set<ByteString>, val tags: List<Tag> = eventIds.map { EventTag(it) }) : EventContent

An event deletion request message. Event kind 5, as defined in nip-09.

Link copied to clipboard
data class EventTag(val eventId: ByteString) : Tag
Link copied to clipboard
data class Filter(val ids: Set<String>? = null, val since: Instant? = null, val authors: Set<String>? = null, val kinds: Set<Int>? = null, @Json(name = "#e") val eTags: Set<String>? = null, @Json(name = "#p") val pTags: Set<String>? = null, @Json(name = "#t") val tTags: Set<String>? = null, val limit: Int? = null)

A subscription filter, as defined in nip-01.

Link copied to clipboard
data class HashTag(val label: String) : Tag
Link copied to clipboard
data class LnUrlTag(val lnurl: String) : Tag
Link copied to clipboard
data class PreimageTag(val preimage: ByteString) : Tag
Link copied to clipboard
data class PubKeyTag(val pubKey: PubKey) : Tag
Link copied to clipboard
sealed class Reaction : EventContent

A reaction to an event. Event kind 7, as defined in nip-25.

Link copied to clipboard
data class RelaysTag(val relays: List<String>) : Tag
Link copied to clipboard
interface Tag
Link copied to clipboard
data class TextNote(val text: String, val tags: List<Tag> = emptyList()) : EventContent

A text note that can be published via relays. Event kind 1, as defined in nip-01.

Link copied to clipboard
data class Upvote(val eventId: ByteString, val authorPubKey: PubKey, val tags: List<Tag> = listOf(EventTag(eventId), PubKeyTag(authorPubKey))) : Reaction

Specialised reaction indicating an upvote.

Link copied to clipboard
data class UserMetaData(val name: String? = null, val about: String? = null, val picture: String? = null, val nip05: String? = null, val banner: String? = null, @Json(name = "display_name") val displayName: String? = null, val website: String? = null, val tags: List<Tag> = emptyList()) : EventContent

User metadata (profile). Event kind 0, as defined in nip-01.

Link copied to clipboard
data class ZapReceipt(val to: PubKey, val eventId: ByteString?, val bolt11: String, val zapRequest: Event, val preimage: ByteString? = null, val tags: List<Tag> = listOfNotNull( PubKeyTag(to), eventId?.let(::EventTag), Bolt11Tag(bolt11), ZapReceiptDescriptionTag(zapRequest), preimage?.let(::PreimageTag), )) : EventContent

Zap receipt. Event kind 9735, as defined in nip-57.

Link copied to clipboard
data class ZapReceiptDescriptionTag(val description: Event) : Tag
Link copied to clipboard
data class ZapRequest(val content: String, val relays: List<String>, val amount: Long?, val lnurl: String?, val to: PubKey, val eventId: ByteString?, val tags: List<Tag> = listOfNotNull( RelaysTag(relays), amount?.let(::AmountTag), lnurl?.let(::LnUrlTag), PubKeyTag(to), eventId?.let(::EventTag) )) : EventContent

Zap request. Event kind 9734, as defined in nip-57.

Functions

Link copied to clipboard
fun SecKey.encrypt(to: PubKey, plainText: String): CipherText