diff --git a/.rubocop.yml b/.rubocop.yml index 58a9ee2..3bf1f76 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ +require: + - rubocop-performance + inherit_mode: merge: - Exclude @@ -36,5 +39,8 @@ Security: Style/FrozenStringLiteralComment: Enabled: true +Style/HashSyntax: + Enabled: true + Style/RedundantFreeze: Enabled: true diff --git a/.travis.yml b/.travis.yml index 76b444d..b422e7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ sudo: false language: ruby cache: bundler +os: + - linux + - osx + rvm: - ruby-head - 2.7.0-preview1 @@ -17,7 +21,9 @@ gemfile: - gemfiles/openssl_2_0.gemfile - gemfiles/openssl_default.gemfile -before_install: gem install bundler -v '~> 1.17' +before_install: + - gem install bundler -v '~> 1.17' + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./script/setup-osx; else sudo ./script/setup-linux; fi matrix: fast_finish: true diff --git a/CHANGELOG.md b/CHANGELOG.md index fda21eb..985557a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [v0.8.0] - 2019-08-17 + +### Added + +- Support `COSE::Key` instantiation based on an `OpenSSL::PKey` object with `COSE::Key.from_pkey` +- Provide writer methods for `COSE::Key` Common Parameters (`#base_iv=`, `#key_ops=`, `#alg=` and `#kid=`) + ## [v0.7.0] - 2019-05-02 ### Fixed @@ -79,6 +86,7 @@ - EC2 key object - Works with ruby 2.5 +[v0.8.0]: https://github.com/cedarcode/cose-ruby/compare/v0.7.0...v0.8.0/ [v0.7.0]: https://github.com/cedarcode/cose-ruby/compare/v0.6.1...v0.7.0/ [v0.6.1]: https://github.com/cedarcode/cose-ruby/compare/v0.6.0...v0.6.1/ [v0.6.0]: https://github.com/cedarcode/cose-ruby/compare/v0.5.0...v0.6.0/ diff --git a/README.md b/README.md index 9bc28e8..ec05705 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,25 @@ # cose -CBOR Object Signing and Encryption (COSE) ruby library +Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE) [![Gem](https://img.shields.io/gem/v/cose.svg?style=flat-square)](https://rubygems.org/gems/cose) [![Travis](https://img.shields.io/travis/cedarcode/cose-ruby.svg?style=flat-square)](https://travis-ci.org/cedarcode/cose-ruby) +## Prerequisites + +### OSX + +``` +brew tap pjk/libcbor +brew install libcbor +``` + +### Linux (APT) + +``` +apt-get install libcbor-dev +``` + ## Installation Add this line to your application's Gemfile: diff --git a/Rakefile b/Rakefile index 3e05b08..f08d54f 100644 --- a/Rakefile +++ b/Rakefile @@ -7,4 +7,4 @@ require "rubocop/rake_task" RSpec::Core::RakeTask.new(:spec) RuboCop::RakeTask.new -task :default => [:rubocop, :spec] +task default: [:rubocop, :spec] diff --git a/cose.gemspec b/cose.gemspec index 897a797..05f6a15 100644 --- a/cose.gemspec +++ b/cose.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.authors = ["Gonzalo Rodriguez", "Braulio Martinez"] spec.email = ["gonzalo@cedarcode.com", "braulio@cedarcode.com"] - spec.summary = "CBOR Object Signing and Encryption (COSE) ruby library" + spec.summary = "Ruby implementation of RFC 8152 CBOR Object Signing and Encryption (COSE)" spec.homepage = "https://github.com/cedarcode/cose-ruby" spec.license = "MIT" @@ -31,12 +31,13 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 2.2" - spec.add_dependency "cbor", "~> 0.5.9" + spec.add_dependency "libcbor", "~> 0.1.0" spec.add_development_dependency "appraisal", "~> 2.2.0" spec.add_development_dependency "bundler", ">= 1.17", "< 3" spec.add_development_dependency "byebug", ">= 10.0" spec.add_development_dependency "rake", "~> 12.3" spec.add_development_dependency "rspec", "~> 3.8" - spec.add_development_dependency "rubocop", "0.66.0" + spec.add_development_dependency "rubocop", "0.68.0" + spec.add_development_dependency "rubocop-performance", "~> 1.3" end diff --git a/lib/cbor.rb b/lib/cbor.rb new file mode 100644 index 0000000..549bcf3 --- /dev/null +++ b/lib/cbor.rb @@ -0,0 +1 @@ +require "libcbor/all" diff --git a/lib/cose/version.rb b/lib/cose/version.rb index 3aad272..5be5b6d 100644 --- a/lib/cose/version.rb +++ b/lib/cose/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module COSE - VERSION = "0.7.0" + VERSION = "0.8.0" end diff --git a/script/setup-linux b/script/setup-linux new file mode 100755 index 0000000..1b7e150 --- /dev/null +++ b/script/setup-linux @@ -0,0 +1,10 @@ +#!/bin/sh + +set -x + +if ! apt-cache show libcbor-dev >> /dev/null; then + add-apt-repository ppa:yubico/stable -y + apt-get update -q +fi + +apt-get install libcbor-dev -y diff --git a/script/setup-osx b/script/setup-osx new file mode 100755 index 0000000..e49e177 --- /dev/null +++ b/script/setup-osx @@ -0,0 +1,6 @@ +#!/bin/sh + +set -x + +brew tap pjk/libcbor +brew install libcbor