An open API service indexing awesome lists of open source software.

https://github.com/sparrowcode/otp

Generating OTP one-time passwords in Swift.
https://github.com/sparrowcode/otp

2fa one-time-password one-time-passwords otp otp-applications otp-codes otp-generator otp-library otp-verification swift

Last synced: 21 days ago
JSON representation

Generating OTP one-time passwords in Swift.

Awesome Lists containing this project

README

        

# One Time Password








## Navigate

- [Installation](#installation)
- [Swift Package Manager](#swift-package-manager)
- [CocoaPods](#cocoapods)
- [Manually](#manually)
- [Usage](#usage)
- [Apps Using](#apps-using)

## Installation

Ready to use on iOS 13+, tvOS 13+ & watchOS 6+

### Swift Package Manager

In Xcode go to `File` -> `Packages` -> `Update to Latest Package Versions` and insert url:

```
https://github.com/sparrowcode/OTP
```

or adding it to the `dependencies` value of your `Package.swift`:

```swift
dependencies: [
.package(url: "https://github.com/sparrowcode/OTP", .upToNextMajor(from: "1.0.0"))
]
```

### CocoaPods:

Specify it in your `Podfile`:

```ruby
pod 'OTP'
```

### Manually

If you prefer not to use any of dependency managers, you can integrate manually. Put `Sources/OTP` folder in your Xcode project. Make sure to enable `Copy items if needed` and `Create groups`.

## Usage

```swift
// With default parametrs
let password = OTP.generateOTP(secret: "secret")

// With custom values
let password = OTP.generateOTP(secret: "secret", algorithm: OTPAlgorithm = .sha1, expirationTimeInSeconds: Int = 30, digits: Int = 6)
```

## Apps Using



If you use a `OTP`, add your application via Pull Request.