writing signing
This commit is contained in:
parent
d21a3baf32
commit
b802db9194
3 changed files with 9 additions and 3 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue