-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
82 lines (60 loc) · 2.07 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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.