NAME
Mojolicious::Plugin::Credentials - A credentials store in mojo
VERSION
version 0.005
SYNOPSIS
# Mojolicious::Lite
plugin Credentials => { keys => \@keys };
my $password = app->credentials->get('google');
# Mojolicious
sub startup {
my $self = shift;
$self->plugin(Credentials => { keys => \@keys });
}
DESCRIPTION
This module plugs Crypt::Credentials into your Mojolicious application. This allows you to store credentials using only one key.
Credentials can by edited using the credentials mojo command (e.g. ./myapp.pl credentials edit google
).
CONFIGURATION
It takes two arguments, both optional.
keys
This is the key used to encrypt the credentials. If not given this will use the environmental variable
MOJO_CREDENTIALS_KEYS
(split on colons), and otherwise it will bail out. In both cases the key will be expected in hexadecimal form.Multiple keys are supported to aid key rotation, one would typically add the new key to the injected list, switch the store to the new key and only then remove the old key from the injection.
dir
This is the directory of the credentials. If not given it will default to
$MOJO_CREDENTIALS_DIR
or if that isn't defined$MOJO_HOME/credentials
.
HELPERS
credentials
This will return the appropriately configured Crypt::Credentials
object.
my ($username, $password) = credentials->get_yaml('google')->@{'username', 'password'};
AUTHOR
Leon Timmermans <fawaka@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.