mute: add maybe_get_content function to NdbNote

This patch adds a maybe_get_content method to NdbNote which returns an
optional string instead of “*failed to decrypt content*” on DM
decryption failure.

This method will be used by the MutelistManager in future patches.

Lighting-Address: fishcharlie@strike.me
Signed-off-by: Charlie Fish <contact@charlie.fish>
Reviewed-by: William Casarin <jb55@jb55.com>
Link: 20240210163650.42884-2-contact@charlie.fish
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Charlie Fish
2024-02-10 09:36:46 -07:00
committed by William Casarin
parent d5606aabca
commit 96ed6b7cc7

View File

@@ -346,6 +346,14 @@ extension NdbNote {
return content
}
func maybe_get_content(_ keypair: Keypair) -> String? {
if known_kind == .dm {
return decrypted(keypair: keypair)
}
return content
}
func blocks(_ keypair: Keypair) -> Blocks {
return get_blocks(keypair: keypair)
}