Skip to content

πŸ•³πŸ₯ŠπŸ§  A method of remembering / recovering the same id, key & discoveryKey

Notifications You must be signed in to change notification settings

benzmuircroft/recore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•³πŸ₯Š Recore 🧠

A method of remembering / recovering the same id, key & discoveryKey

Installation

npm i "github:benzmuircroft/recore"

Usage

;(async function() {

  const recore = require('recore');

  // part 1

  const seed = await recore.createSeed();

  console.log('seed:', seed);
  
  const keyPair = await recore.createKeyPair(seed);

  console.log('keyPair:', keyPair);

  // comment out part 1, save what was printed out and retry like:
  /*
  const seed = '5bbj66y8njo79oarnbqxwf4x17up4yusg7h7zg7qcw6iey63rd7o';
  const keyPair = {
    publicKey: 'd8429f78071261dfc304105cfa174f9766dd02763779db9bae653d5403d920fb',
    secretKey: 'dc30c0a2f2fde06eea372240fbc50fcb83a64376750b37fc51dd99010c11d1e7d8429f78071261dfc304105cfa174f9766dd02763779db9bae653d5403d920fb'
  };
  */

  const core = await recore.reloadCore(keyPair, './folder', { valueEncoding: 'json' });
  
  console.log(`core:
    id:           ${core.id}
    key:          ${core.key.toString('hex')}
    discoveryKey: ${core.discoveryKey.toString('hex')}`
  );

  // over and over, every time it will get the same result!

})();

About

πŸ•³πŸ₯ŠπŸ§  A method of remembering / recovering the same id, key & discoveryKey

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published