keypairs 0.1.0.alpha.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf4de0021d86f8b939eb09102bf3523ff50c43b65306090823f4d7ea896f85c6
4
- data.tar.gz: 69e0d3738b6e8d3c2d3d1e7b397b08361d83b98f075526ffd9174ab844201109
3
+ metadata.gz: 1d5f2f484253f46b38eb0c4ee8a71e77bec208ac0aeca8a5909f20389b8de9a9
4
+ data.tar.gz: bb148cb660872ca14d8ba9c3416fccff38efeac97619f581b5019f2f76b83157
5
5
  SHA512:
6
- metadata.gz: 0e2acb9c0ec8069c3de1885bb810d6d759fa5e6594ce309feffb3abd5e357338106740949185734731f2fd9368b06472cbc2cd2dedc2a283711c78a17587c6af
7
- data.tar.gz: 359aeb886e535c34f4c8071b4043e1186c92e91947b05c6215cd45efd3a54314abb85be17d8e56b5e186581b8a166f9b8f5f2e22ab4cc1af8a9590d796c9c546
6
+ metadata.gz: 6b0baa0b7ad99ed238cbd7021f81fe53a40abfc720e0a1b95bc8c83f23680b15aac0c19f551f3f4c19821423a29dc2a2e48c41e68a0af3da9e9442c094784920
7
+ data.tar.gz: 53160f8c12ff02c7b3143f771b7890a50e4ad1014f6c1b1c5ec6b3d97486477b831fefa5a3b3654daeb0617ae09dcdb5494cba0465850823023abe68de8a133b
data/README.md CHANGED
@@ -4,15 +4,28 @@ Applications often need to have a public/private keypair so sign messages. This
4
4
  Note: This gem is intended to work within Rails applications. It can probably be adjusted easily to also work for non-rails / sinatra project but that's out of scope for now.
5
5
 
6
6
  ## Installation
7
- Add this line to your application's Gemfile:
7
+ 1. **Add gem**
8
8
 
9
- ```ruby
10
- gem 'keypairs'
11
- ```
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'keypairs'
13
+ ```
14
+
15
+ The of course run `bundle install`.
16
+
17
+ 2. **Copy migration**
18
+
19
+ The default migration file can be copied to your app with:
20
+ ```bash
21
+ bundle exec rails keypairs:install:migrations
22
+ ```
23
+
24
+ Then of course run `bundle exec rails db:migrate`
12
25
 
13
- The of course run `bundle install` and run the migrations `bundle exec rake db:migrate`. The migrations from the gem run automatically.
26
+ 3. **Setup encryption key**
14
27
 
15
- The private keys are encrypted with the [lockbox](https://github.com/ankane/lockbox) gem. In order for this to work, you need to set the master key as described in [the readme](https://github.com/ankane/lockbox#key-generation), but the easiest thing is to set the environment variable `LOCKBOX_MASTER_KEY` to a sufficient long string (you can generate one with `Lockbox.generate_key`).
28
+ The private keys are encrypted with the [lockbox](https://github.com/ankane/lockbox) gem. In order for this to work, you need to set the master key as described in [the readme](https://github.com/ankane/lockbox#key-generation), but the easiest thing is to set the environment variable `LOCKBOX_MASTER_KEY` to a sufficient long string (you can generate one with `Lockbox.generate_key`).
16
29
 
17
30
  ## Usage
18
31
  The central point of this gem is the `Keypair` model which is backed by the `keypairs` table. If you need to sign messages, you can get the current keypair with the `Keypair.current` method. This method performs the rotation of the keypairs if required.
File without changes
@@ -1,4 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'lockbox'
4
- require 'keypairs/engine'
4
+
5
+ autoload :Keypair, 'keypair.rb'
6
+
7
+ module Keypairs
8
+ autoload :PublicKeysController, 'keypairs/public_keys_controller'
9
+ end
10
+
11
+ require 'keypairs/engine' if defined?(Rails)
@@ -1,18 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Keypairs
4
- # Rails engine for this gem.
5
- # It ensures that the migrations are automatically ran in the applications.
4
+ # This engine is only needed to add the migration installation rake task.
6
5
  class Engine < ::Rails::Engine
7
- initializer :append_migrations do |app|
8
- unless app.root.to_s.match? "#{root}/"
9
- config.paths['db/migrate'].expanded.each do |expanded_path|
10
- app.config.paths['db/migrate'] << expanded_path
11
- end
12
- # Apartment will modify this, but it doesn't fully support engine migrations,
13
- # so we'll reset it here
14
- ActiveRecord::Migrator.migrations_paths = app.paths['db/migrate'].to_a
15
- end
16
- end
6
+ engine_name 'keypairs'
17
7
  end
18
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Keypairs
4
- VERSION = '0.1.0.alpha.2'
4
+ VERSION = '0.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keypairs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stef Schenkelaars
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -215,11 +215,11 @@ extra_rdoc_files: []
215
215
  files:
216
216
  - LICENSE
217
217
  - README.md
218
- - app/controllers/keypairs/public_keys_controller.rb
219
- - app/models/keypair.rb
220
218
  - db/migrate/20201024100500_create_keypairs.rb
219
+ - lib/keypair.rb
221
220
  - lib/keypairs.rb
222
221
  - lib/keypairs/engine.rb
222
+ - lib/keypairs/public_keys_controller.rb
223
223
  - lib/keypairs/version.rb
224
224
  homepage: https://drieam.github.io/keypairs
225
225
  licenses:
@@ -238,9 +238,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
238
  version: 2.5.0
239
239
  required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  requirements:
241
- - - ">"
241
+ - - ">="
242
242
  - !ruby/object:Gem::Version
243
- version: 1.3.1
243
+ version: '0'
244
244
  requirements: []
245
245
  rubygems_version: 3.1.4
246
246
  signing_key: