@affixio/voting
v1.0.1
Published
Yes/no voting for terminals with fraud detection and one-vote-per-user verification. Uses zero-knowledge circuits and API-key-authenticated live circuits to combat vote fraud.
Maintainers
Keywords
Readme
@affixio/voting
Yes/no voting for terminals with fraud detection and one vote per user. All requests go to https://api.affix-io.com.
API key required
This package does not include an API key. You must supply your own:
- Sign in at AffixIO and open your dashboard.
- Create or copy an API key.
- Pass it in when creating the client (e.g. from an environment variable). Do not commit the key to source control.
Without a valid API key, the client will throw and requests will not be sent.
Install
npm install @affixio/votingUsage
import { VotingClient, inMemoryVoteRegistry } from '@affixio/voting';
const client = new VotingClient(
{ apiKey: process.env.AFFIXIO_API_KEY },
{ voteRegistry: inMemoryVoteRegistry }
);
const result = await client.submitTerminalVote({
pollId: 'poll-1',
voterId: 'user-123',
choice: 1,
deviceId: 'kiosk-1',
});- apiKey — Required. Use
process.env.AFFIXIO_API_KEYor your own config; never hardcode. - voteRegistry — Tracks who has voted so each user can vote only once per poll. Use
inMemoryVoteRegistryor your own store (e.g. Redis/DB) for production. - choice —
1= yes,0= no. - result.accepted —
trueif the vote was accepted; result.fraudRejected —trueif rejected (e.g. already voted).
MIT
