From d698be35381eea57006b8f0c3789334c229a51fb Mon Sep 17 00:00:00 2001 From: Jesse Shawl Date: Mon, 30 May 2022 15:21:38 -0500 Subject: [PATCH] v0.0.5 --- .gitignore | 2 ++ CHANGELOG.md | 8 +++++++- Gemfile.lock | 2 +- lib/minisign.rb | 24 ++++++++++++++++++++++++ minisign.gemspec | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4ebc8ae..9804fa1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ coverage +doc +.yardoc diff --git a/CHANGELOG.md b/CHANGELOG.md index e9eb7a5..5e555fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.0.5] - 2022-05-30 + +### Added +- Documentation for YARD (https://www.rubydoc.info/gems/minisign/) + ## [0.0.4] - 2022-05-30 ### Added - This CHANGELOG file to hopefully serve as an evolving example of a standardized open source project CHANGELOG. -[Unreleased]: https://github.com/jshawl/minisign/compare/v0.0.4...HEAD +[Unreleased]: https://github.com/jshawl/minisign/compare/v0.0.5...HEAD +[0.0.5]: https://github.com/jshawl/minisign/compare/v0.0.4...v0.0.5 [0.0.4]: https://github.com/jshawl/minisign/releases/tag/v0.0.4 diff --git a/Gemfile.lock b/Gemfile.lock index f4d7224..40c8ebf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - minisign (0.0.4) + minisign (0.0.5) ed25519 (~> 1.3) GEM diff --git a/lib/minisign.rb b/lib/minisign.rb index 4dd9e39..27e2c47 100644 --- a/lib/minisign.rb +++ b/lib/minisign.rb @@ -4,11 +4,23 @@ require 'base64' require 'openssl' +# `minisign` is a rubygem for verifying {https://jedisct1.github.io/minisign minisign} signatures. +# @author Jesse Shawl module Minisign # Parse a .minisig file's contents class Signature attr_reader :signature, :comment, :comment_signature + # @!attribute [r] signature + # @return [String] the ed25519 verify key + # @!attribute [r] comment_signature + # @return [String] the signature for the trusted comment + # @!attribute [r] comment + # @return [String] the trusted comment + + # @param str [String] The contents of the .minisig file + # @example + # Minisign::Signature.new(File.read('test/example.txt.minisig')) def initialize(str) lines = str.split("\n") @signature = Base64.decode64(lines[1])[10..] @@ -19,11 +31,23 @@ def initialize(str) # Parse ed25519 verify key from minisign public key class PublicKey + # Parse the ed25519 verify key from the minisign public key + # + # @param str [String] The minisign public key + # @example + # Minisign::PublicKey.new('RWTg6JXWzv6GDtDphRQ/x7eg0LaWBcTxPZ7i49xEeiqXVcR+r79OZRWM') def initialize(str) @public_key = Base64.strict_decode64(str)[10..] @verify_key = Ed25519::VerifyKey.new(@public_key) end + # Verify a message's signature + # + # @param sig [Minisign::Signature] + # @param message [String] the content that was signed + # @return [String] the trusted comment + # @raise Ed25519::VerifyError on invalid signatures + # @raise RuntimeError on tampered trusted comments def verify(sig, message) blake = OpenSSL::Digest.new('BLAKE2b512') @verify_key.verify(sig.signature, blake.digest(message)) diff --git a/minisign.gemspec b/minisign.gemspec index 5661d22..1997fd4 100644 --- a/minisign.gemspec +++ b/minisign.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'minisign' - s.version = '0.0.4' + s.version = '0.0.5' s.summary = 'Minisign, in Ruby!' s.description = 'Verify minisign signatures' s.authors = ['Jesse Shawl']