Signs for just one auth event to register with the push notification service instead of the dozens of events, one per relay.

This commit is contained in:
Vitor Pamplona
2024-07-23 10:15:36 -04:00
parent bca941e045
commit 38ba456a22
3 changed files with 38 additions and 6 deletions

View File

@@ -56,5 +56,23 @@ class RelayAuthEvent(
)
signer.sign(createdAt, KIND, tags, content, onReady)
}
fun create(
relays: List<String>,
challenge: String,
signer: NostrSigner,
createdAt: Long = TimeUtils.now(),
onReady: (RelayAuthEvent) -> Unit,
) {
val content = ""
val tags =
relays
.map {
arrayOf("relay", it)
}.plusElement(
arrayOf("challenge", challenge),
).toTypedArray()
signer.sign(createdAt, KIND, tags, content, onReady)
}
}
}