Bug fix on marmot keypackage bundle (Buggy nsec)

This commit is contained in:
Kgothatso Ngako
2026-06-22 22:30:39 +02:00
parent 9def2cbe33
commit 0f8ee65033
4 changed files with 25 additions and 22 deletions

View File

@@ -2,6 +2,7 @@ package at.torch.compose.database.model
import androidx.room3.Entity
import androidx.room3.ForeignKey
import androidx.room3.Index
import androidx.room3.PrimaryKey
import at.torch.compose.database.model.traits.BroadcastableEntity
import at.torch.compose.database.model.traits.LocalStoreEntity
@@ -12,14 +13,17 @@ import kotlin.time.Clock
import kotlin.time.Instant
@Entity(
foreignKeys = [
ForeignKey(
entity = Profile::class,
parentColumns = ["publicKey"],
childColumns = ["publicKey"],
onDelete = ForeignKey.CASCADE,
),
]
// foreignKeys = [
// ForeignKey(
// entity = Profile::class,
// parentColumns = ["publicKey"],
// childColumns = ["publicKey"],
// onDelete = ForeignKey.CASCADE,
// ),
// ],
indices = [
Index("publicKey"),
],
)
data class MarmotKeyPackageBundle(
@PrimaryKey(autoGenerate = true)

View File

@@ -29,9 +29,9 @@ class DatabaseMarmotRepository(
MarmotKeyPackageBundle(
publicKey = publicKey,
tlsEncodedMarmotKeyPackage = tlsWriter.toByteArray().toHex(),
ncryptsecInitPrivateKey = nip49.encrypt(keyPackageBundle.initPrivateKey.toHex(), nsecPassword), // TODO: ncryptSec this using the private key
ncryptsecEncryptionPrivateKey = nip49.encrypt(keyPackageBundle.encryptionPrivateKey.toHex(), nsecPassword), // TODO: ncryptSec this using the private key
ncryptsecSignaturePrivateKey = nip49.encrypt(keyPackageBundle.signaturePrivateKey.toHex(), nsecPassword) // TODO: ncryptSec this using the private key
ncryptsecInitPrivateKey = keyPackageBundle.initPrivateKey.toHex(), // TODO: ncryptSec this using the private key
ncryptsecEncryptionPrivateKey = keyPackageBundle.encryptionPrivateKey.toHex(), // TODO: ncryptSec this using the private key
ncryptsecSignaturePrivateKey = keyPackageBundle.signaturePrivateKey.toHex() // TODO: ncryptSec this using the private key
)
)

View File

@@ -1,5 +1,6 @@
package at.torch.compose.database.repository
import at.torch.compose.database.model.Profile
import at.torch.compose.database.model.UnsignedNostrEvent
import at.torch.compose.nostr.Relays
import co.touchlab.kermit.Logger