use Encode qw(encode);
use File::KDBX::Constants qw(:header :cipher :random_stream :icon);
use File::KDBX::Error;
-use File::KDBX::Util qw(:empty :io :uuid load_optional);
+use File::KDBX::Util qw(:class :empty :io :uuid load_optional);
use File::KDBX;
use Ref::Util qw(is_arrayref is_hashref);
use Scalar::Util qw(looks_like_number);
use boolean;
use namespace::clean;
-use parent 'File::KDBX::Loader';
+extends 'File::KDBX::Loader';
our $VERSION = '999.999'; # VERSION
}
}
- for my $entry ($kdbx->find_entries({
+ $kdbx->entries
+ ->grep({
title => 'Meta-Info',
username => 'SYSTEM',
url => '$',
icon_id => 0,
-nonempty => 'notes',
- })) {
- _read_meta_stream($kdbx, $entry);
- $entry->remove;
- }
+ })
+ ->each(sub {
+ _read_meta_stream($kdbx, $_);
+ $_->remove; # TODO do not signal
+ });
return $kdbx;
}
read_all $fh, $buf, 5 or goto PARSE_ERROR;
my ($group_id, $expanded) = unpack('L< C', $buf);
my $uuid = _decode_uuid($group_id) // next;
- my ($group) = $kdbx->find_groups({uuid => $uuid});
+ my $group = $kdbx->groups->grep({uuid => $uuid})->next;
$group->is_expanded($expanded) if $group;
}
}
read_all $fh, $buf, 20 or goto PARSE_ERROR;
my ($uuid, $icon_index) = unpack('a16 L<', $buf);
next if !$icons[$icon_index];
- my ($entry) = $kdbx->find_entries({uuid => $uuid});
+ my $entry = $kdbx->entries->grep({uuid => $uuid})->next;
$entry->custom_icon_uuid($icons[$icon_index]) if $entry;
}
for (my $i = 0; $i < $num_groups; ++$i) {
my ($group_id, $icon_index) = unpack('L<2', $buf);
next if !$icons[$icon_index];
my $uuid = _decode_uuid($group_id) // next;
- my ($group) = $kdbx->find_groups({uuid => $uuid});
+ my $group = $kdbx->groups->grep({uuid => $uuid})->next;
$group->custom_icon_uuid($icons[$icon_index]) if $group;
}
}
$meta->{settings_changed} = _decode_datetime($from->{settings_changed});
while (my ($key, $value) = each %{$from->{custom_icons} || {}}) {
- $meta->{custom_icons}{$key} = {value => $value};
+ push @{$meta->{custom_icons} //= []}, {uuid => $key, data => $value};
}
while (my ($key, $value) = each %{$from->{custom_data} || {}}) {
$meta->{custom_data}{$key} = {value => $value};