mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 10:05:21 +00:00
try 1
This commit is contained in:
@@ -90,6 +90,34 @@ object NostrProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a geohash-scoped text note (kind 1) with optional nickname
|
||||
* This creates a persistent text note that can be retrieved later
|
||||
*/
|
||||
suspend fun createGeohashTextNote(
|
||||
content: String,
|
||||
geohash: String,
|
||||
senderIdentity: NostrIdentity,
|
||||
nickname: String? = null
|
||||
): NostrEvent = withContext(Dispatchers.Default) {
|
||||
val tags = mutableListOf<List<String>>()
|
||||
tags.add(listOf("g", geohash))
|
||||
|
||||
if (!nickname.isNullOrEmpty()) {
|
||||
tags.add(listOf("n", nickname))
|
||||
}
|
||||
|
||||
val event = NostrEvent(
|
||||
pubkey = senderIdentity.publicKeyHex,
|
||||
createdAt = (System.currentTimeMillis() / 1000).toInt(),
|
||||
kind = NostrKind.TEXT_NOTE,
|
||||
tags = tags,
|
||||
content = content
|
||||
)
|
||||
|
||||
return@withContext senderIdentity.signEvent(event)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a geohash-scoped ephemeral public message (kind 20000)
|
||||
* Includes Proof of Work mining if enabled in settings
|
||||
|
||||
Reference in New Issue
Block a user