r61104 - in /trunk/libauthen-bitcard-perl: ./ debian/ debian/source/ lib/Authen/ lib/Sau/ t/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Tue Aug 3 03:34:34 UTC 2010


Author: ansgar-guest
Date: Tue Aug  3 03:33:31 2010
New Revision: 61104

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=61104
Log:
* New upstream release (0.87).
* New upstream release (0.89).
  + Now licensed under Apache-2.0.
* debian/copyright: Update for new upstream release, formatting changes for
  current DEP-5 proposal.
* Remove (build-)dep on libdigest-sha1-perl.
* Add (build-)dep on libjson-perl.
* Add build-dep on libtest-script-perl.
* Use source format 3.0 (quilt).
* Bump Standards-Version to 3.9.1.
* Add myself to Uploaders.

Added:
    trunk/libauthen-bitcard-perl/debian/source/
    trunk/libauthen-bitcard-perl/debian/source/format
    trunk/libauthen-bitcard-perl/dist.ini
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/dist.ini
    trunk/libauthen-bitcard-perl/t/00-compile.t
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/00-compile.t
    trunk/libauthen-bitcard-perl/t/11login.nt
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/11login.nt
    trunk/libauthen-bitcard-perl/t/12ticket.nt
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/12ticket.nt
    trunk/libauthen-bitcard-perl/t/14session.nt
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/14session.nt
    trunk/libauthen-bitcard-perl/t/18attributes.nt
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/18attributes.nt
    trunk/libauthen-bitcard-perl/t/coverage
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/coverage
    trunk/libauthen-bitcard-perl/t/release-dist-manifest.t
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/release-dist-manifest.t
    trunk/libauthen-bitcard-perl/t/release-distmeta.t
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/release-distmeta.t
    trunk/libauthen-bitcard-perl/t/release-has-version.t
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/release-has-version.t
    trunk/libauthen-bitcard-perl/t/release-pod-coverage.t
      - copied unchanged from r61103, branches/upstream/libauthen-bitcard-perl/current/t/release-pod-coverage.t
Removed:
    trunk/libauthen-bitcard-perl/NOTICE
    trunk/libauthen-bitcard-perl/lib/Sau/
Modified:
    trunk/libauthen-bitcard-perl/Changes
    trunk/libauthen-bitcard-perl/LICENSE
    trunk/libauthen-bitcard-perl/MANIFEST
    trunk/libauthen-bitcard-perl/META.yml
    trunk/libauthen-bitcard-perl/Makefile.PL
    trunk/libauthen-bitcard-perl/README
    trunk/libauthen-bitcard-perl/debian/changelog
    trunk/libauthen-bitcard-perl/debian/control
    trunk/libauthen-bitcard-perl/debian/copyright
    trunk/libauthen-bitcard-perl/debian/rules
    trunk/libauthen-bitcard-perl/lib/Authen/Bitcard.pm

