npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lsp-social-recovery

v1.3.0

Published

Utility for managing and recovering accounts on LUKSO and other evm chains

Downloads

14

Readme

lsp-social-recovery-js

Account ownership recovery sdk built on top Universal Profiles and on Lukso Testnet

Live example: Youtube:

Team Members

  1. Github Profile: Collins Hue

Getting started

Installation

yarn add lsp-social-recovery

or if using npm

npm install --save lsp-social-recovery

Install web3 too if not yet already.

Getting Started

This sdk builds on the Lukso Testnet and uses Universal Profiles Browser extension Universal Profiles Browser Extension please extension is installed to continue.

1. Initializing the sdk

To use the SDK:

import SocialRecover from 'lsp-social-recovery'

const providerUrl = 'https://rpc.l16.lukso.network'

const provider = new HDWalletProvider({
  privateKeys: [process.env.PRIVATE_KEY],
  providerOrUrl: providerUrl,
  pollingInterval: 18000,
  shareNonce: false
})

const options = {
  provider: provider,
  account: '0x508234eA0600b837CD70332ab342f9BB3B4fF900'
}

const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' })
// or
const options = {
  provider: window.ethereum
  account: accounts[0]
}

const socialRecovery = new SocialRecovery(options)

2. Deploy SocialRecovery & BasicRecovery Contracts

const main = async () => {
  const superGuardians = []
  try {
    await socialRecovery.deploy()
    // set secret phrase
    socialRecovery.setSecretPhrase('a secret phrase')
    // save privateKey
    socialRecovery.setPrivateKey(privateKey)
    // add super guardians
    socialRecovery.addSuperGuardians(superGuardians)

  } catch(err) {
    console.err(err)
  }
}

3. Recover account ownership( Signature verification)

a. Signature submission and verification First strategy in recovering account ownership after initialization is to let added superGuardians sign messages and submit the message to be stored in the contract:

const messageHash = web3.utils.sha3(message)
const signature = web3.eth.accounts.sign(messageHash)
await socialRecovery.addGuardianSignature(superGuardian: Address, signature: string)

Note: All guardians must submit a signed message to be used to recover the account in future.

b. Verifying signature To recover the account, all superGuardians must verify their signatures individually:

// guardian1
await socialRecovery.verifySignature(messageHash, signature)
// guardian2
await socialRecovery.verifySignature(messageHash, signature)
// guardian3
await socialRecovery.verifySignature(messageHash, signature)

// all after signature verifications, recover account privateKey
await socialRecovery.recoverPrivateKey(secretPhrase)

All signature verification request must be initiated by the individual superGuardian Universal Profiles

4. Vote-based account recovery

Another strategy is using vote-based method to recover universal account ownership based on LSP11BasicSocialRecovery

await socialRecovery.setScret('a secret')
await socialRecovery.addGuardian(guardianAddress)
await socialRecovery.voteToRecover(recoverProcessId)
// after guardian voting:
await socialRecover.recoverOwnership()

Development

Setup

Clone this repo:

git clone https://github.com/naftalimurgor/social-recovery-js

Install dependencies:

cd social_recovery/
yarn install

Build

To build

yarn build

Test

To run the tests

yarn test

Contributing

Contributions welcome! Feel free to create a new issue or submit a Pull Request.