]> Dogcows Code - chaz/p5-File-KDBX/blob - lib/File/KDBX/Key/Password.pm
ba46f99b501d56a11dd6ebcb171f593726881eac
[chaz/p5-File-KDBX] / lib / File / KDBX / Key / Password.pm
1 package File::KDBX::Key::Password;
2 # ABSTRACT: A password key
3
4 use warnings;
5 use strict;
6
7 use Crypt::Digest qw(digest_data);
8 use Encode qw(encode);
9 use File::KDBX::Error;
10 use File::KDBX::Util qw(erase);
11 use namespace::clean;
12
13 use parent 'File::KDBX::Key';
14
15 our $VERSION = '999.999'; # VERSION
16
17 sub init {
18 my $self = shift;
19 my $primitive = shift // throw 'Missing key primitive';
20
21 $self->_set_raw_key(digest_data('SHA256', encode('UTF-8', $primitive)));
22
23 return $self->hide;
24 }
25
26 1;
27 __END__
28
29 =head1 SYNOPSIS
30
31 use File::KDBX::Key::Password;
32
33 my $key = File::KDBX::Key::Password->new($password);
34
35 =head1 DESCRIPTION
36
37 A password key is as simple as it sounds. It's just a password or passphrase.
38
39 Inherets methods and attributes from L<File::KDBX::Key>.
40
41 =cut
This page took 0.034645 seconds and 3 git commands to generate.