keypairs 0.1.0.alpha.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -6
- data/{app/models → lib}/keypair.rb +0 -0
- data/lib/keypairs.rb +8 -1
- data/lib/keypairs/engine.rb +2 -12
- data/{app/controllers → lib}/keypairs/public_keys_controller.rb +0 -0
- data/lib/keypairs/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d5f2f484253f46b38eb0c4ee8a71e77bec208ac0aeca8a5909f20389b8de9a9
|
4
|
+
data.tar.gz: bb148cb660872ca14d8ba9c3416fccff38efeac97619f581b5019f2f76b83157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
7
|
+
1. **Add gem**
|
8
8
|
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
data/lib/keypairs.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'lockbox'
|
4
|
-
|
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)
|
data/lib/keypairs/engine.rb
CHANGED
@@ -1,18 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Keypairs
|
4
|
-
#
|
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
|
-
|
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
|
File without changes
|
data/lib/keypairs/version.rb
CHANGED
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
|
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-
|
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:
|
243
|
+
version: '0'
|
244
244
|
requirements: []
|
245
245
|
rubygems_version: 3.1.4
|
246
246
|
signing_key:
|