Cryptosat
WebsiteBlogSatellite Tracking
  • Cryptosat
    • 🛰️Satellite tracking
    • 📄SpaceTEE paper
    • Contribution to the Ethereum KZG Ceremony
      • Cryptosat KZG Operation Tracker
      • Crypto2 contribution output
      • Contribution verification
  • Cryptosim
    • Cryptosim
    • Asynchronous API
    • Use-case examples
    • Open-source contribution
  • 🗳️Private Voting
    • Private Voting on Snapshot X
    • Private Voting Contract
    • Browser Side Encryption
  • 🎲random-beacon
    • Verifiable Random Beacon
    • Using the random beacon on-chain
  • API documentation
    • Message Signing
    • Authentication
    • Randomness API
      • Tutorial
      • API reference
    • Queue API
      • API reference
        • Queue
          • Request
          • Requests
    • Public randomness SAPI
      • About
      • API reference
        • Public randomness
          • Result
    • FROST API
      • About
      • API reference
        • Frost
          • Partial sign
          • Private key
      • Specification
    • Satellite Public Keys
  • ⏳Time-based Primitives
    • ⌚Time-based primitives and delay-encryption
    • ⚛️Using Delay Encryption for Atomic Swaps
  • Flastsat Environment
    • Overview
    • Access and Control
    • Crypto Engine Specs
    • Power API
Powered by GitBook
On this page
  1. Private Voting

Browser Side Encryption

Encryption should be implemented at the edge — the voter. We provide a helper function for app developers to encrypt their users' votes within the users' browsers. This function relies on the native Web Crypto API.

To use the helper function, please add the following script tag to the web page that initiates the vote:

<script src="https://private-voting-docs.cryptosat.io/encrypt.js"></script>

Upon receiving a raw vote from the user, use the async function encryptVote(pubkeyPem, vote) to encrypt the vote. Here, pubkeyPem should be the public key corresponding to the ballot for which the vote is intended

Ensure that only an encrypted vote leaves the browser.

If you prefer to use your own implementation, ensure that it employs RSA encryption with OAEP padding and SHA256 hashing. Also, the Cryptosat Voting Contract expects the encrypted payload to be base64 encoded.

PreviousPrivate Voting ContractNextVerifiable Random Beacon

Last updated 1 year ago

🗳️