Remove the unused encryption field from NIP-94
This commit is contained in:
@@ -38,8 +38,6 @@ class FileHeaderEvent(
|
|||||||
|
|
||||||
fun urls() = tags.filter { it.size > 1 && it[0] == URL }.map { it[1] }
|
fun urls() = tags.filter { it.size > 1 && it[0] == URL }.map { it[1] }
|
||||||
|
|
||||||
fun encryptionKey() = tags.firstOrNull { it.size > 2 && it[0] == ENCRYPTION_KEY }?.let { AESGCM(it[1], it[2]) }
|
|
||||||
|
|
||||||
fun mimeType() = tags.firstOrNull { it.size > 1 && it[0] == MIME_TYPE }?.get(1)
|
fun mimeType() = tags.firstOrNull { it.size > 1 && it[0] == MIME_TYPE }?.get(1)
|
||||||
|
|
||||||
fun hash() = tags.firstOrNull { it.size > 1 && it[0] == HASH }?.get(1)
|
fun hash() = tags.firstOrNull { it.size > 1 && it[0] == HASH }?.get(1)
|
||||||
@@ -88,7 +86,6 @@ class FileHeaderEvent(
|
|||||||
originalHash: String? = null,
|
originalHash: String? = null,
|
||||||
magnetURI: String? = null,
|
magnetURI: String? = null,
|
||||||
torrentInfoHash: String? = null,
|
torrentInfoHash: String? = null,
|
||||||
encryptionKey: AESGCM? = null,
|
|
||||||
sensitiveContent: Boolean? = null,
|
sensitiveContent: Boolean? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
@@ -107,7 +104,6 @@ class FileHeaderEvent(
|
|||||||
originalHash?.let { arrayOf(ORIGINAL_HASH, it) },
|
originalHash?.let { arrayOf(ORIGINAL_HASH, it) },
|
||||||
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
||||||
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
||||||
encryptionKey?.let { arrayOf(ENCRYPTION_KEY, it.key, it.nonce) },
|
|
||||||
sensitiveContent?.let {
|
sensitiveContent?.let {
|
||||||
if (it) {
|
if (it) {
|
||||||
arrayOf("content-warning", "")
|
arrayOf("content-warning", "")
|
||||||
@@ -122,8 +118,3 @@ class FileHeaderEvent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class AESGCM(
|
|
||||||
val key: String,
|
|
||||||
val nonce: String,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ class FileStorageEvent(
|
|||||||
|
|
||||||
fun type() = tags.firstOrNull { it.size > 1 && it[0] == TYPE }?.get(1)
|
fun type() = tags.firstOrNull { it.size > 1 && it[0] == TYPE }?.get(1)
|
||||||
|
|
||||||
fun decryptKey() = tags.firstOrNull { it.size > 2 && it[0] == DECRYPT }?.let { AESGCM(it[1], it[2]) }
|
|
||||||
|
|
||||||
fun decode(): ByteArray? =
|
fun decode(): ByteArray? =
|
||||||
try {
|
try {
|
||||||
Base64.getDecoder().decode(content)
|
Base64.getDecoder().decode(content)
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ class FileStorageHeaderEvent(
|
|||||||
) : Event(id, pubKey, createdAt, KIND, tags, content, sig) {
|
) : Event(id, pubKey, createdAt, KIND, tags, content, sig) {
|
||||||
fun dataEventId() = tags.firstOrNull { it.size > 1 && it[0] == "e" }?.get(1)
|
fun dataEventId() = tags.firstOrNull { it.size > 1 && it[0] == "e" }?.get(1)
|
||||||
|
|
||||||
fun encryptionKey() = tags.firstOrNull { it.size > 2 && it[0] == ENCRYPTION_KEY }?.let { AESGCM(it[1], it[2]) }
|
|
||||||
|
|
||||||
fun mimeType() = tags.firstOrNull { it.size > 1 && it[0] == MIME_TYPE }?.get(1)
|
fun mimeType() = tags.firstOrNull { it.size > 1 && it[0] == MIME_TYPE }?.get(1)
|
||||||
|
|
||||||
fun hash() = tags.firstOrNull { it.size > 1 && it[0] == HASH }?.get(1)
|
fun hash() = tags.firstOrNull { it.size > 1 && it[0] == HASH }?.get(1)
|
||||||
@@ -80,7 +78,6 @@ class FileStorageHeaderEvent(
|
|||||||
blurhash: String? = null,
|
blurhash: String? = null,
|
||||||
magnetURI: String? = null,
|
magnetURI: String? = null,
|
||||||
torrentInfoHash: String? = null,
|
torrentInfoHash: String? = null,
|
||||||
encryptionKey: AESGCM? = null,
|
|
||||||
sensitiveContent: Boolean? = null,
|
sensitiveContent: Boolean? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
@@ -97,7 +94,6 @@ class FileStorageHeaderEvent(
|
|||||||
blurhash?.let { arrayOf(BLUR_HASH, it) },
|
blurhash?.let { arrayOf(BLUR_HASH, it) },
|
||||||
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
||||||
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
||||||
encryptionKey?.let { arrayOf(ENCRYPTION_KEY, it.key, it.nonce) },
|
|
||||||
sensitiveContent?.let {
|
sensitiveContent?.let {
|
||||||
if (it) {
|
if (it) {
|
||||||
arrayOf("content-warning", "")
|
arrayOf("content-warning", "")
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ class ProfileGalleryEntryEvent(
|
|||||||
|
|
||||||
fun urls() = tags.filter { it.size > 1 && it[0] == URL }.map { it[1] }
|
fun urls() = tags.filter { it.size > 1 && it[0] == URL }.map { it[1] }
|
||||||
|
|
||||||
fun encryptionKey() = tags.firstOrNull { it.size > 2 && it[0] == ENCRYPTION_KEY }?.let { AESGCM(it[1], it[2]) }
|
|
||||||
|
|
||||||
fun mimeType() = tags.firstOrNull { it.size > 1 && it[0] == MIME_TYPE }?.get(1)
|
fun mimeType() = tags.firstOrNull { it.size > 1 && it[0] == MIME_TYPE }?.get(1)
|
||||||
|
|
||||||
fun hash() = tags.firstOrNull { it.size > 1 && it[0] == HASH }?.get(1)
|
fun hash() = tags.firstOrNull { it.size > 1 && it[0] == HASH }?.get(1)
|
||||||
@@ -94,7 +92,6 @@ class ProfileGalleryEntryEvent(
|
|||||||
originalHash: String? = null,
|
originalHash: String? = null,
|
||||||
magnetURI: String? = null,
|
magnetURI: String? = null,
|
||||||
torrentInfoHash: String? = null,
|
torrentInfoHash: String? = null,
|
||||||
encryptionKey: AESGCM? = null,
|
|
||||||
sensitiveContent: Boolean? = null,
|
sensitiveContent: Boolean? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
@@ -117,7 +114,6 @@ class ProfileGalleryEntryEvent(
|
|||||||
originalHash?.let { arrayOf(ORIGINAL_HASH, it) },
|
originalHash?.let { arrayOf(ORIGINAL_HASH, it) },
|
||||||
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
||||||
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
||||||
encryptionKey?.let { arrayOf(ENCRYPTION_KEY, it.key, it.nonce) },
|
|
||||||
sensitiveContent?.let {
|
sensitiveContent?.let {
|
||||||
if (it) {
|
if (it) {
|
||||||
arrayOf("content-warning", "")
|
arrayOf("content-warning", "")
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ abstract class VideoEvent(
|
|||||||
originalHash: String? = null,
|
originalHash: String? = null,
|
||||||
magnetURI: String? = null,
|
magnetURI: String? = null,
|
||||||
torrentInfoHash: String? = null,
|
torrentInfoHash: String? = null,
|
||||||
encryptionKey: AESGCM? = null,
|
|
||||||
sensitiveContent: Boolean? = null,
|
sensitiveContent: Boolean? = null,
|
||||||
altDescription: String,
|
altDescription: String,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
@@ -119,7 +118,6 @@ abstract class VideoEvent(
|
|||||||
originalHash?.let { arrayOf(ORIGINAL_HASH, it) },
|
originalHash?.let { arrayOf(ORIGINAL_HASH, it) },
|
||||||
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
magnetURI?.let { arrayOf(MAGNET_URI, it) },
|
||||||
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
torrentInfoHash?.let { arrayOf(TORRENT_INFOHASH, it) },
|
||||||
encryptionKey?.let { arrayOf(ENCRYPTION_KEY, it.key, it.nonce) },
|
|
||||||
sensitiveContent?.let {
|
sensitiveContent?.let {
|
||||||
if (it) {
|
if (it) {
|
||||||
arrayOf("content-warning", "")
|
arrayOf("content-warning", "")
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class VideoHorizontalEvent(
|
|||||||
originalHash: String? = null,
|
originalHash: String? = null,
|
||||||
magnetURI: String? = null,
|
magnetURI: String? = null,
|
||||||
torrentInfoHash: String? = null,
|
torrentInfoHash: String? = null,
|
||||||
encryptionKey: AESGCM? = null,
|
|
||||||
sensitiveContent: Boolean? = null,
|
sensitiveContent: Boolean? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
@@ -69,7 +68,6 @@ class VideoHorizontalEvent(
|
|||||||
originalHash,
|
originalHash,
|
||||||
magnetURI,
|
magnetURI,
|
||||||
torrentInfoHash,
|
torrentInfoHash,
|
||||||
encryptionKey,
|
|
||||||
sensitiveContent,
|
sensitiveContent,
|
||||||
ALT_DESCRIPTION,
|
ALT_DESCRIPTION,
|
||||||
signer,
|
signer,
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class VideoVerticalEvent(
|
|||||||
originalHash: String? = null,
|
originalHash: String? = null,
|
||||||
magnetURI: String? = null,
|
magnetURI: String? = null,
|
||||||
torrentInfoHash: String? = null,
|
torrentInfoHash: String? = null,
|
||||||
encryptionKey: AESGCM? = null,
|
|
||||||
sensitiveContent: Boolean? = null,
|
sensitiveContent: Boolean? = null,
|
||||||
signer: NostrSigner,
|
signer: NostrSigner,
|
||||||
createdAt: Long = TimeUtils.now(),
|
createdAt: Long = TimeUtils.now(),
|
||||||
@@ -69,7 +68,6 @@ class VideoVerticalEvent(
|
|||||||
originalHash,
|
originalHash,
|
||||||
magnetURI,
|
magnetURI,
|
||||||
torrentInfoHash,
|
torrentInfoHash,
|
||||||
encryptionKey,
|
|
||||||
sensitiveContent,
|
sensitiveContent,
|
||||||
ALT_DESCRIPTION,
|
ALT_DESCRIPTION,
|
||||||
signer,
|
signer,
|
||||||
|
|||||||
Reference in New Issue
Block a user