Skip to content

Commit

Permalink
signature.to_s
Browse files Browse the repository at this point in the history
  • Loading branch information
jshawl committed Feb 7, 2024
1 parent 3845a82 commit 54798af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/minisign/signature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def signature
encoded_signature[10..]
end

def to_s
@lines.join("\n") + "\n"
end

private

def encoded_signature
Expand Down
9 changes: 8 additions & 1 deletion spec/minisign/signature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# frozen_string_literal: true

describe Minisign::Signature do
it 'has a key id' do
before do
@signature = Minisign::Signature.new(File.read('test/example.txt.minisig'))
end

it 'has a key id' do
expect(@signature.key_id).to eq('4CB7A94FABA329A6')
end

it 'can be written to a file' do
expect(@signature.to_s).to eq(File.read('test/example.txt.minisig'))
end
end

0 comments on commit 54798af

Please sign in to comment.