File-KDBX
view release on metacpan or search on metacpan
lib/File/KDBX/Entry.pm view on Meta::CPAN
package File::KDBX::Entry;
# ABSTRACT: A KDBX database entry
use warnings;
use strict;
use Crypt::Misc 0.049 qw(decode_b64 encode_b32r);
use Devel::GlobalDestruction;
use Encode qw(encode);
use File::KDBX::Constants qw(:history :icon);
use File::KDBX::Error;
use File::KDBX::Util qw(:assert :class :coercion :erase :function :uri generate_uuid load_optional);
use Hash::Util::FieldHash;
use List::Util qw(any first sum0);
use Ref::Util qw(is_coderef is_hashref is_plain_hashref);
use Scalar::Util qw(blessed looks_like_number);
use Storable qw(dclone);
use Time::Piece 1.33;
use boolean;
use namespace::clean;
extends 'File::KDBX::Object';
our $VERSION = '0.906'; # VERSION
my $PLACEHOLDER_MAX_DEPTH = 10;
my %PLACEHOLDERS;
my %STANDARD_STRINGS = map { $_ => 1 } qw(Title UserName Password URL Notes);
sub uuid {
my $self = shift;
if (@_ || !defined $self->{uuid}) {
my %args = @_ % 2 == 1 ? (uuid => shift, @_) : @_;
my $old_uuid = $self->{uuid};
my $uuid = $self->{uuid} = delete $args{uuid} // generate_uuid;
for my $entry (@{$self->history}) {
$entry->{uuid} = $uuid;
}
$self->_signal('uuid.changed', $uuid, $old_uuid) if defined $old_uuid && $self->is_current;
}
$self->{uuid};
}
# has uuid => sub { generate_uuid(printable => 1) };
has icon_id => ICON_PASSWORD, coerce => \&to_icon_constant;
has custom_icon_uuid => undef, coerce => \&to_uuid;
has foreground_color => '', coerce => \&to_string;
has background_color => '', coerce => \&to_string;
has override_url => '', coerce => \&to_string;
has tags => '', coerce => \&to_string;
has auto_type => {};
has previous_parent_group => undef, coerce => \&to_uuid;
has quality_check => true, coerce => \&to_bool;
has strings => {};
has binaries => {};
has times => {};
# has custom_data => {};
# has history => [];
has last_modification_time => sub { gmtime }, store => 'times', coerce => \&to_time;
has creation_time => sub { gmtime }, store => 'times', coerce => \&to_time;
has last_access_time => sub { gmtime }, store => 'times', coerce => \&to_time;
has expiry_time => sub { gmtime }, store => 'times', coerce => \&to_time;
has expires => false, store => 'times', coerce => \&to_bool;
has usage_count => 0, store => 'times', coerce => \&to_number;
has location_changed => sub { gmtime }, store => 'times', coerce => \&to_time;
# has 'auto_type.auto_type_enabled' => true, coerce => \&to_bool;
has 'auto_type_obfuscation' => 0, path => 'auto_type.data_transfer_obfuscation',
coerce => \&to_number;
has 'auto_type_default_sequence' => '{USERNAME}{TAB}{PASSWORD}{ENTER}',
path => 'auto_type.default_sequence', coerce => \&to_string;
has 'auto_type_associations' => [], path => 'auto_type.associations';
( run in 0.675 second using v1.01-cache-2.11-cpan-39bf76dae61 )