]> Dogcows Code - chaz/p5-File-KDBX/blobdiff - lib/File/KDBX/Loader.pm
Add recursive transactions
[chaz/p5-File-KDBX] / lib / File / KDBX / Loader.pm
index 844f038098e8426518b1f77f5d2dd42fef4c2164..ff44832c6d92b985394083500e68a569c65d246d 100644 (file)
@@ -212,11 +212,32 @@ sub kdbx {
 
 =attr format
 
-TODO
+Get the file format used for reading the database. Normally the format is auto-detected from the data stream.
+This auto-detection works well, so there's not really a good reason to explicitly specify the format.
+Possible formats:
+
+=for :list
+* C<V3>
+* C<V4>
+* C<KDB>
+* C<XML>
+* C<Raw>
 
 =cut
 
 sub format { $_[0]->{format} }
+
+=attr inner_format
+
+Get the format of the data inside the KDBX envelope. This only applies to C<V3> and C<V4> formats. Possible
+formats:
+
+=for :list
+* C<XML> - Read the database groups and entries as XML (default)
+* C<Raw> - Read parsing and store the result in L<File::KDBX/raw>
+
+=cut
+
 sub inner_format { $_[0]->{inner_format} // 'XML' }
 
 =attr min_version
@@ -303,7 +324,17 @@ sub _read {
 
     my $headers = $self->_read_headers($fh);
 
-    $self->_read_body($fh, $key, "$magic$headers");
+    eval {
+        $self->_read_body($fh, $key, "$magic$headers");
+    };
+    if (my $err = $@) {
+        throw "Failed to load KDBX file: $err",
+            error               => $err,
+            compression_error   => $IO::Uncompress::Gunzip::GunzipError,
+            crypt_error         => $File::KDBX::IO::Crypt::ERROR,
+            hash_error          => $File::KDBX::IO::HashBLock::ERROR,
+            hmac_error          => $File::KDBX::IO::HmacBLock::ERROR;
+    }
 }
 
 sub _read_headers {
@@ -336,3 +367,9 @@ sub _read_inner_body {
 }
 
 1;
+__END__
+
+=head1 DESCRIPTION
+
+
+=cut
This page took 0.021114 seconds and 4 git commands to generate.