From 6cd237c5d3f578853b272e4530633cae476b6b52 Mon Sep 17 00:00:00 2001 From: Ian Coleman Date: Thu, 5 Dec 2019 22:31:03 +1100 Subject: [PATCH] Add failing test for 16 groups --- test/test.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/test/test.js b/test/test.js index 3039620..25e4bce 100644 --- a/test/test.js +++ b/test/test.js @@ -310,3 +310,42 @@ describe('Mnemonic Validation', () => { }); }); }); + +// See https://github.com/satoshilabs/slips/blob/master/slip-0039.md#notation +// particularly the table rows: +// "total number of groups, a positive integer, 1 ≤ G ≤ 16" +// "group threshold, a positive integer, 1 ≤ GT ≤ G" +// This test also fails for 15-of-16, 15-of-15, but passes for all other combos +describe('Maximum number of shares ie 16-of-16', () => { + // generate the shares + let masterSecretHex = "d2b5e45b2934281a118ece2ae498514d"; + let masterSecretBuff = Buffer.from(masterSecretHex, 'hex'); + let masterSecret = []; + for (i = 0; i { + let ms = slip39.recoverSecret(mnemonics, passphrase); + assert(masterSecret.every((v, i) => v === ms[i])); + }); +});