mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 07:25:18 +00:00
Reject unsendable Nostr DMs visibly
This commit is contained in:
@@ -399,6 +399,27 @@ struct NostrProtocolTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test func privateEnvelopePublicationBatchRejectsMaximumComposerPayload() throws {
|
||||
let sender = try NostrIdentity.generate()
|
||||
let recipient = try NostrIdentity.generate()
|
||||
let composerMaximum = String(
|
||||
repeating: "x",
|
||||
count: InputValidator.Limits.maxMessageLength
|
||||
)
|
||||
|
||||
#expect(
|
||||
composerMaximum.utf8.count
|
||||
> NostrProtocol.maximumPrivateEnvelopePlaintextBytes
|
||||
)
|
||||
expectInvalidCiphertext {
|
||||
_ = try NostrProtocol.createPrivateEnvelopePublicationBatch(
|
||||
content: composerMaximum,
|
||||
recipientPubkey: recipient.publicKeyHex,
|
||||
senderIdentity: sender
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test func privateEnvelopeRejectsOversizedNestedJSONBeforeParsing() {
|
||||
let oversizedJSON = String(
|
||||
repeating: "{",
|
||||
|
||||
Reference in New Issue
Block a user