HttpAuth

data class HttpAuth(val url: String, val method: String, val payload: ByteString? = null, val nonce: String? = null, val tags: List<Tag> = listOfNotNull( UrlTag(url), MethodTag(method), payload?.let(::PayloadTag), nonce?.let(::NonceTag), )) : EventContent

Authorization for one HTTP request to url with method. Event kind 27235, as defined in nip-98. payload is the SHA-256 hash of the request body. nonce makes otherwise identical authorizations distinct, for servers that refuse a replayed one.

Constructors

Link copied to clipboard
constructor(url: String, method: String, payload: ByteString? = null, nonce: String? = null, tags: List<Tag> = listOfNotNull( UrlTag(url), MethodTag(method), payload?.let(::PayloadTag), nonce?.let(::NonceTag), ))

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val kind: Int
Link copied to clipboard
Link copied to clipboard
val nonce: String? = null
Link copied to clipboard
val payload: ByteString? = null
Link copied to clipboard
open override val tags: List<Tag>
Link copied to clipboard
val url: String

Functions

Link copied to clipboard
Link copied to clipboard
open fun sign(sec: SecKey): Event

open fun sign(sec: SecKey, at: Instant): Event

Sign this content as created at at, truncated to the second. Signing the same content with the same key at the same second yields an event with the same id, which a relay stores once.

Link copied to clipboard
open override fun toJsonString(): String