Giter Club home page Giter Club logo

googletotpauth's Introduction

GoogleTotpAuth

手机宝令 基于 GoogleAuthenticator的totp算法的手机宝令功能,附带翻牌效果

关于我,欢迎关注
 邮箱:[email protected]  如果对你有点帮助的话,点个star哦~

Screenshots

image

特性

原理说明

  • demo中需要一个secret key字母表在ABCDEFGHIJKLMNOPQRSTUVWXYZ234567之间,需要同服务端相同
  • 项目中时间步长为30s,算法还需传递一个当前时间,必须保证这个时间的准确性,所以必须和服务器时间相同(可以有一定的误差,不能太大)
  • 最后生成一个6位的认证令牌

Getting started

Add it in your root build.gradle at the end of repositories:

allprojects {
   repositories {
       ...
       maven { url "https://jitpack.io" }
   }
}

Add the dependency

dependencies {
      compile 'com.github.Yuphee:GoogleTotpAuth:VERSION_CODE'
}

replace VERSION_CODE with real version name such as released in Here

notice

Both have to write, or else can not be loaded successfully.

使用方法

-seed初始化

public class MApplication extends Application{

   private static MApplication instance = null;

   public static MApplication getInstance() {
       if (null == instance) {
           instance = new MApplication();
       }
       return instance;
   }

   public MApplication() {

   }

   @Override
   public void onCreate() {
       super.onCreate();
       instance = this;
       SPUtils.init(this);
       TotpUtil.init("FZ6S5VB64HVSYLJN");// 初始化SEED
   }
}

-生成令牌

TotpUtil.generate();

-动画相关的逻辑参考MainActivity

TODO

暂时木有

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.