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

@automata-network/2fa-guru-sdk

v1.0.18

Published

A SDK for easy integration with 2FA Guru

Downloads

41

Readme

Introduction

The 2FA Guru SDK is a JavaScript library for developers to seamlessly interact with smart contracts that have extended 2FA functionalities.


Specification

Smart Contract

Implementation smart contracts must inherit the TwoFactorBase contract. The TwoFactorBase contract includes the following administrative methods:

  • Initializing the variable twoFactorAuthenticator to our authenticator contract address.
  • Toggle 2FA protection using the enabled2FAProtection and disable2FAProtection methods.
  • The only2FA modifier. Functions with the modifier on a contract can only be called with a signature prepared by the geode upon successful verification (sending a correct 6 digit code)

Source Code:

  • TwoFactorBase:
  • Example Contract:

SDK

The main module has the following functions built-in:

  • signupFor2fa- Generates a secret for authenticator apps such as Google to generate a six digit verification code during 2fa sign up.

  • confirmSignupFor2fa - Uses the six digit verification code to store the wallet-secret pair in the geode.

  • reset2fa - Generates a secret for authenticator apps such as Google to generate a six digit verification code during 2fa reset.

  • confirmReset2fa - Uses the six digit verification code to reset the wallet-secret pair in the geode.

  • addRecoveryWallet - Bind a recovery wallet to your primary wallet on chain. A recovery wallet will be used for the reset of 2fa.

  • disable2fa - Disable the 2fa for your connected primary wallet. There will be a cooldown period before disabling the 2fa.

  • cancel2faCooldown - Cancels the cooldown period before disabling of 2fa.

  • check2fa - Returns a signature for contract calls from geode if verification code is valid

  • executeTxnCall - Execute a low lvl call to the blockchain. Used with the signature generated from check2fa()

  • get2faInfo - Get info the binding expiry, disable 2fa cooldown and whether 2fa has been created for the wallet

  • getRecoveryWallet - Retrieve the recovery wallet of a primary wallet. 0x0 is returned if no recovery wallet is present.

  • getWalletNonce - Retrieve the nonce of a wallet address

Source Code

https://github.com/automata-network/2fa-guru-sdk


Quick Guide

Prerequisite

Install the SDK by running:

yarn add @automata-network/2fa-guru-sdk

Instantiate the module with a provider, authenticator contract and your own project contract

import { TwoFAGuru } from '@automata-network/2fa-guru-sdk';

const twoFAGuru = new TwoFAGuru(_provider, _authenticatorContract, _tokenContract)

`_provider` - The provider in which the module will use for blockchain calls
`_authenticatorContract` - Our authenticator contract address
`_tokenContract` - Your project contract address that has implemented TwoFactorBase.sol