Sha256: 514d7917eceb5c80a77172e271d728d8b13a46ae1f0498d91d8fb8bf8a741d35
Contents?: true
Size: 1.08 KB
Versions: 11
Compression:
Stored size: 1.08 KB
Contents
require File.dirname(__FILE__) + '/spec_helper.rb' describe 'Yubikey::OTP' do it 'should parse a otp' do token = Yubikey::OTP.new('dteffujehknhfjbrjnlnldnhcujvddbikngjrtgh', 'ecde18dbe76fbd0c33330f1c354871db') token.public_id.should == 'dteffuje' token.secret_id.should == '8792ebfe26cc' token.insert_counter.should == 19 token.session_counter.should == 17 token.timestamp.should == 49712 token.random_number.should == 40904 end it 'should raise if key or otp invalid' do otp = 'hknhfjbrjnlnldnhcujvddbikngjrtgh' key = 'ecde18dbe76fbd0c33330f1c354871db' lambda { Yubikey::OTP.new(key, key) }.should raise_error(Yubikey::OTP::InvalidOTPError) lambda { Yubikey::OTP.new(otp, otp) }.should raise_error(Yubikey::OTP::InvalidKeyError) lambda { Yubikey::OTP.new(otp[0,31], key) }.should raise_error(Yubikey::OTP::InvalidOTPError) lambda { Yubikey::OTP.new(otp, key[0,31]) }.should raise_error(Yubikey::OTP::InvalidKeyError) lambda { Yubikey::OTP.new(otp[1,31]+'d', key) }.should raise_error(Yubikey::OTP::BadCRCError) end end
Version data entries
11 entries across 11 versions & 2 rubygems