Avoids using the up to 2 days random created at from GiftWrap.
This commit is contained in:
+2
-9
@@ -26,7 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
|||||||
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
import com.vitorpamplona.quartz.nip01Core.crypto.KeyPair
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
|
import com.vitorpamplona.quartz.nip01Core.signers.NostrSignerSync
|
||||||
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
import com.vitorpamplona.quartz.nip01Core.tags.people.PTag
|
||||||
import com.vitorpamplona.quartz.nip40Expiration.ExpirationTag
|
|
||||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
@@ -61,18 +60,12 @@ class EphemeralGiftWrapEvent(
|
|||||||
fun create(
|
fun create(
|
||||||
event: Event,
|
event: Event,
|
||||||
recipientPubKey: HexKey,
|
recipientPubKey: HexKey,
|
||||||
expirationDelta: Long? = null,
|
createdAt: Long = TimeUtils.now(),
|
||||||
createdAt: Long = TimeUtils.randomWithTwoDays(),
|
|
||||||
): EphemeralGiftWrapEvent {
|
): EphemeralGiftWrapEvent {
|
||||||
val signer = NostrSignerSync(KeyPair())
|
val signer = NostrSignerSync(KeyPair())
|
||||||
|
|
||||||
val tags =
|
val tags =
|
||||||
expirationDelta?.let {
|
arrayOf(
|
||||||
arrayOf(
|
|
||||||
PTag.assemble(recipientPubKey, null),
|
|
||||||
ExpirationTag.assemble(createdAt + it + TimeUtils.twoDays()),
|
|
||||||
)
|
|
||||||
} ?: arrayOf(
|
|
||||||
PTag.assemble(recipientPubKey, null),
|
PTag.assemble(recipientPubKey, null),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user