mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 10:52:56 +02:00
Allow changing message status
This commit is contained in:
@@ -21,6 +21,7 @@ class StatusEvent(
|
|||||||
const val kind = 30315
|
const val kind = 30315
|
||||||
|
|
||||||
fun create(
|
fun create(
|
||||||
|
msg: String,
|
||||||
type: String,
|
type: String,
|
||||||
expiration: Long?,
|
expiration: Long?,
|
||||||
privateKey: ByteArray,
|
privateKey: ByteArray,
|
||||||
@@ -29,12 +30,12 @@ class StatusEvent(
|
|||||||
val tags = mutableListOf<List<String>>()
|
val tags = mutableListOf<List<String>>()
|
||||||
|
|
||||||
tags.add(listOf("d", type))
|
tags.add(listOf("d", type))
|
||||||
expiration?.let { tags.add(listOf("publishedAt", it.toString())) }
|
expiration?.let { tags.add(listOf("expiration", it.toString())) }
|
||||||
|
|
||||||
val pubKey = CryptoUtils.pubkeyCreate(privateKey).toHexKey()
|
val pubKey = CryptoUtils.pubkeyCreate(privateKey).toHexKey()
|
||||||
val id = generateId(pubKey, createdAt, kind, tags, "")
|
val id = generateId(pubKey, createdAt, kind, tags, msg)
|
||||||
val sig = CryptoUtils.sign(id, privateKey)
|
val sig = CryptoUtils.sign(id, privateKey)
|
||||||
return StatusEvent(id.toHexKey(), pubKey, createdAt, tags, "", sig.toHexKey())
|
return StatusEvent(id.toHexKey(), pubKey, createdAt, tags, msg, sig.toHexKey())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user