Modified: trunk/libauthen-bitcard-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/Changes?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/Changes (original)
+++ trunk/libauthen-bitcard-perl/Changes Tue Aug  3 03:33:31 2010
@@ -1,3 +1,10 @@
+
+0.89    August 2, 2010
+  - Use JSON instead of JSON::XS
+  - Use Digest::SHA instead of Digest::SHA1 (RT#59919, Ansgar Burchardt)
+  - Add add_invite method
+  - Various tweaks
+
 0.87 - September 14, 2009
   - Add Class::ErrorHandler to the prereqs list
   - Update documentation

Modified: trunk/libauthen-bitcard-perl/LICENSE
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/LICENSE?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/LICENSE (original)
+++ trunk/libauthen-bitcard-perl/LICENSE Tue Aug  3 03:33:31 2010
@@ -1,3 +1,8 @@
+This software is Copyright (c) 2010 by Ask Bjørn Hansen.
+
+This is free software, licensed under:
+
+  The Apache License, Version 2.0, January 2004
 
                                  Apache License
                            Version 2.0, January 2004

Modified: trunk/libauthen-bitcard-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/MANIFEST?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/MANIFEST (original)
+++ trunk/libauthen-bitcard-perl/MANIFEST Tue Aug  3 03:33:31 2010
@@ -1,14 +1,22 @@
+Changes
+LICENSE
+MANIFEST
+META.yml
 Makefile.PL
-Changes
+README
+dist.ini
 lib/Authen/Bitcard.pm
-lib/Sau/Client.pm
-LICENSE
-Makefile.PL
-MANIFEST			This list of files
-META.yml
-NOTICE
-README
+t/00-compile.t
 t/10config.t
+t/11login.nt
 t/11verify.t
+t/12ticket.nt
 t/13podcoverage.t
+t/14session.nt
 t/15pod.t
+t/18attributes.nt
+t/coverage
+t/release-dist-manifest.t
+t/release-distmeta.t
+t/release-has-version.t
+t/release-pod-coverage.t

Modified: trunk/libauthen-bitcard-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/META.yml?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/META.yml (original)
+++ trunk/libauthen-bitcard-perl/META.yml Tue Aug  3 03:33:31 2010
@@ -1,27 +1,28 @@
---- #YAML:1.0
-name:               Authen-Bitcard
-version:            0.87
-abstract:           Bitcard authentication verification
+---
+abstract: 'Bitcard authentication verification'
 author:
-    - Ask Bjoern Hansen <ask at develooper.com>
-license:            unknown
-distribution_type:  module
+  - 'Ask Bjørn Hansen <ask at develooper.com>'
+build_requires:
+  Test::More: 0
 configure_requires:
-    ExtUtils::MakeMaker:  0
+  ExtUtils::MakeMaker: 6.31
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 4.101900, CPAN::Meta::Converter version 2.101670'
+license: apache
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: Authen-Bitcard
 requires:
-    Class::ErrorHandler:  0
-    Digest::SHA1:         0
-    HTTP::Status:         0
-    LWP::UserAgent:       0
-    Math::BigInt:         0
-    MIME::Base64:         0
-    Test::More:           0
-    URI:                  1.22
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.48
-meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+  Class::ErrorHandler: 0
+  Digest::SHA: 0
+  HTTP::Status: 0
+  JSON: 2.12
+  LWP::UserAgent: 0
+  MIME::Base64: 0
+  Math::BigInt: 0
+  URI: 1.22
+resources:
+  homepage: http://search.cpan.org/dist/Authen-Bitcard/
+  repository: http://git.develooper.com/bitcard-perl-api.git
+version: 0.89

Modified: trunk/libauthen-bitcard-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/Makefile.PL?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/Makefile.PL (original)
+++ trunk/libauthen-bitcard-perl/Makefile.PL Tue Aug  3 03:33:31 2010
@@ -1,24 +1,60 @@
+
 use strict;
 use warnings;
-use ExtUtils::MakeMaker;
 
-WriteMakefile(
-    NAME                => 'Authen::Bitcard',
-    AUTHOR              => 'Ask Bjoern Hansen <ask at develooper.com>',
-    VERSION_FROM        => 'lib/Authen/Bitcard.pm',
-    ABSTRACT_FROM       => 'lib/Authen/Bitcard.pm',
-    PL_FILES            => {},
-    PREREQ_PM => {
-                  'Test::More'     => 0,
-                  'Math::BigInt'   => 0,
-                  'MIME::Base64'   => 0,
-                  'Digest::SHA1'   => 0,
-                  'LWP::UserAgent' => 0,
-                  'HTTP::Status'   => 0,
-                  'URI'            => 1.22,
-                  'Class::ErrorHandler' => 0,
-    },
-    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+
+
+use ExtUtils::MakeMaker 6.31;
+
+
+
+my %WriteMakefileArgs = (
+  'ABSTRACT' => 'Bitcard authentication verification',
+  'AUTHOR' => 'Ask Bjørn Hansen <ask at develooper.com>',
+  'BUILD_REQUIRES' => {
+    'Test::More' => '0'
+  },
+  'CONFIGURE_REQUIRES' => {
+    'ExtUtils::MakeMaker' => '6.31'
+  },
+  'DISTNAME' => 'Authen-Bitcard',
+  'EXE_FILES' => [],
+  'LICENSE' => 'apache',
+  'NAME' => 'Authen::Bitcard',
+  'PREREQ_PM' => {
+    'Class::ErrorHandler' => '0',
+    'Digest::SHA' => '0',
+    'HTTP::Status' => '0',
+    'JSON' => '2.12',
+    'LWP::UserAgent' => '0',
+    'MIME::Base64' => '0',
+    'Math::BigInt' => '0',
+    'URI' => '1.22'
+  },
+  'VERSION' => '0.89',
+  'test' => {
+    'TESTS' => 't/*.t'
+  }
 );
 
 
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+  my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+  my $pp = $WriteMakefileArgs{PREREQ_PM};
+  for my $mod ( keys %$br ) {
+    if ( exists $pp->{$mod} ) {
+      $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+    }
+    else {
+      $pp->{$mod} = $br->{$mod};
+    }
+  }
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
+

Modified: trunk/libauthen-bitcard-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/README?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/README (original)
+++ trunk/libauthen-bitcard-perl/README Tue Aug  3 03:33:31 2010
@@ -87,7 +87,8 @@
     If the signature is successfully verified, *verify* returns a reference
     to a hash containing the following values.
 
-    * id
+    *   id
+
         The unique user id of the Bitcard user on your site. It's a 128bit
         number as a 40 byte hex value.
 
@@ -95,16 +96,20 @@
         other user data fields are optional, see "info_required" and
         "info_optional").
 
-    * username
+    *   username
+
         The unique username of the Bitcard user.
 
-    * name
+    *   name
+
         The user's display name.
 
-    * email
+    *   email
+
         The user's email address.
 
-    * ts
+    *   ts
+
         The timestamp at which the signature was generated, expressed as
         seconds since the epoch.
 
@@ -145,12 +150,21 @@
     Get/set the version of the Bitcard protocol to use. The default version
     is 3.
 
+  $bc->api_secret( $secret )
+    Get/set the api_secret (needed for some API calls, add_invite for
+    example).
+
+  $bc->add_invite
+    Returns a hashref with "invite_url" and "invite_key". Can be used for
+    "invitation only" sites where you have to login before you can access
+    the site.
+
 LICENSE
-    *Authen::Bitcard* is free software; you may redistribute it and/or
-    modify it under the same terms as Perl itself.
+    *Authen::Bitcard* is distributed under the Apache License; see the
+    LICENSE file in the distribution for details.
 
 AUTHOR & COPYRIGHT
-    Except where otherwise noted, *Authen::Bitcard* is Copyright 2004-2006
+    Except where otherwise noted, *Authen::Bitcard* is Copyright 2004-2010
     Develooper LLC, ask at develooper.com.
 
     Parts are Copyright 2004 Six Apart Ltd, cpan at sixapart.com.

Modified: trunk/libauthen-bitcard-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/debian/changelog?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/debian/changelog (original)
+++ trunk/libauthen-bitcard-perl/debian/changelog Tue Aug  3 03:33:31 2010
@@ -1,13 +1,9 @@
-libauthen-bitcard-perl (0.87-1) UNRELEASED; urgency=low
-
-  This release is mainly doc fixes, and shouldn't affect anything
-  IGNORE-VERSION: 0.87-1
+libauthen-bitcard-perl (0.89-1) unstable; urgency=low
 
   [ Jonathan Yu ]
-  * New upstream release
+  * New upstream release (0.87).
   * Standards-Version 3.8.3 (drop perl version dependency)
   * Add myself to Uploaders
-  * Use an override to remove transitional Sau::Client file
 
   [ gregor herrmann ]
   * debian/control: Changed: Switched Vcs-Browser field to ViewSVN
@@ -16,7 +12,19 @@
   [ Nathan Handler ]
   * debian/watch: Update to ignore development releases.
 
- -- Jonathan Yu <jawnsy at cpan.org>  Sat, 19 Sep 2009 20:42:47 -0400
+  [ Ansgar Burchardt ]
+  * New upstream release (0.89).
+    + Now licensed under Apache-2.0.
+  * debian/copyright: Update for new upstream release, formatting changes for
+    current DEP-5 proposal.
+  * Remove (build-)dep on libdigest-sha1-perl.
+  * Add (build-)dep on libjson-perl.
+  * Add build-dep on libtest-script-perl.
+  * Use source format 3.0 (quilt).
+  * Bump Standards-Version to 3.9.1.
+  * Add myself to Uploaders.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Tue, 03 Aug 2010 12:27:25 +0900
 
 libauthen-bitcard-perl (0.86-1) unstable; urgency=low
 

Modified: trunk/libauthen-bitcard-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/debian/control?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/debian/control (original)
+++ trunk/libauthen-bitcard-perl/debian/control Tue Aug  3 03:33:31 2010
@@ -1,21 +1,23 @@
 Source: libauthen-bitcard-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 7.0.50)
-Build-Depends-Indep: perl, liburi-perl (>= 1.22), libwww-perl, 
- libdigest-sha1-perl, libtest-pod-coverage-perl, libclass-errorhandler-perl,
- libmath-bigint-gmp-perl, libtest-pod-perl
+Build-Depends: debhelper (>= 7)
+Build-Depends-Indep: perl, libclass-errorhandler-perl, libjson-perl (>= 2.12),
+ libmath-bigint-gmp-perl, libtest-pod-coverage-perl, libtest-pod-perl,
+ libtest-script-perl, liburi-perl (>= 1.22), libwww-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: AGOSTINI Yves <agostini at univ-metz.fr>, Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.3
+Uploaders: AGOSTINI Yves <agostini at univ-metz.fr>,
+ Jonathan Yu <jawnsy at cpan.org>, Ansgar Burchardt <ansgar at 43-1.org>
+Standards-Version: 3.9.1
 Homepage: http://search.cpan.org/dist/Authen-Bitcard/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libauthen-bitcard-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libauthen-bitcard-perl/
 
 Package: libauthen-bitcard-perl
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, liburi-perl (>= 1.22), libwww-perl,
- libdigest-sha1-perl, libclass-errorhandler-perl, libmath-bigint-gmp-perl
+Depends: ${perl:Depends}, ${misc:Depends}, libclass-errorhandler-perl,
+ libjson-perl (>= 2.12), libmath-bigint-gmp-perl, liburi-perl (>= 1.22),
+ libwww-perl
 Description: Perl module providing authentication using the Bitcard service
  Authen::Bitcard is an implementation of verification for signatures generated
  by Bitcard authentication. For information on the Bitcard protocol and using

