up8-ticket

Securely generate UP8-compatible, @q-encoded master tickets.
Log | Files | Refs | README | LICENSE

commit 4bd9a8b30d664f94f4873a8cd30b9a7eeb393d08
parent 015f397ce184e4048ca7ac4e90d3435c61ebd285
Author: Jared Tobin <jared@jtobin.io>
Date:   Fri, 25 Sep 2020 11:23:14 -0230

test: add gen_ticket_drbg test cases

Diffstat:
Mtest/test.js | 25+++++++++++++++++++++++++
1 file changed, 25 insertions(+), 0 deletions(-)

diff --git a/test/test.js b/test/test.js @@ -70,6 +70,31 @@ describe('gen_ticket_more', () => { }) +describe('gen_ticket_drbg', () => { + + context("when no additional entropy provided", () => { + it('produces tickets of the correct bitlength', async () => { + let given_bits = 384 + let ticket = await mtg.gen_ticket_drbg(given_bits) + let hex = ob.patq2hex(ticket) + let expected_bits = hex.length * 4 + expect(expected_bits).to.equal(given_bits) + }) + }) + + context("when additional entropy provided", () => { + it('produces tickets of the correct bitlength', async () => { + let given_bits = 384 + let addl = Buffer.from("you'll really never predict this") + let ticket = await mtg.gen_ticket_drbg(given_bits, addl) + let hex = ob.patq2hex(ticket) + let expected_bits = hex.length * 4 + expect(expected_bits).to.equal(given_bits) + }) + }) + +}) + describe('shard', () => { it('throws on non-@q input', () => {