Skip to main content
Examples on this page target source snapshot 7e5c198e, not a crates.io release. Use the current API guide to select the matching dependency.

Choose the creation type

Use polls().create for single or multiple selections. Use create_quiz with a correct option index for a quiz. Both return CreatedPoll and carry the secret and creator needed by later votes.

Keep the parent association

Save the creation message ID, destination, actual crypto creator and secret together. To rebuild a reference for an incoming poll, use its InboundMessage::message_ref(), the original creator and a validated MessageSecret. A message reference by itself does not include the crypto secret. When processing updates, decrypt_vote(ciphertext, &target, voter).await returns selected option hashes. Map hashes to the creation’s option names or use aggregate_votes for a tally. Preserve voter identity and update order when building a custom aggregate.

Handle unavailable secrets

A received update cannot be decrypted without its parent secret. Implement the named validated storage read and retain the parent timestamp when known. History-sync and inbound processing can seed that store, but an application must not assume every parent is available. See the poll task reference for raw interoperability, source links and current contracts.