Commits

Marcin Kasperski committed ddb486c

Preliminary naming support.

Comments (0)

Files changed (18)

 \.bak$
 ^META\.
 ^Makefile\.PL
-^Passwd-Keyring-Gnome-.*\.tar\.gz$
+^Passwd-Keyring-.*\.tar\.gz$
 ^Makefile$
 ^pm_to_blib$
 use strict;
 use warnings;
 use Module::Build;
-use ExtUtils::PkgConfig;
-
-my %gnome_keyring_pkg_info = ExtUtils::PkgConfig->find("gnome-keyring-1");
 
 my $builder = Module::Build->new(
-    module_name         => 'Passwd::Keyring::Gnome',
+    module_name         => 'Passwd::Keyring::OSXKeychain',
     license             => 'perl',
     dynamic_config      => 1,
 
-    needs_compiler => 1,
-    extra_compiler_flags => $gnome_keyring_pkg_info{cflags},
-    extra_linker_flags => $gnome_keyring_pkg_info{libs},
-
     build_requires => {
         'Module::Build' => '0.19', # xs
-        'ExtUtils::CBuilder' => 0,
         'Test::More' => 0,
         'Test::Pod::Coverage' => '1.0.8',
     },
     },
 
     create_makefile_pl => 'traditional',
-    add_to_cleanup      => [ 'Passwd-Keyring-Gnome-*' ],
+    add_to_cleanup      => [ 'Passwd-Keyring-OSXKeychain-*' ],
 
     create_readme       => 1,
     dist_author         => q{Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>},
-    dist_version_from   => 'lib/Passwd/Keyring/Gnome.pm',
+    dist_version_from   => 'lib/Passwd/Keyring/OSXKeychain.pm',
     meta_merge => {
-        keywords => [ qw/ passwords security secure-storage keyring GNOME seahorse gnome-keyring / ],
+        keywords => [ qw/ passwords security secure-storage keyring Mac OSX keychain keyring / ],
         resources => {
             license     => 'http://dev.perl.org/licenses/',
-            homepage    => 'http://bitbucket.org/Mekk/perl-keyring-gnome',
-            repository => 'http://bitbucket.org/Mekk/perl-keyring-gnome',
-            bugtracker => 'https://bitbucket.org/Mekk/perl-keyring-gnome/issues',
+            homepage    => 'http://bitbucket.org/Mekk/perl-keyring-osxkeychain',
+            repository => 'http://bitbucket.org/Mekk/perl-keyring-osxkeychain',
+            bugtracker => 'https://bitbucket.org/Mekk/perl-keyring-osxkeychain/issues',
         },
     },
 );
-Passwd::Keyring::Gnome
+Passwd::Keyring::OSXKeychain
 
 Passwd::Keyring is about using secure storage for passwords
 and other credentials used in perl scripts and applications.
 
-Passwd::Keyring::Gnome uses GNOME Keyring API to securely
-preserve passwords and is available to people using GNOME 
-desktop environment.
+Passwd::Keyring::OSXKeychain uses OSX/Keychain (via /usr/bin/security
+program) to securely preserve passwords and is available to people
+using Mac OS/X desktop environment.
 
 INSTALLATION
 
 After installing, you can find documentation for this module with the
 perldoc command.
 
-    perldoc Keyring::Gnome
+    perldoc Keyring::OSXKeychain
 
 You can also look for information at:
 
 Build.PL
 Changes
 INSTALL
-lib/Passwd/Keyring/Gnome.pm
-lib/Passwd/Keyring/Gnome.xs
+lib/Passwd/Keyring/OSXKeychain.pm
+lib/Passwd/Keyring/OSXKeychain.xs
 Makefile.PL
 MANIFEST			This list of files
 META.json
 ^MANIFEST\.SKIP
 
 # Avoid archives of this distribution
-\bPasswd-Keyring-Gnome-[\d\.\_]+
+\bPasswd-Keyring-OSXKeychain-[\d\.\_]+
 
 # Repo-related
 ^\.hg
 ^make_release\.pl
 
 # Produced
-^lib/Passwd/Keyring/Gnome\.[co]$
+^lib/Passwd/Keyring/OSXKeychain\.[co]$
 .lwpcookies
 cover_db
 pod2htm*.tmp
