<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>google-authsub-0.0.4.gem</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,4 @@
-Copyright (c) 2008 Stuart Coyle
+Copyright (c) 2008-2009 Stuart Coyle
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the</diff>
      <filename>MIT-LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -2,12 +2,12 @@ require 'rake'
 
 Gem::Specification.new do |s|
    s.name = %q{google-authsub}
-   s.version = &quot;0.0.3&quot;
-   s.date = %q{2008-08-22}
+   s.version = &quot;0.0.4&quot;
+   s.date = %q{2009-07-13}
    s.authors = [&quot;Stuart Coyle&quot;]
    s.email = %q{stuart.coyle@gmail.com}
    s.summary = %q{A ruby implementation of Google Authentication for Web Applications API}
-   s.homepage = %q{http://www.cybertherial.com/authsub}
+   s.homepage = %q{http://github.com/stuart/google-authsub/tree/master}
    s.description = %q{GoogleAuthSub provides the Google Authentications for Web Applications API.}
    s.files = FileList['*.rb','lib/*.rb','spec/*', 'spec/**/*', '[A-Z]*'].to_a
    [ &quot;README&quot;,&quot;MIT-LICENSE&quot;, &quot;googleauthsub.rb&quot;, &quot;spec/*&quot;]</diff>
      <filename>google-authsub.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
 # AuthSub - Ruby library for Google Authorization
-# # Copyright 2008 Stuart Coyle &lt;stuart.coyle@gmail.com&gt;
+# # Copyright 2008-2009 Stuart Coyle &lt;stuart.coyle@gmail.com&gt;
 #
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
@@ -42,7 +42,7 @@ end
 
 class AuthSubError &lt; Error
   def message
-    &quot;Google Authentication Error&quot;
+    &quot;Google Authentication Error&quot; &lt;&lt; &quot; : #{@message}&quot; if @message
   end
 end
 </diff>
      <filename>lib/googleauthsub.rb</filename>
    </modified>
    <modified>
      <diff>@@ -131,7 +131,7 @@ describe GoogleAuthSub do
     
     before do
        Time.stub!(:now).and_return(Time.local(2008,&quot;mar&quot;,8,12,15,1)) # == 1204942501 
-       OpenSSL::BN.stub!(:rand_range).and_return(100000000000000)
+       OpenSSL::BN.stub!(:rand_range).and_return(100000000000000) # set our nonce to known value
        FakeWeb.register_uri(:any, @data_request_url, :response =&gt; File.dirname(__FILE__)+&quot;/mock responses/calendar.txt&quot;)
        @authsub.secure = true
        @authsub.token = @token
@@ -150,12 +150,29 @@ describe GoogleAuthSub do
       @authsub.auth_header(Net::HTTP::Get.new(@data_request_url), @data_request_url).should == &quot;AuthSub token=\&quot;#{@token}\&quot;&quot;
     end
     
+
+    it &quot;should have a correct token when secure&quot; do
+      @authsub.auth_header(Net::HTTP::Get.new(@data_request_url), @data_request_url).should include(&quot;token=\&quot;#{@token}\&quot;&quot;)
+    end   
+    
+    # data = http-method SP http-request-URL SP timestamp SP nonce
+    it &quot;should have a proper data parameter&quot; do
+      @authsub.auth_header(Net::HTTP::Get.new(@data_request_url), @data_request_url).should include(&quot;data=\&quot;GET #{@data_request_url} 1204942501 100000000000000\&quot;&quot;)
+    end
+    
+    it &quot;should generate the correct signature&quot; do
+      expected_sig = &quot;GET #{@data_request_url} 1204942501 100000000000000&quot;
+      sig = @authsub.auth_header(Net::HTTP::Get.new(@data_request_url), @data_request_url).match(/sig=\&quot;([^\&quot;]*)$/)[1]
+      @public_key.public_decrypt(sig.unpack(&quot;m&quot;).join).should ==  OpenSSL::Digest::SHA1.new(expected_sig).hexdigest
+    end
+    
     it &quot;should generate a correct authorization header when secure&quot; do
       @authsub.auth_header(Net::HTTP::Get.new(@data_request_url), @data_request_url).should == 
       &quot;AuthSub token=\&quot;CMScoaHmDxC80Y2pAg\&quot; data=\&quot;GET http://www.google.com/calendar/feeds/default/private/full 1204942501 100000000000000\&quot; sig=\&quot;5H44KRwb+B9dMraK0mxsVv3aSF+gCz1hz7FEMViYdl89rC/BXQkmW7Xb9/Xf\n226E5Q+RPtFd+DaK/mXFxtoOJBqlz7mZgV+QOrr/dxCM6HpjIpxF9Qxo9zCT\nKvz0IS4gxXCVMgEgJOdF3YjqZo2bMgiG/Wjm/774Yitkc2tKhL8=\n\&quot; sigalg=\&quot;rsa-sha1\&quot;&quot;  
     end
-    
-    
+  end   
+     
+  describe &quot;setting the private key&quot; do
     it &quot;should take private key as a  file&quot; do
       f = File.open(File.dirname(__FILE__)+&quot;/mock_certs/test_private_key.pem&quot;)
       GoogleAuthSub.set_private_key(f)
@@ -165,7 +182,6 @@ describe GoogleAuthSub do
       s = File.open(File.dirname(__FILE__)+&quot;/mock_certs/test_private_key.pem&quot;).read
       GoogleAuthSub.set_private_key(s)
     end
-    
   end
 
   describe &quot;Token received from Google in response url. Note: in Rails this is simply params[:token]&quot; do</diff>
      <filename>spec/googleauthsub_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>787b069d3ac7ca1ef7c76644c95f5c8966286bb6</id>
    </parent>
  </parents>
  <author>
    <name>Stuart Coyle</name>
    <email>stuart.coyle@gmail.com</email>
  </author>
  <url>http://github.com/stuart/google-authsub/commit/23bbfd7b58d78ea9d975affe636438fff1f9d1f2</url>
  <id>23bbfd7b58d78ea9d975affe636438fff1f9d1f2</id>
  <committed-date>2009-07-13T05:11:40-07:00</committed-date>
  <authored-date>2009-07-13T05:11:40-07:00</authored-date>
  <message>Removed old coverage files.
Added 2009 to copyright notices.
Modified gemspec and created version 0.0.4
Added a couple of new specs.</message>
  <tree>0534d0d95710e4df3a90a011b05a6dd3ca658078</tree>
  <committer>
    <name>Stuart Coyle</name>
    <email>stuart.coyle@gmail.com</email>
  </committer>
</commit>
