mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-27 04:45:20 +00:00
Split-out safe half of #1437 (the kind-1402 wire migration stays held for Android coordination). Docs (README/WHITEPAPER/PRIVACY_POLICY/privacy-assessment) now describe the actual proprietary DM construction — kind 1059 gift wrap carrying XChaCha20-Poly1305 with a 24-byte nonce, base64url v2: framing, and an HKDF that borrows the nip44-v2 info label but is not the NIP-44 key schedule — instead of claiming NIP-17/44/59. Hardens the existing legacy inbound path: 64 KiB ciphertext cap before decode (~46x the largest producible legacy envelope), outer kind/recipient-tag/signature binding, tagless kind-13 seal binding, unsigned kind-14 inner binding, inner tags restricted to the two shapes deployed clients emit (verified against every historical iOS release and a fixture frozen from Android production), SecRandomCopyBytes failure now throws, non-UTF-8 plaintext now throws instead of returning empty. Adds frozen cross-platform fixtures with hash-pinned generators; interop-reviewed with no rejection surface for deployed clients.
30 lines
1.4 KiB
Plaintext
30 lines
1.4 KiB
Plaintext
diff --git a/app/src/test/kotlin/com/bitchat/android/nostr/NostrProtocolTest.kt b/app/src/test/kotlin/com/bitchat/android/nostr/NostrProtocolTest.kt
|
|
index a5bd956..544a29b 100644
|
|
--- a/app/src/test/kotlin/com/bitchat/android/nostr/NostrProtocolTest.kt
|
|
+++ b/app/src/test/kotlin/com/bitchat/android/nostr/NostrProtocolTest.kt
|
|
@@ -10,0 +11,21 @@ class NostrProtocolTest {
|
|
+ @Test
|
|
+ fun emitCrossPlatformFixtures() {
|
|
+ val sender = NostrIdentity.fromPrivateKey(
|
|
+ "0000000000000000000000000000000000000000000000000000000000000001"
|
|
+ )
|
|
+ val recipient = NostrIdentity.fromPrivateKey(
|
|
+ "0000000000000000000000000000000000000000000000000000000000000002"
|
|
+ )
|
|
+ val giftWrap = NostrProtocol.createPrivateMessage(
|
|
+ content = "legacy fixture from Android b7f0b33d",
|
|
+ recipientPubkey = recipient.publicKeyHex,
|
|
+ senderIdentity = sender
|
|
+ ).single()
|
|
+
|
|
+ assertEquals(NostrKind.GIFT_WRAP, giftWrap.kind)
|
|
+ assertEquals(listOf(listOf("p", recipient.publicKeyHex)), giftWrap.tags)
|
|
+ println("BITCHAT_FIXTURE_EVENT=${gson.toJson(giftWrap)}")
|
|
+ println("BITCHAT_FIXTURE_RECIPIENT_PRIVATE_KEY=${recipient.privateKeyHex}")
|
|
+ println("BITCHAT_FIXTURE_SENDER_PUBLIC_KEY=${sender.publicKeyHex}")
|
|
+ }
|
|
+
|
|
@Test
|
|
fun decryptPrivateMessage_acceptsAuthenticatedSeal() {
|
|
val sender = NostrIdentity.generate()
|