verify
import "github.com/ShywareLLC/core/verify"
The verify package is intentionally minimal: it has zero non-stdlib dependencies.
Any auditor can run it without installing CometBFT, cloud KMS SDKs, or ZK libraries. It is the
independent verification artifact — the thing you hand to a third-party auditor.
BuildSigningPayload
func BuildSigningPayload(
voteMerkleRoot []byte,
voterMerkleRoot []byte,
totalVotes int64,
counts map[string]int64,
) []byte
Reconstructs the canonical SHA-256 signing payload from tally components. This is the
same function called inside state.executePollClose — it produces an identical
payload that can be verified against the stored tally signature.
VerifyECDSA
func VerifyECDSA(pubKeyDER, sigDER, payload []byte) (bool, error)
Verifies a DER-encoded ECDSA signature against a payload using the DER-encoded public key.
Uses crypto/x509.ParsePKIXPublicKey — no external dependencies.
End-to-end verification
go run ./embodiments/shyvoting/cmd/shyvoting-verify --api https://your-deployment.example --poll <poll-id>
# Checks count-match structurally either way; additionally checks the KMS/HSM
# signature only if the deployment has one configured (not required).
Or call the functions directly:
tally := verify.FetchTally(apiBase, pollID)
count := verify.FetchVoterCount(apiBase, pollID)
if tally.TotalVotes != count {
log.Fatal("count-match FAILED")
}
payload := verify.BuildSigningPayload(
tally.VoteMerkleRoot, tally.VoterMerkleRoot,
tally.TotalVotes, tally.Counts,
)
if len(tally.PublicKey) > 0 {
ok, err := verify.VerifyECDSA(tally.PublicKey, tally.Signature, payload)
if err != nil || !ok { log.Fatal("tally signature INVALID") }
fmt.Println("Tally signature: VALID")
}
fmt.Println("Count-match: VALID")
What verification proves
Count-match compares the participant count and submission count within one poll. It requires no signing key. For open polls, compare the active public record count and voter count at one block height; after close, use the finalized tally and independently inspect its records and roots.
A valid optional signature binds the supplied roots, counts, and total to a key. Trust in that key's provenance requires an independently established expected key; a signature with a key supplied in the same response does not establish operator identity or KMS/HSM use. Signatures do not replace count-match or root verification. Receipt-confirmation counts are an audit signal; a genuine voter can remain unconfirmed, so an audit gap alone does not prove that identities were fabricated.
Public inspection and authenticated records
Console inspection reads
GET /polls/{poll-id}/inspection. The response includes complete public poll
records, both list roots, a full-record commitment, and a domain-separated Merkle
proof to the application hash. The browser recomputes the content commitment and
proof, checks count-match, and requires the proof height and application hash to
match a stable /health response. Ballot-ID roots alone cannot authenticate
choices: replacing yes with no can preserve the ballot ID.
An API-reported application hash is not an independent trust anchor. The browser also verifies archived RFC 3161 tokens: timestamp imprint, CMS signature, exclusive timestamping certificate usage, and the certificate path to the pinned DigiCert root. It displays checkpoint height and timestamp and compares all three commitments: ballots, participants, and complete records. Identifier-only tokens are historical evidence, not authentication of vote contents. Missing, invalid, and stale evidence stays visible; certificate revocation is not checked.
A matching independently timestamped checkpoint establishes that those committed records existed by that time. It does not prove every subsequent state is unchanged. Single-node operation is a supported tamper-evident tier; independent validator quorums provide a separate consensus tier. Optional period-close signatures and KMS/HSM are not prerequisites for these structural checks.