Giter Site home page Giter Site logo

scala-totp-auth's Introduction

scala-totp-auth

Build Status

This is a scala object that implements RFC 6238 time based one time passwords. The HOTP protocol is identical except that timing is not used to select OTPs. scala-totp-auth exists to make it easy to integrate totp into one of my Play 2.0 applications. Target portable device runs Google Authenticator.

Sample login code

//Retrieve the user's secret from the db
//retrieve the pin that the user entered from their device

val ok =Authenticator.pinMatchesSecret(userPin,TOTPSecret(base32Secret))
...

API

Take a look at the scaladoc

Running

Check out the project

Type sbt run

Reference Implementation

The Refererence Implementation is in the test sources. scala-totp-auth's behaviour should exactly match the RI. There are a few tests that check this.

If you find any differences please file an issue.

If you think some behaviour should be different from the RI be prepared to motivate your proposal very well.

Test

sbt test

[info] Running Authenticator 

http://google-authenticator.googlecode.com/git/libpam/totp.html to check results

Base32 secret:RM26TUEIDMURGOPL Hex secret:8b35e9d0881b291339eb

Time    : OTP
--------:--------
44699054: 680139
44699055: 956581
44699056: 553109
44699057: 338225
44699058: 450979
44699059: 735724
44699060: 027563
44699061: 941682
44699062: 338183
44699063: 799711
44699064: 061042

How to use it in my project?

There's an

Or build it from source. There is only one class and two objects.

scala-totp-auth's People

Contributors

marklister avatar krrg avatar

Watchers

James Cloos avatar KimSeokHoon avatar

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.