Examples on this page target source snapshot
7e5c198e, not a crates.io release. Use the current API guide to select the matching dependency.Create and vote
create and create_quiz return Result<CreatedPoll, PollError>. The named result owns the send result, actual cryptographic creator and validated MessageSecret; it is not a (SendResult, Vec<u8>) tuple.
create_quiz(chat, name, options, correct_option_index) creates a quiz with one correct answer. Creation requires 2 to 12 distinct options. The selectable count is from 1 through the option count; a quiz uses one selection and a zero-based correct index in range.
Decrypt votes
Use the samePollRef for voting and decryption. PollVoteCiphertext borrows the encrypted payload and IV; decryption returns option hashes, not display names.
Raw interoperability
vote_raw and decrypt_vote_raw accept the explicit secret, creation ID and creator metadata needed by external storage integrations. decrypt_vote_raw has the same alias resolution as the typed entry point. Prefer MessageSecret::try_from and PollRef::new when you can validate stored data once at the boundary.
decrypt_vote(ciphertext, &PollRef, voter) is the typed entry point. decrypt_vote_raw accepts the explicit bytes, original ID and identities.
Persist creation metadata
Readsend_result(), creator() and secret() or move them with into_parts(). Store secrets as sensitive data; neither a redacted Debug implementation nor a typed wrapper protects an explicitly exported byte array. CreatedPoll redacts the whole debug representation because its nested protobuf also carries the secret.
aggregate_votes hashes the named options, decrypts incoming updates and counts the latest selection per voter. Check its source signature when adapting a custom history pipeline. Missing or malformed parent secrets must not be silently padded or truncated; see MsgSecretStore.