YubiOATH

A mostly-complete Ruby implementation of the YubiOATH applet protocol.

Usage

The YubiOATH class accepts a card, which must respond to #transmit(apdu).

You probably want to use costan/smartcard.

yubioath = YubiOATH.new(card)

Calculate

Do calculate for one named code.

yubioath.calculate(name: 'foo', timestamp: Time.now)   # => '237893'

Calculate All

Do calculation for all available codes.

yubioath.calculate_all(timestamp: Time.now)   # => { 'foo' => '576238', 'bar' => '123895' }

Delete

Deletes an existing code.

yubioath.delete(name: 'foo')   # => true

List

List configured codes.

yubioath.list   # => { 'foo' => { type: :totp, algorithm: :sha256 } }

Put

Adds a new (or overwrites) OATH code.

yubioath.put(name: 'foo', secret: 'bar', …)   # => true

Reset

Reset the applet to just-installed state.

yubioath.reset   # => true