Builds an instance of AsyncBallotEncryptor. For ease of use, you may prefer the static {@link AsyncBallotEncryptor#create} method instead, which allows you to pass in JavaScript objects for external types like the manifest, and it will let you know if there's a problem.
Defines everything about the election contests, candidates, etc.
Defines everything about the election cryptographic settings.
Specifies whether each encryption is validated immediately after it is created. Significant performance penalty, but might catch one-in-a-million hardware failures on unreliable clients.
GroupContext for all mathematical operations
The root of all randomness used for encrypting the ballot.
The manifest might specify multiple ballot styles. This names the ballot style to be used for this particular ballot.
Every ballot needs a string identifier which should be globally unique.
Optional timestamp for the ballot, in seconds since the Unix epoch. If not provided, the current time will be used (Math.floor(Date.now() / 1000)) when the final ballot is completed and returned.
Starts an async encryption of the contest. Returns immediately.
Fetches the encrypted ballot, possibly blocking until all the async computation is complete. If a contest wasn't submitted, then it's not possible to derive the result, so an Error is thrown.
For one-stop-shopping, to get exactly what you need for printing something, writing something to disk, sending something across the network, etc., you might prefer to use {@link AsyncBallotEncryptor#getSerializedEncryptedBallot}.
Fetches the encrypted ballot, possibly blocking until all the async computation is complete, and doing all the necessary work to serialize it. Returns that ballot (as a vanilla JavaScript object suitable for conversion to JSON) plus the ballot hash and the cryptographic seed.
Builds an instance of AsyncBallotEncryptor with good default values when appropriate.
GroupContext for all mathematical operations
A JavaScript object corresponding to an ElectionGuard Manifest.
A JavaScript object corresponding to an ElectionGuard ElectionContext.
Specifies whether each encryption is validated immediately after it is created. Significant performance penalty, but might catch one-in-a-million hardware failures on unreliable clients.
The manifest might specify multiple ballot styles. This names the ballot style to be used for this particular ballot.
Every ballot needs a string identifier which should be globally unique.
The hash of the previous ballot. Initially set to the hash of the encryption device.
The root of all randomness used for encrypting the ballot. If not provided, a new random number will be securely generated.
Optional timestamp for the ballot, in seconds since the Unix epoch. If not provided, the current time will be used (Math.floor(Date.now() / 1000)) when the final ballot is completed and returned.
Generated using TypeDoc
This class wraps all the state and machinery necessary to offload encryption computations on a contest-by-contest basis. The idea is that you initialize it with all the state it will ever need as well as specifying the particular ballot style. Then, you can call encrypt(), which will immediately return while running the computation in a webworker or equivalent.
If you encrypt the same contest twice, the latter one will replace the earlier one.
When you're done, you call getEncryptedBallot(), which will block until all the contest encryption is complete, and will then return the encrypted ballot. This call has the potential to fail, for example, if you haven't encrypted all the necessary contests for the given ballot style.
For truly all-in-one behavior, you can instead call getSerializedEncryptedBallot(), which returns an instance of SerializedEncryptedBallot, or might again throw an exception if something went wrong.
Also of note: while elsewhere in the ElectionGuard-Python codebase, errors are indicated by returning undefined, here it's different. Errors are indicated by throwing an Error class, which will contain enough context to assist in tracking down any problems.