Coder Social home page Coder Social logo

andriinyzhnik / yubikey Goto Github PK

View Code? Open in Web Editor NEW

This project forked from titanous/yubikey

0.0 2.0 0.0 172 KB

A Ruby library for verifying, decoding, decrypting and parsing Yubikey one-time passwords.

Home Page: http://rubygems.org/gems/yubikey

License: MIT License

Ruby 100.00%

yubikey's Introduction

yubikey

Build Status

Description

A library to verify, decode, decrypt and parse Yubikey one-time passwords.

Usage

OTP Decryption

key = 'ecde18dbe76fbd0c33330f1c354871db'
otp = 'dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh'
token = Yubikey::OTP.new(otp, key)

p "Device public id: #{token.public_id}" #=> 'dteffuje'
p "Device secret id: #{token.secret_id}" #=> '8792ebfe26cc'
p "Device insertions: #{token.insert_counter}" #=> 19
p "Session activation counter: #{token.session_counter}" #=> 17
p "Session timestamp: #{token.timestamp}" #=> 49712
p "OTP random data: #{token.random_number}" #=> 40904

OTP Verification

Use your own api_key and api_id, which you can get at yubico.com.

begin
  otp = Yubikey::OTP::Verify.new(:api_id => 1234,
                                 :api_key => 'NiSwGZBQ0gTbwXbRGWAf4kM5xXg=',
                                 :otp => 'dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh')

  if otp.valid?
    p 'valid OTP'
  elsif otp.replayed?
    p 'replayed OTP'
  end
rescue Yubikey::OTP::InvalidOTPError
  p 'invalid OTP'
end

Install

Yubikey is available as a gem, to install it just install the gem:

gem install yubikey

If you're using Bundler, add the gem to Gemfile.

gem 'yubikey'

Then run bundle install.

Copyright

Ruby library

Written by Jonathan Rudenberg. Copyright (c) 2009 Jonathan Rudenberg

The MIT License. See LICENSE.

Contributors

List of contributors

yubikey's People

Contributors

titanous avatar maartenvg avatar halfbyte avatar wndxlori avatar chrisbdaemon avatar skandragon avatar chrislundquist avatar patcable avatar

Watchers

James Cloos avatar Andrii Nyzhnyk 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.