mirror of
https://github.com/signalapp/libsignal.git
synced 2026-05-12 18:07:08 +02:00
In libsignal-protocol-java, SessionRecord holds a SesssionState struct which is the "active" session plus a list of old states. If the record is freshly created, there is still a SessionState, but it is an uninitialized/new protobuf structure which causes all fields to be empty/zero/false. So in the original Java logic you can call for example hasSenderChain, and on an empty/fresh record it will return false. However in Rust, in this case the Option is empty and we return an error instead. For hasSenderChain, it seems reasonable to return false if there is no active session, since if there is no session there is certainly no chain. Android also expects the session version to be == 0 on such sessions, but this makes less sense, so have this logic only in the Java binding and not in the Rust library proper.