mirror of
https://github.com/voltrevo/seed-splitter.git
synced 2026-01-09 13:08:07 -05:00
Replace manualTest.ts with templates
This commit is contained in:
@@ -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(" "));
|
||||
}
|
||||
17
templates/generate.ts
Normal file
17
templates/generate.ts
Normal file
@@ -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(" "),
|
||||
);
|
||||
}
|
||||
23
templates/recover.ts
Normal file
23
templates/recover.ts
Normal file
@@ -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(" "));
|
||||
Reference in New Issue
Block a user