Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randy3k/otp
One Time Password Generation and Verification
https://github.com/randy3k/otp
Last synced: 11 days ago
JSON representation
One Time Password Generation and Verification
- Host: GitHub
- URL: https://github.com/randy3k/otp
- Owner: randy3k
- License: other
- Created: 2020-04-24T03:31:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-23T06:12:33.000Z (10 months ago)
- Last Synced: 2024-10-19T05:57:30.955Z (20 days ago)
- Language: R
- Homepage: https://randy3k.github.io/otp
- Size: 205 KB
- Stars: 16
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- awesome-shiny-extensions - otp - One-Time Password generation and verification. (Backend / Authentication)
- jimsghstars - randy3k/otp - One Time Password Generation and Verification (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_knit$set(upload.fun = knitr::imgur_upload)
``````{r results='asis', echo = FALSE, eval = TRUE}
d <- read.dcf("DESCRIPTION")
``````{r results="asis", echo = FALSE, eval = TRUE}
title <- d[colnames(d) == "Title"]
cat(c("# ", paste(trimws(strsplit(title, "\n")[[1]]), collapse = " ")))
```[![check](https://github.com/randy3k/otp/actions/workflows/check.yaml/badge.svg)](https://github.com/randy3k/otp/actions/workflows/check.yaml)
[![codecov](https://codecov.io/gh/randy3k/otp/branch/master/graph/badge.svg)](https://app.codecov.io/gh/randy3k/otp)
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/otp)](https://cran.r-project.org/package=otp)
[![](http://cranlogs.r-pkg.org/badges/grand-total/otp)](https://cran.r-project.org/package=otp)Github: [https://github.com/randy3k/otp](https://github.com/randy3k/otp)
Documentation: [https://randy3k.github.io/otp](https://randy3k.github.io/otp/)
```{r results="asis", echo = FALSE, eval = TRUE}
cat(d[colnames(d) == "Description"])
```## Installation
You can install the released version of otp from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("otp")
```And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("randy3k/otp")
```
## Example```{r}
library(otp)
```### HMAC based One Time Password (HOTP)
```{r}
p <- HOTP$new("JBSWY3DPEHPK3PXP")
p$at(8)
p$verify("964230", 8)
```### Time based One Time Password (TOTP)
```{r}
p <- TOTP$new("JBSWY3DPEHPK3PXP")
(code <- p$now())
p$verify(code)
``````{r, out.width = "20%"}
raster::image(
qrencoder::qrencode_raster(p$provisioning_uri("otp")),
asp = 1, col = c("white", "black"), axes = FALSE,
xlab = "", ylab = ""
)
```## Related projects
- Ruby's [rotp](https://github.com/mdp/rotp).
- Python's [pyotp](https://github.com/pyauth/pyotp).
- [ropt](https://github.com/wrathematics/rotp), an R library for client side one time password management.