diff --git a/manualTest.ts b/manualTest.ts deleted file mode 100644 index 085d5ff..0000000 --- a/manualTest.ts +++ /dev/null @@ -1,46 +0,0 @@ -import SeedSplitter from "./mod.ts"; - -// const secret = -// "expire gun route tornado female reflect holiday grief spring clown deliver army"; - -// const curve = await SeedSplitter.fit([ -// { -// name: "secret", -// mnemonic: secret.split(" "), -// }, -// await SeedSplitter.randomPoint(), -// await SeedSplitter.randomPoint(), -// ]); - -const recoveryData = ` -charlotte: valley when dial juice vapor ill payment lunch brass zone alpha topic -daniel: long neutral reject ahead cart proud shoulder auction april same solar match -emily: come foam country senior awkward task possible auction spice hidden sphere giraffe -`; - -const curve = await SeedSplitter.fit( - recoveryData.split("\n").map((line) => { - if (line.trim() === "") { - return []; - } - - const [name, mnemonic] = line.split(": "); - - return { name, mnemonic: mnemonic.split(" ") }; - }).flat(), -); - -const names = [ - "secret", - "ava", - "benjamin", - "charlotte", - "daniel", - "emily", - "finn", - "grace", -]; - -for (const name of names) { - console.log(`${name}:`, (await curve.calculate(name)).join(" ")); -} diff --git a/templates/generate.ts b/templates/generate.ts new file mode 100644 index 0000000..6a93255 --- /dev/null +++ b/templates/generate.ts @@ -0,0 +1,17 @@ +import SeedSplitter from "../mod.ts"; + +const secret = + "vault soap student engine hub blanket tortoise fit device critic stage clay"; + +const ss = await SeedSplitter.fit([ + { name: "secret", mnemonic: secret.split(" ") }, + await SeedSplitter.randomPoint(), + await SeedSplitter.randomPoint(), +]); + +for (const name of ["benjamin", "charlotte", "drawer", "car", "backyard"]) { + console.log( + `${(name + ":").padEnd(10, " ")}`, + (await ss.calculate(name)).join(" "), + ); +} diff --git a/templates/recover.ts b/templates/recover.ts new file mode 100644 index 0000000..a18ba71 --- /dev/null +++ b/templates/recover.ts @@ -0,0 +1,23 @@ +import SeedSplitter from "../mod.ts"; + +const recoveryData = ` +charlotte: evidence foil nut riot draft bronze shine town meat strategy fit broom +car: credit spoil coin drip camera risk ginger just delay spider correct soap +backyard: silent merit way main shop when toward spirit wolf catch level face +`; + +const ss = await SeedSplitter.fit( + recoveryData.split("\n").map((line) => { + if (line.trim() === "") { + return []; + } + + const [name, mnemonic] = line + .split(": ") + .map((part) => part.trim()); + + return { name, mnemonic: mnemonic.split(" ") }; + }).flat(), +); + +console.log((await ss.calculate("secret")).join(" "));