Provided by: libfile-kdbx-perl_0.906-2_all bug

NAME

       File::KDBX::Key::File - A file key

VERSION

       version 0.906

SYNOPSIS

           use File::KDBX::Constants qw(:key_file);
           use File::KDBX::Key::File;

           ### Create a key file:

           my $key = File::KDBX::Key::File->new(
               filepath    => 'path/to/file.keyx',
               type        => KEY_FILE_TYPE_XML,   # optional
               version     => 2,                   # optional
               raw_key     => $raw_key,            # optional - leave undefined to generate a random key
           );
           $key->save;

           ### Use a key file:

           my $key2 = File::KDBX::Key::File->new('path/to/file.keyx');
           # OR
           my $key2 = File::KDBX::Key::File->new(\$secret);
           # OR
           my $key2 = File::KDBX::Key::File->new($fh); # or *IO

DESCRIPTION

       A file key (or "key file") is the type of key where the secret is a file. The secret is
       either the file contents or is generated based on the file contents. In order to lock and
       unlock a KDBX database with a key file, the same file must be presented. The database
       cannot be opened without the file.

       Inherets methods and attributes from File::KDBX::Key.

       There are multiple types of key files supported. See "type". This module can read and
       write key files.

ATTRIBUTES

   type
           $type = $key->type;

       Get the type of key file. Can be one of from ":key_file" in File::KDBX::Constants:

       •   "KEY_FILE_TYPE_BINARY"

       •   "KEY_FILE_TYPE_HEX"

       •   "KEY_FILE_TYPE_XML"

       •   "KEY_FILE_TYPE_HASHED"

   version
           $version = $key->version;

       Get the file version. Only applies to XML key files.

   filepath
           $filepath = $key->filepath;

       Get the filepath to the key file, if known.

METHODS

   load
           $key = $key->load($filepath);
           $key = $key->load(\$string);
           $key = $key->load($fh);
           $key = $key->load(*IO);

       Load a key file.

   reload
           $key->reload;

       Re-read the key file, if possible, and update the raw key if the key changed.

   save
           $key->save;
           $key->save(%options);

       Write a key file. Available options:

       •   "type" - Type of key file (default: value of "type", or "KEY_FILE_TYPE_XML")

       •   "verson" - Version of key file (default: value of "version", or 2)

       •   "filepath" - Where to save the file (default: value of "filepath")

       •   "fh" - IO handle to write to (overrides "filepath", one of which must be defined)

       •   "raw_key" - Raw key (default: value of "raw_key")

       •   "atomic" - Write to the filepath atomically (default: true)

BUGS

       Please report any bugs or feature requests on the bugtracker website
       <https://github.com/chazmcgarvey/File-KDBX/issues>

       When submitting a bug or request, please include a test-file or a patch to an existing
       test-file that illustrates the bug or desired feature.

AUTHOR

       Charles McGarvey <ccm@cpan.org>

COPYRIGHT AND LICENSE

       This software is copyright (c) 2022 by Charles McGarvey.

       This is free software; you can redistribute it and/or modify it under the same terms as
       the Perl 5 programming language system itself.