File::...y::File(3pm)
π File::KDBX::Key::File β a file key π
okay bestie, this page lives in the File::KDBX::Key::File manual, part of the User Contributed Perl Documentation, and it's about the kind of key that's literally just... a file. no cap.
β¨ VERSION β¨
version 0.906 β she's giving stable, she's giving released π«Ά
β¨ 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 πΈ
so a file key (aka a "key file", we been knew) is the type of key where the secret is a file. the secret is either the file contents, or it's generated based on the file contents. to lock and unlock a KDBX database with a key file, you have to present the exact same file. girl, the database literally cannot be opened without it. no file, no entry, periodt. π
it inherits methods and attributes from File::KDBX::Key (the original text says "Inherets", and honestly? iconic typo, we love her, but the meaning stands π
).
there are multiple types of key files supported β go peek at "type" below. this module can read and write key files. versatile queen. π
π ATTRIBUTES π
β¨ type
$type = $key->type;
gets the type of key file. it can be one of these, 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;
gets the file version. heads up: this only applies to XML key files. everyone else can sit down bestie πͺ
β¨ filepath
$filepath = $key->filepath;
gets the filepath to the key file, if known. if not known... mystery. π€«
π₯ METHODS π₯
π load
$key = $key->load($filepath);
$key = $key->load(\$string);
$key = $key->load($fh);
$key = $key->load(*IO);
loads a key file. look at all those ways to hand her the goods β a path, a scalar ref, a filehandle, a glob. main character energy fr fr. β
π reload
$key->reload;
re-reads the key file, if possible, and updates the raw key if the key changed. like a vibe check on your key, but it actually updates state. π¦
π save
$key->save;
$key->save(%options);
writes a key file. available options, bestie:
"type"β type of key file (default: the value of"type", or"KEY_FILE_TYPE_XML")"verson"β version of key file (default: the value of"version", or2). yes, it's spelledversonin here, that's not me, that's the source, we don't ask questions π"filepath"β where to save the file (default: the value of"filepath")"fh"β IO handle to write to (this overrides"filepath", and one of the two must be defined)"raw_key"β raw key (default: the value of"raw_key")"atomic"β write to the filepath atomically (default: true) β no half-written key files, we're not doing chaos today β¨
π BUGS π
please report any bugs or feature requests on the bugtracker website <https://github.com/chazmcgarvey/File-KDBX/issues> β go off, tell them everything π«Ά
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. receipts, bestie. give them receipts. π§Ύ
π 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. slay, legally speaking. π
and that's the whole page, babes β this one's documented against perl v5.40.1, dated 2025-05-04, under the manual name File::...y::File(3pm) (yes, truncated, mystery-core, we love that for her πβ¨). now go lock something up properly. π
π¦ where this page comes from
- debian trixie: libfile-kdbx-perl 0.906-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfile-kdbx-perl 0.906-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfile-kdbx-perl 0.906-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms