moosamir68 / oath.swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oath.swift

OATH algorithms in swift

Features

  • TOTP
  • HOTP
  • Challenge and response

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate oath.swift into your Xcode project using CocoaPods, specify it in your Podfile:

Swift 4.2

pod 'oath', :git => 'https://github.com/Carrene/oath.swift.git', :tag => '0.4.0'

Swift 3

pod 'oath', :git => 'https://github.com/Carrene/oath.swift.git', :tag => '0.3.0'

Usage

//TOTP
let otp = Totp(secret: secret, timeInterval: 30, otpLength: 8, hashType: HashType.SHA1)
let totp = otp.generateTotp(time: 59)

//HOTP
let hotp = Hotp(secret: secret, otpLength: 6, hashType: HashType.SHA1)
let hotp = hotp.generateHotp()

For more information consider oath.swift tests

About


Languages

Language:Swift 94.9%Language:Ruby 3.5%Language:Objective-C 1.5%