From b802db9194cd0edec983bf3e2ea69c932804385f Mon Sep 17 00:00:00 2001 From: ilya Date: Fri, 9 Jul 2010 17:41:01 -0400 Subject: [PATCH] writing signing --- app/models/post.rb | 7 +++++-- gpg/diaspora-test/random_seed | Bin 600 -> 600 bytes spec/user_encryption_spec.rb | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index a0b69e08b..ca6e1ee83 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -9,7 +9,8 @@ class Post xml_accessor :person, :as => Person key :person_id, ObjectId - + key :owner_signature, String + many :comments, :class_name => 'Comment', :foreign_key => :post_id belongs_to :person, :class_name => 'Person' @@ -42,7 +43,9 @@ class Post self.newest(Person.first(:email => email)) end - + def verify_signature + GPGME.verify(owner + end protected def destroy_comments comments.each{|c| c.destroy} diff --git a/gpg/diaspora-test/random_seed b/gpg/diaspora-test/random_seed index 303e6b5ce0e5946e93040d73e9c0a3fa0e467480..506a7c40031f6d9ed4e2126782dd16058d0c54ca 100644 GIT binary patch literal 600 zcmV-e0;m0FWcFY%lza+p6ZedPRfHU;TXAFCEd z?>r$nSBSGsoHCIRx#c$aW6L;1^(h_}g~`^Rm3dQYBb~qI^PzzH8t55_hX+=Bzoq&{ z4*FtIyaw$9|74e^!x0}1EKO-rI&d<*skN;+Z+ z-*BWJ#$%LJKC_#yB!2Q@_!`LCoWV0NRR$2~PyjD%(V0ukhjW13sFN{z0zywL~OUj~uY7J5V3BYV~=Y mUQl&@tiPaFlu=GwdJ-+-uA6}c4nume-Y6}FFQTV`ob(p!6()!P literal 600 zcmV-e0;m1?w;kglkgbB|hOAY28mQE%5#+7r6^8mZpm$a8Rdb6>i%fO|^xzX+^+`)GnB3 zqWKya@yF29_d_{Btl@C}@w*{-~5VN?3Is%$14GeEuh19LUQ&W-_6~AEx%BZ^-Zc@kId$p0sEvKKg2oZ}m{yh$c zKii))Kq{^m_fhtEXuD22Lp09h#}1z<%fKSNAPY(LEm1$BL=5>YN=aZ`jSf;SWTLMP z^3c-!r`UC25F_Ay`H|EvOE|wL$>Kl3KE*J{Q^kq=hbPv*&q!DQnX8fSMGnNPFP2*L zk%`hW89ooDnPp>(Od_zb;r&)D{J=_X;em(?t0Bfot-MT!RW0;87+u7n$dRR530)8# m^m#|3T(k;KY|jeB&#!9|zkp*zUUzEzOMQ9I$rvpks-0tbXfbX8 diff --git a/spec/user_encryption_spec.rb b/spec/user_encryption_spec.rb index 6e9fb8960..02baba68a 100644 --- a/spec/user_encryption_spec.rb +++ b/spec/user_encryption_spec.rb @@ -30,5 +30,8 @@ describe 'user encryption' do @u.key.subkeys[0].fpr.should == @u.key_fingerprint end - + it 'should sign a message' do + message = Factory.create(:status_message, :user => @u) + message.verify_signature.should == true + end end