Skip to content

encryptVote output format is iv:authTag:ciphertext in base64 but README shows hex — standardise to one format #24

Description

@Just-Bamford

Summary

The js README documents encryptVote as returning
iv:authTag:ciphertext in base64. The core README documents the
vote encryption as using AES-256-GCM with hex output. The
src/crypto.ts implementation needs to be checked — whichever format
it actually produces, one of the two READMEs is wrong. A consumer
importing @anonvote/crypto in core who follows the core README
will attempt to parse hex but receive base64 (or vice versa), causing
a silent decryption failure during the tally that produces no error
until the result is wrong.

The format must be standardised to one canonical representation across
the implementation, both READMEs, and the EncryptedPayload type.

Scope

  • Read src/crypto.ts and determine the actual output format of
    encryptVote — base64 or hex
  • Choose hex as the canonical format — it is more consistent with
    hashIdentifier and hashToken which both output hex, and it is
    what the core README documents
  • If encryptVote currently outputs base64, update it to output hex
    for all three fields in EncryptedPayloadciphertext, iv,
    authTag
  • Update decryptVote to parse hex input if it currently expects base64
  • Update the js README Usage section to show hex output
  • Update the Security notes section in the js README to remove any
    reference to base64
  • Add a unit test that calls encryptVote and asserts all three
    fields in the returned EncryptedPayload are valid hex strings —
    not base64

Relevant Files

  • src/crypto.ts
  • README.md
  • tests/crypto.test.ts

Acceptance Criteria

  • encryptVote outputs hex for ciphertext, iv, and authTag
  • decryptVote correctly parses hex input
  • Both the js README and core README document the same format
  • Unit test asserts hex format on all three EncryptedPayload fields
  • Full roundtrip test passes after format change

Out of Scope

  • Changing the encryption algorithm
  • Changes to core service files — update core README only

Note for Contributors

If the existing implementation already outputs hex and the README is
wrong, the fix is documentation only. Confirm the actual output format
first before touching any code. Do not change the format if it is
already hex — only fix the README.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions