Fix Android OpenPGP message ID handling

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-11-17 22:20:51 +02:00
co-authored by Copilot
parent 96c7b6966b
commit 93ff651e9d
4 changed files with 36 additions and 1 deletions
@@ -0,0 +1,12 @@
package studio.daybreak.mail
internal object PgpMessageUid {
fun requireValid(value: Any?): Long {
require(value is Number) { "That message could not be identified." }
val number = value.toDouble()
require(number.isFinite() && number >= 1 && number <= 4294967295.0 && number == kotlin.math.floor(number)) {
"That message could not be identified."
}
return number.toLong()
}
}