File Coverage

blib/lib/OpusVL/Preferences/Schema.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1              
2             package OpusVL::Preferences::Schema;
3              
4              
5 2     2   3211 use Moose;
  2         786086  
  2         24  
6 2     2   13611 use namespace::autoclean;
  2         11397  
  2         8  
7 2     2   641 use OpusVL::SimpleCrypto;
  0            
  0            
8              
9             extends 'DBIx::Class::Schema';
10              
11             has encryption_key => (is => 'rw', isa => 'Str');
12             has encryption_salt => (is => 'rw', isa => 'Str');
13             has encryption_client => (is => 'ro', lazy => 1, builder => '_build_encryption_client');
14              
15             sub _build_encryption_client
16             {
17             my $self = shift;
18             return undef unless $self->encryption_salt && $self->encryption_key;
19             my $crypto = OpusVL::SimpleCrypto->new({
20             key_string => $self->encryption_key,
21             deterministic_salt_string => $self->encryption_salt,
22             });
23             return $crypto;
24             }
25              
26              
27             __PACKAGE__->load_namespaces;
28              
29             __PACKAGE__->meta->make_immutable(inline_constructor => 0);
30              
31             1;
32              
33             __END__
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             OpusVL::Preferences::Schema
42              
43             =head1 VERSION
44              
45             version 0.27
46              
47             =head1 SYNOPSIS
48              
49             This is the DBIx::Class schema for the Preferences module.
50              
51             =head1 ATTRIBUTES
52              
53             =head2 encryption_key
54              
55             An Encryption key to use for symmetric cryptography of selected fields.
56              
57             This will be used in the L<OpusVL::SimpleCrypto> module, see that for
58             how to generate keys.
59              
60             =head2 encryption_salt
61              
62             A salt to use for symmetric cryptography of selected fields.
63              
64             This will be used in the L<OpusVL::SimpleCrypto> module, see that for
65             how to generate keys and salt.
66              
67             =head2 encryption_client
68              
69             The client to perform encryption. If the key or salt are not provided
70             this will return undef.
71              
72             =head1 AUTHOR
73              
74             OpusVL - www.opusvl.com
75              
76             =head1 COPYRIGHT AND LICENSE
77              
78             This software is copyright (c) 2011 by OpusVL - www.opusvl.com.
79              
80             This is free software; you can redistribute it and/or modify it under
81             the same terms as the Perl 5 programming language system itself.
82              
83             =cut