Private Key Fragmentize & recover module.
Split your private key and share to trustworthies in case of losing your key!
//node.js
import crypto from 'node:crypto'
import { Generator } from 'fragment-key'
Generator.initialize(crypto);
//Browser
import { Generator } from 'fragment-key'
Generator.initialize(window.crypto);
//Any custom Crypto library
import { Generator } from 'fragment-key'
import CustomCryptoLibrary from 'my-custom-library'
Generator.initialize(CustomCryptoLibrary, false);
*** NOTE Custom Crypto library should implement CryptoModule
interface
const key = '123123123'
const gen = new Generator(3, key); // at least 3 fragment will be required to recover key
const fragments = await gen.fragmentize(10); // will generate 10 fragment
const myKey = Generator.recover(fragments);
In case, forgetting fragment, generate your fragment recovery phase. You won't be able to find back your fragment if you lose recovery phase
const recoveryPhase = await Generator.generateFragmentRecoveryPhase(fragment, password)
const fragment = await Generator.recoverFragment(recoveryPhase, password);