Modified: trunk/libauthen-bitcard-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/debian/copyright?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/debian/copyright (original)
+++ trunk/libauthen-bitcard-perl/debian/copyright Tue Aug  3 03:33:31 2010
@@ -1,31 +1,46 @@
-Format-Specification:
-    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
-Upstream-Maintainer: Ask Bjørn Hansen <ask at perl.org>
-Upstream-Source: http://search.cpan.org/dist/Authen-Bitcard
-Upstream-Name: Authen-Bitcard
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
+Maintainer: Ask Bjørn Hansen <ask at develooper.com>
+Source: http://search.cpan.org/dist/Authen-Bitcard/
+Name: Authen-Bitcard
 
-Files: *
-Copyright: 2004-2006, Develooper LLC <ask at develooper.com>
- 2004, Six Apart Ltd <cpan at sixapart.com>
-License-Alias: Perl
-License: Artistic | GPL-1+
+Copyright:
+ 2004-2010, Ask Bjørn Hansen, Develooper LLC <ask at develooper.com>
+ 2004,      Six Apart Ltd, cpan at sixapart.com
+License: Apache-2.0
 
 Files: debian/*
-Copyright: 2009, Jonathan Yu <jawnsy at cpan.org>
+Copyright:
+ 2009, Jonathan Yu <jawnsy at cpan.org>
  2008, AGOSTINI Yves <agostini at univ-metz.fr>
-License: Artistic | GPL-1+
+License: Artistic or GPL-1+
+
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+     http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ .
+ On Debian GNU/Linux systems, the complete text of the Apache License,
+ Version 2.0 can be found in `/usr/share/common-licenses/Apache-2.0'.
 
 License: Artistic
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the Artistic License, which comes with Perl.
-    On Debian GNU/Linux systems, the complete text of the Artistic License
-    can be found in `/usr/share/common-licenses/Artistic'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian GNU/Linux systems, the complete text of the Artistic License
+ can be found in `/usr/share/common-licenses/Artistic'.
 
 License: GPL-1+
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 1, or (at your option)
-    any later version.
-    On Debian GNU/Linux systems, the complete text of the GNU General
-    Public License can be found in `/usr/share/common-licenses/GPL'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian GNU/Linux systems, the complete text of version 1 of the GNU
+ General Public License can be found in `/usr/share/common-licenses/GPL-1'.
 

Modified: trunk/libauthen-bitcard-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/debian/rules?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/debian/rules (original)
+++ trunk/libauthen-bitcard-perl/debian/rules Tue Aug  3 03:33:31 2010
@@ -1,11 +1,4 @@
 #!/usr/bin/make -f
-
-PACKAGE = $(shell dh_listpackages)
-TMP     = $(CURDIR)/debian/$(PACKAGE)
 
 %:
 	dh $@
-
-override_dh_auto_install:
-	dh_auto_install
-	rm -rf $(TMP)/usr/share/perl5/Sau

Added: trunk/libauthen-bitcard-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/debian/source/format?rev=61104&op=file
==============================================================================
--- trunk/libauthen-bitcard-perl/debian/source/format (added)
+++ trunk/libauthen-bitcard-perl/debian/source/format Tue Aug  3 03:33:31 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)

Modified: trunk/libauthen-bitcard-perl/lib/Authen/Bitcard.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libauthen-bitcard-perl/lib/Authen/Bitcard.pm?rev=61104&op=diff
==============================================================================
--- trunk/libauthen-bitcard-perl/lib/Authen/Bitcard.pm (original)
+++ trunk/libauthen-bitcard-perl/lib/Authen/Bitcard.pm Tue Aug  3 03:33:31 2010
@@ -1,16 +1,19 @@
 package Authen::Bitcard;
+BEGIN {
+  $Authen::Bitcard::VERSION = '0.89';
+}
 use strict;
 use base qw( Class::ErrorHandler );
 
-use Math::BigInt lib => 'GMP,Pari';
+use Math::BigInt;
 use MIME::Base64 qw( decode_base64 );
-use Digest::SHA1 qw( sha1 );
+use Digest::SHA qw( sha1 sha1_hex );
 use LWP::UserAgent;
 use HTTP::Status qw( RC_NOT_MODIFIED );
 use URI;
 use URI::QueryParam;
-
-our $VERSION = '0.87';
+use Carp qw(croak);
+use JSON qw(decode_json);
 
 sub new {
     my $class = shift;
@@ -39,6 +42,7 @@
 sub skip_expiry_check { shift->_var('skip_expiry_check', @_) }
 sub expires           { shift->_var('expires',           @_) }
 sub token             { shift->_var('token',             @_) }
+sub api_secret        { shift->_var('api_secret',        @_) }
 sub version           { shift->_var('version',           @_) }
 sub ua                { shift->_var('ua',                @_) }
 sub bitcard_url       { shift->_var('bitcard_url',       @_) }
@@ -58,7 +62,18 @@
   my $base = $bc->bitcard_url;
   $base = "$base/" unless $base =~ m!/$!;
   my $uri = URI->new($base . $url);
-  $uri->query_form_hash($args) unless $url =~ m/regkey.txt/;;
+  unless ($url =~ m/regkey.txt/) {
+      if ($url =~ m!^api/!) {
+          croak "Bitcard API Secret required for API calls" unless $bc->api_secret;
+          $args->{bc_ts} = time;
+          my @fields = sort keys %$args;
+          $args->{bc_fields} = join ",", @fields, 'bc_fields';
+          my $string = join "::", (map { "$args->{$_}" } @fields, 'bc_fields'), $bc->api_secret;
+          warn "ST: $string";
+          $args->{bc_sig} = sha1_hex($string);
+      }
+      $uri->query_form_hash($args);
+  }
   $uri->as_string;
 }
 
@@ -81,6 +96,12 @@
 sub register_url {
   shift->_url('register', @_)
 }
+
+sub _api_url {
+  my ($self, $method) = (shift, shift);
+  $self->_url("api/$method", @_);
+}
+
 
 sub verify {
     my $bc = shift;
@@ -154,6 +175,10 @@
     $u1 == $sig->{r};
 }
 
+sub _get_ua {
+    shift->ua || LWP::UserAgent->new;
+}
+
 sub _fetch_key {
     my $bc = shift;
     my($uri) = @_;
@@ -162,7 +187,7 @@
     return $cache->($bc, $uri) if $cache && ref($cache) eq 'CODE';
     ## Otherwise, load the key.
     my $data;
-    my $ua = $bc->ua || LWP::UserAgent->new;
+    my $ua = $bc->_get_ua;
     if ($cache) {
         my $res = $ua->mirror($uri, $cache);
         return $bc->error("Failed to fetch key: " . $res->status_line)
@@ -186,6 +211,17 @@
     $key;
 }
 
+sub add_invite {
+    my $self  = shift;
+    my $url = $self->_api_url('invite/add_invite', @_);
+    warn "URL: $url\n";
+    my $res = $self->_get_ua->get($url);
+    return $self->error("Failed to retrive invitation code: " . $res->status_line)
+      unless $res->is_success;
+    my $data = decode_json($res->content);
+    $data;
+}
+
 1;
 __END__
 
@@ -367,15 +403,27 @@
 Get/set the version of the Bitcard protocol to use. The default version
 is C<3>.
 
+=head2 $bc->api_secret( $secret )
+
+Get/set the api_secret (needed for some API calls, add_invite for
+example).
+
+=head2 $bc->add_invite
+
+Returns a hashref with C<invite_url> and C<invite_key>.  Can be used
+for "invitation only" sites where you have to login before you can
+access the site.
+
+
 =head1 LICENSE
 
-I<Authen::Bitcard> is free software; you may redistribute it and/or modify it
-under the same terms as Perl itself.
+I<Authen::Bitcard> is distributed under the Apache License; see the
+LICENSE file in the distribution for details.
 
 =head1 AUTHOR & COPYRIGHT
 
 Except where otherwise noted, I<Authen::Bitcard> is Copyright
-2004-2006 Develooper LLC, ask at develooper.com.
+2004-2010 Develooper LLC, ask at develooper.com.
 
 Parts are Copyright 2004 Six Apart Ltd, cpan at sixapart.com.
 




More information about the Pkg-perl-cvs-commits mailing list