| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Mojolicious::Plugin::Passphrase; | 
| 2 |  |  |  |  |  |  | $Mojolicious::Plugin::Passphrase::VERSION = '0.002'; | 
| 3 | 1 |  |  | 1 |  | 859 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 29 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 5 | use Mojo::Base 'Mojolicious::Plugin'; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 14 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 1 |  |  | 1 |  | 761 | use Crypt::Passphrase; | 
|  | 1 |  |  |  |  | 1225 |  | 
|  | 1 |  |  |  |  | 232 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub register { | 
| 11 | 1 |  |  | 1 | 1 | 50 | my (undef, $app, $config) = @_; | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 1 |  |  |  |  | 2 | my $passphrase = Crypt::Passphrase->new(%{$config}); | 
|  | 1 |  |  |  |  | 6 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | $app->helper(hash_password => sub { | 
| 16 | 5 |  |  | 5 |  | 204954 | my ($c, @args) = @_; | 
| 17 | 5 |  |  |  |  | 33 | return $passphrase->hash_password(@args); | 
| 18 | 1 |  |  |  |  | 5962 | }); | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | $app->helper(verify_password => sub { | 
| 21 | 2 |  |  | 2 |  | 759 | my ($c, @args) = @_; | 
| 22 | 2 |  |  |  |  | 9 | return $passphrase->verify_password(@args); | 
| 23 | 1 |  |  |  |  | 174 | }); | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | $app->helper(password_needs_rehash => sub { | 
| 26 | 0 |  |  | 0 |  | 0 | my ($c, @args) = @_; | 
| 27 | 0 |  |  |  |  | 0 | return $passphrase->needs_rehash(@args); | 
| 28 | 1 |  |  |  |  | 92 | }); | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 1 |  |  |  |  | 85 | return; | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | 1; | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | #ABSTRACT: Securely hash and validate your passwords. | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | __END__ |