-Passwd-Keyring-Gnome-*
+Passwd-Keyring-*

lib/Passwd/Keyring/OSXKeychain.pm

-package Passwd::Keyring::Gnome;
+package Passwd::Keyring::OSXKeychain;
 
 use warnings;
 use strict;
 
 =head1 NAME
 
-Passwd::Keyring::Gnome - Password storage implementation based on GNOME Keyring.
+Passwd::Keyring::OSXKeychain - Password storage implementation based on OSX/Keychain.
 
 =head1 VERSION
 
 
 our $VERSION = '0.2502';
 
-bootstrap Passwd::Keyring::Gnome $VERSION;
+bootstrap Passwd::Keyring::OSXKeychain $VERSION;
 
 =head1 SYNOPSIS
 
-Gnome Keyring based implementation of L<Keyring>. Provide secure
+OSXKeychain Keyring based implementation of L<Keyring>. Provide secure
 storage for passwords and similar sensitive data.
 
-    use Passwd::Keyring::Gnome;
+    use Passwd::Keyring::OSXKeychain;
 
-    my $keyring = Passwd::Keyring::Gnome->new(
+    my $keyring = Passwd::Keyring::OSXKeychain->new(
          app=>"blahblah scraper",
          group=>"Johnny web scrapers",
     );
 
 =head2 new(app=>'app name', group=>'passwords folder')
 
-Initializes the processing. Croaks if gnome keyring does not 
+Initializes the processing. Croaks if osxkeychain keyring does not 
 seem to be available.
 
 Handled named parameters: 
     bless $self;
 
     # TODO: catch and rethrow exceptions
-    my $name = Passwd::Keyring::Gnome::_get_default_keyring_name();
-    croak ("Gnome Keyring seems unavailable") unless $name;
+    my $name = Passwd::Keyring::OSXKeychain::_get_default_keyring_name();
+    croak ("OSXKeychain Keyring seems unavailable") unless $name;
 
     return $self;
 }
 
 sub set_password {
     my ($self, $user_name, $user_password, $domain) = @_;
-    Passwd::Keyring::Gnome::_set_password($user_name, $user_password, $domain,
+    Passwd::Keyring::OSXKeychain::_set_password($user_name, $user_password, $domain,
                                           $self->{app}, $self->{group});
 }
 
 
 sub get_password {
     my ($self, $user_name, $domain) = @_;
-    my $pwd = Passwd::Keyring::Gnome::_get_password($user_name, $domain,
+    my $pwd = Passwd::Keyring::OSXKeychain::_get_password($user_name, $domain,
                                                     $self->{app}, $self->{group});
     #return undef if (!defined($pwd)) or $pwd eq "";
     return $pwd;
 
 sub clear_password {
     my ($self, $user_name, $domain) = @_;
-    return Passwd::Keyring::Gnome::_clear_password(
+    return Passwd::Keyring::OSXKeychain::_clear_password(
         $user_name, $domain, $self->{app}, $self->{group});
 }
 
 =head1 BUGS
 
 Please report any bugs or feature requests to 
-issue tracker at L<https://bitbucket.org/Mekk/perl-keyring-gnome>.
+issue tracker at L<https://bitbucket.org/Mekk/perl-keyring-osxkeychain>.
 
 =head1 SUPPORT
 
 You can find documentation for this module with the perldoc command.
 
-    perldoc Passwd::Keyring::Gnome
+    perldoc Passwd::Keyring::OSXKeychain
 
 You can also look for information at:
 
-L<http://search.cpan.org/~mekk/Passwd-Keyring-Gnome/>
+L<http://search.cpan.org/~mekk/Passwd-Keyring-OSXKeychain/>
 
 Source code is tracked at:
 
-L<https://bitbucket.org/Mekk/perl-keyring-gnome>
+L<https://bitbucket.org/Mekk/perl-keyring-osxkeychain>
 
 =head1 LICENSE AND COPYRIGHT
 
 =cut
 
 
-1; # End of Passwd::Keyring::Gnome
+1; # End of Passwd::Keyring::OSXKeychain
 
 use Test::More tests => 1;
 
 BEGIN {
-    use_ok( 'Passwd::Keyring::Gnome' ) || print "Bail out!\n";
+    use_ok( 'Passwd::Keyring::OSXKeychain' ) || print "Bail out!\n";
 }
 
-diag( "Testing Passwd::Keyring::Gnome $Passwd::Keyring::Gnome::VERSION, Perl $], $^X" );
+diag( "Testing Passwd::Keyring::OSXKeychain $Passwd::Keyring::OSXKeychain::VERSION, Perl $], $^X" );
 diag( "Consider spawning  seahorse  and checking whether all passwords are properly wiped after tests" );
 use warnings;
 use Test::Simple tests => 8;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
-my $ring = Passwd::Keyring::Gnome->new;
+my $ring = Passwd::Keyring::OSXKeychain->new;
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works' );
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works' );
 
 my $USER = 'John';
 my $PASSWORD = 'verysecret';
 use warnings;
 use Test::Simple tests => 2;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
-my $ring = Passwd::Keyring::Gnome->new;
+my $ring = Passwd::Keyring::OSXKeychain->new;
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works' );
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works' );
 
 ok( $ring->is_persistent eq 1, "is_persistent knows we are persistent");
 

t/03-many-sets-and-gets.t

 use warnings;
 use Test::Simple tests => 11;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
 my $PSEUDO_DOMAIN = 'my@@domain';
 my $OTHER_DOMAIN = 'other domain';
 
-my $ring = Passwd::Keyring::Gnome->new(app=>"Passwd::Keyring::Gnome", group=>"Unit tests");
+my $ring = Passwd::Keyring::OSXKeychain->new(app=>"Passwd::Keyring::OSXKeychain", group=>"Unit tests");
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works' );
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works' );
 
 $ring->set_password("Paul", "secret-Paul", $PSEUDO_DOMAIN);
 $ring->set_password("Gregory", "secret-Greg", $PSEUDO_DOMAIN);#

t/04-recovering-in-sep-prog.t

 use warnings;
 use Test::Simple tests => 13;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
 my $PSEUDO_DOMAIN = 'my@@domain';
 my $OTHER_DOMAIN = 'other domain';
 
-my $ring = Passwd::Keyring::Gnome->new(app=>"Passwd::Keyring::Gnome", group=>"Unit tests");
+my $ring = Passwd::Keyring::OSXKeychain->new(app=>"Passwd::Keyring::OSXKeychain", group=>"Unit tests");
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works' );
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works' );
 
 ok( ! defined($ring->get_password("Paul", $PSEUDO_DOMAIN)), "get works");
 

t/05-many-sets-and-gets-with-name.t

 use warnings;
 use Test::Simple tests => 20;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
 my $DOMAIN_A = 'my@@domain';
 my $DOMAIN_B = 'bum trala la';
 my $PWD2 = "secret-Greg";
 my $PWD4 = "secret-Duke";
 
-my $ring = Passwd::Keyring::Gnome->new(app=>"Passwd::Keyring::Gnome", group=>"Unit tests (secrets)");
+my $ring = Passwd::Keyring::OSXKeychain->new(app=>"Passwd::Keyring::OSXKeychain", group=>"Unit tests (secrets)");
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works' );
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works' );
 
 $ring->set_password($USER1, $PWD1, $DOMAIN_B);
 $ring->set_password($USER2, $PWD2, $DOMAIN_B);#

t/06-recovering-with-app-change.t

 use warnings;
 use Test::More tests => 16;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
 my $USER = "Herakliusz";
 my $DOMAIN = "test domain";
 my @cleanups;
 
 {
-    my $ring = Passwd::Keyring::Gnome->new(app=>$APP1, group=>$GROUP1);
+    my $ring = Passwd::Keyring::OSXKeychain->new(app=>$APP1, group=>$GROUP1);
 
-    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works' );
+    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works' );
 
     ok( ! defined($ring->get_password($USER, $DOMAIN)), "initially unset");
 
 # Another object with the same app and group
 
 {
-    my $ring = Passwd::Keyring::Gnome->new(app=>$APP1, group=>$GROUP1);
+    my $ring = Passwd::Keyring::OSXKeychain->new(app=>$APP1, group=>$GROUP1);
 
-    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome', 'second new() works' );
+    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain', 'second new() works' );
 
     ok( $ring->get_password($USER, $DOMAIN) eq $PWD, "get from another ring with the same data works");
 }
 
 # Only app changes
 {
-    my $ring = Passwd::Keyring::Gnome->new(app=>$APP2, group=>$GROUP1);
+    my $ring = Passwd::Keyring::OSXKeychain->new(app=>$APP2, group=>$GROUP1);
 
-    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome', 'third new() works' );
+    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain', 'third new() works' );
 
     ok( $ring->get_password($USER, $DOMAIN) eq $PWD, "get from another ring with changed app but same group works");
 }
 # Only group changes
 my $sec_ring;
 {
-    my $ring = Passwd::Keyring::Gnome->new(app=>$APP1, group=>$GROUP2);
+    my $ring = Passwd::Keyring::OSXKeychain->new(app=>$APP1, group=>$GROUP2);
 
-    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome', 'third new() works' );
+    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain', 'third new() works' );
 
     ok( ! defined($ring->get_password($USER, $DOMAIN)), "changing group forces another password");
 
 
 # App and group change
 {
-    my $ring = Passwd::Keyring::Gnome->new(app=>$APP2, group=>$GROUP3);
+    my $ring = Passwd::Keyring::OSXKeychain->new(app=>$APP2, group=>$GROUP3);
 
-    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome', 'third new() works' );
+    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain', 'third new() works' );
 
     ok( ! defined($ring->get_password($USER, $DOMAIN)), "changing group and app forces another password");
 
 
 # Re-reading original to check whether it was properly kept
 {
-    my $ring = Passwd::Keyring::Gnome->new(app=>$APP1, group=>$GROUP1);
+    my $ring = Passwd::Keyring::OSXKeychain->new(app=>$APP1, group=>$GROUP1);
 
-    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome', 'second new() works' );
+    ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain', 'second new() works' );
 
     ok( $ring->get_password($USER, $DOMAIN) eq $PWD, "get original after changes in other group works");
 }
 use warnings;
 use Test::Simple tests => 4;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
 my $UGLY_NAME = "Joh ## no ^^ »ąćęłóśż«";
 my $UGLY_PWD =  "«tajne hasło»";
 my $UGLY_DOMAIN = '«do»–main';
 
-my $ring = Passwd::Keyring::Gnome->new(app=>"Passwd::Gnome::Keyring unit tests", group=>"Ugly chars");
+my $ring = Passwd::Keyring::OSXKeychain->new(app=>"Passwd::OSXKeychain::Keyring unit tests", group=>"Ugly chars");
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works' );
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works' );
 
 $ring->set_password($UGLY_NAME, $UGLY_PWD, $UGLY_DOMAIN);
 

t/08-verylong-params.t

 use warnings;
 use Test::Simple tests => 4;
 
-use Passwd::Keyring::Gnome;
+use Passwd::Keyring::OSXKeychain;
 
-my $APP = "Passwd::Gnome::Keyring unit test 08 ";
+my $APP = "Passwd::OSXKeychain::Keyring unit test 08 ";
 $APP .= "X" x (256 - length($APP));
-my $GROUP = "Passwd::Gnome::Keyring unit tests ";
+my $GROUP = "Passwd::OSXKeychain::Keyring unit tests ";
 $GROUP .= "X" x (256 - length($GROUP));
 
 my $USER = "A" x 256;
 my $PWD =  "B" x 256;
 my $DOMAIN = 'C' x 256;
 
-my $ring = Passwd::Keyring::Gnome->new(
+my $ring = Passwd::Keyring::OSXKeychain->new(
     app=>$APP, group=>$GROUP);
 
-ok( defined($ring) && ref $ring eq 'Passwd::Keyring::Gnome',   'new() works with long params' );
+ok( defined($ring) && ref $ring eq 'Passwd::Keyring::OSXKeychain',   'new() works with long params' );
 
 $ring->set_password($USER, $PWD, $DOMAIN);
 
     "placeholder date/time"       => qr(Date/time)
   );
 
-  module_boilerplate_ok('lib/Passwd/Keyring/Gnome.pm');
+  module_boilerplate_ok('lib/Passwd/Keyring/OSXKeychain.pm');
 
 
 }
 VERSION = "0.2502"
 
 UPDATED_FILES = [
-    "lib/Passwd/Keyring/Gnome.pm",
+    "lib/Passwd/Keyring/OSXKeychain.pm",
     ]
 
 def _patch_perl_files(ui, new_version_no):