Summary
The @anonvote/crypto package is feature-complete but has no guide
for third-party developers on how to integrate it or build on top of
AnonVote. The README has API reference but no examples showing real
workflows (create ballot, generate tokens, encrypt votes, verify
results). Without this, a new developer downloading the package has
no clear path to using it productively. Comprehensive examples and an
integration guide unlock the Milestone 3 ecosystem goal.
Background
The js/README.md has a Usage section with a small code snippet but
no end-to-end example. There is no guide on how to:
- Generate a ballot encryption key
- Create tokens for voters
- Encrypt and decrypt votes
- Verify results on-chain
- Handle errors
Scope
Documentation
-
Create js/INTEGRATION_GUIDE.md with:
- Step-by-step walkthrough of a complete ballot lifecycle (create
ballot → generate key → issue tokens → encrypt votes → tally)
- Code examples for each step using the SDK
- Error handling examples (catching
AnonVoteCryptoError)
- Common pitfalls and how to avoid them (e.g., key storage, token
security)
- FAQ section covering: key rotation, token reuse, encryption
performance, type safety
-
Create js/examples/ directory with working code samples:
examples/basic-ballot.ts — create a ballot and encrypt a vote
examples/token-generation.ts — generate and hash tokens
examples/error-handling.ts — catch and handle errors
examples/type-usage.ts — using exported types
-
Add a "Getting Started" section to js/README.md that links to the
integration guide and examples
-
Add TypeDoc comments to all exported functions showing example usage
Tests
- Verify all code examples in
examples/ directory compile and run
- Add a test that runs all examples to ensure they don't break on
future changes
Relevant Files
js/INTEGRATION_GUIDE.md (new)
js/examples/ (new directory with samples)
js/README.md (add Getting Started)
js/src/crypto.ts (add TypeDoc examples)
js/tests/examples.test.ts (new, runs examples)
Acceptance Criteria
Out of Scope
- Video tutorials — written guides only
- Framework-specific examples (React, Vue, etc.) — framework-agnostic only
Note for Contributors
This is your chance to show developers how to use AnonVote. Make
examples realistic and production-grade. A developer reading this
guide should feel confident building an integration. Include error
handling, not just happy paths.
Summary
The
@anonvote/cryptopackage is feature-complete but has no guidefor third-party developers on how to integrate it or build on top of
AnonVote. The README has API reference but no examples showing real
workflows (create ballot, generate tokens, encrypt votes, verify
results). Without this, a new developer downloading the package has
no clear path to using it productively. Comprehensive examples and an
integration guide unlock the Milestone 3 ecosystem goal.
Background
The
js/README.mdhas a Usage section with a small code snippet butno end-to-end example. There is no guide on how to:
Scope
Documentation
Create
js/INTEGRATION_GUIDE.mdwith:ballot → generate key → issue tokens → encrypt votes → tally)
AnonVoteCryptoError)security)
performance, type safety
Create
js/examples/directory with working code samples:examples/basic-ballot.ts— create a ballot and encrypt a voteexamples/token-generation.ts— generate and hash tokensexamples/error-handling.ts— catch and handle errorsexamples/type-usage.ts— using exported typesAdd a "Getting Started" section to
js/README.mdthat links to theintegration guide and examples
Add TypeDoc comments to all exported functions showing example usage
Tests
examples/directory compile and runfuture changes
Relevant Files
js/INTEGRATION_GUIDE.md(new)js/examples/(new directory with samples)js/README.md(add Getting Started)js/src/crypto.ts(add TypeDoc examples)js/tests/examples.test.ts(new, runs examples)Acceptance Criteria
INTEGRATION_GUIDE.mdcreated with lifecycle walkthroughexamples/directoryOut of Scope
Note for Contributors
This is your chance to show developers how to use AnonVote. Make
examples realistic and production-grade. A developer reading this
guide should feel confident building an integration. Include error
handling, not just happy paths.