| 1 |
|
| MODULE = Punk::TOTP PACKAGE = Punk::Plugin::TOTP |
| 2 |
|
| |
| 3 |
|
| PROTOTYPES: DISABLE |
| 4 |
|
| |
| 5 |
|
| # plugin 'TOTP' => \%opts, via Punk: validates the options, freezes the |
| 6 |
|
| # configuration under the application class, and installs the helpers, |
| 7 |
|
| # the challenge routes, the rate limit and the totp_guard keyword |
| 8 |
|
| # (ptotp_plugin.h). |
| 9 |
|
| void |
| 10 |
|
| register(class, app, opts = &PL_sv_undef) |
| 11 |
|
| SV *class |
| 12 |
|
| SV *app |
| 13 |
|
| SV *opts |
| 14 |
|
| CODE: |
| 15 |
|
| PERL_UNUSED_VAR(class); |
| 16 |
0 |
| pp_register(aTHX_ app, opts); |
| 17 |
|
| |
| 18 |
|
| # The configuration for an application class - the test and introspection |
| 19 |
|
| # seam. The hash is live: a value changed here is what the next request |
| 20 |
|
| # reads. |
| 21 |
|
| SV * |
| 22 |
|
| state_for(...) |
| 23 |
|
| CODE: |
| 24 |
|
| { |
| 25 |
0 |
| SV **e = NULL; |
| 26 |
0 |
▶ | if (items > 0 && PP_STATE) { |
Branch: 2 branches
| Branch | True | False | Total |
| if (items > 0 && PP_STATE) { |
0 |
0 |
0 |
| if (items > 0 && PP_STATE) { |
0 |
0 |
0 |
|
| 27 |
|
| STRLEN kl; |
| 28 |
0 |
| const char *k = SvPV_const(ST(items - 1), kl); |
| 29 |
0 |
| e = hv_fetch(PP_STATE, k, (I32)kl, 0); |
| 30 |
|
| } |
| 31 |
0 |
▶ | RETVAL = (e && *e) ? newSVsv(*e) : newSV(0); |
Branch: 2 branches
| Branch | True | False | Total |
| RETVAL = (e && *e) ? newSVsv(*e) : newSV(0); |
0 |
0 |
0 |
| RETVAL = (e && *e) ? newSVsv(*e) : newSV(0); |
0 |
0 |
0 |
|
| 32 |
|
| } |
| 33 |
|
| OUTPUT: |
| 34 |
|
| RETVAL |
| 35 |
|
| |
| 36 |
|
| # The recovery digest: case folded, grouping stripped, lowercase sha256 |
| 37 |
|
| # hex - pwd_token_digest's wire form. |
| 38 |
|
| SV * |
| 39 |
|
| _recovery_digest(code) |
| 40 |
|
| SV *code |
| 41 |
|
| CODE: |
| 42 |
0 |
| RETVAL = pp_recovery_digest(aTHX_ code); |
| 43 |
|
| OUTPUT: |
| 44 |
|
| RETVAL |